# Rust

URL: https://docs.hanzo.ai/docs/sdks/rust

> cargo add hanzo-client — the generated async client for every /v1 capability. The separate hanzo crate is the umbrella over the wider Rust stack.

Two crates, and they are not versions of each other:

| Crate          | Install                  | What it is                                                                                      |
| -------------- | ------------------------ | ----------------------------------------------------------------------------------------------- |
| `hanzo-client` | `cargo add hanzo-client` | The generated client for every `/v1` capability. Async, `reqwest`.                              |
| `hanzo`        | `cargo add hanzo`        | The umbrella over the Rust stack — crypto, DID, MCP, agents, embeddings — behind feature flags. |

For calling the API, you want `hanzo-client`. The library name is
`hanzo_client`, so that is what you `use`.

```bash
cargo add hanzo-client tokio --features tokio/full
export HANZO_API_KEY="sk-..."   # from platform.hanzo.ai
```

## The shape

A `Configuration` value passed to free functions, grouped in a module per
capability:

```rust
use hanzo_client::apis::{ai_api, configuration::Configuration};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let mut cfg = Configuration::new();
    cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

    ai_api::get_models(&cfg).await?;
    Ok(())
}
```

`Configuration::new()` already points at `https://api.hanzo.ai`; set
`base_path` to reach a gateway you run yourself. The module is the capability
and the function is the operation, both derived from the document — the
[reference](https://docs.hanzo.ai/docs/openapi) prints the pair per operation.

> **Where a return type is \`()\`**
>
> A few operations decode to `()` because the document states the route's address
> without stating its response shape. `get_models` is one of them. The request is
> still made and the status still checked; there is simply nothing typed to hand
> back until the schema is published.

## Resources

- [`hanzo-client` on crates.io](https://crates.io/crates/hanzo-client) ·
  [`hanzo` on crates.io](https://crates.io/crates/hanzo)
- API reference and source — [`hanzo-client` on docs.rs](https://docs.rs/hanzo-client) ·
  [`hanzo` on docs.rs](https://docs.rs/hanzo)
- [Every `/v1` operation →](https://docs.hanzo.ai/docs/openapi)
