# Use Hanzo AI with Rust — Hanzo AI > Use Hanzo AI in Rust via the async-openai crate or raw reqwest HTTP calls. Full async support with Tokio, streaming, and type-safe API access. [Integrations](https://hanzo.ai/integrations)/Rust 🦀Languages # Use Hanzo AI with Rust Use Hanzo AI in Rust via the async-openai crate or raw reqwest HTTP calls. Full async support with Tokio, streaming, and type-safe API access. Base URL: `https://api.hanzo.ai/v1` API Key: Get yours at [hanzo.ai/signup](https://hanzo.ai/signup) · Fully OpenAI-compatible · 500+ models available 🦀 Created by [Rust Foundation](https://rust-lang.org) License: MIT / Apache-2.0 · [View source on GitHub →](https://github.com/rust-lang/rust) Hanzo AI is OpenAI-compatible, so existing Rust code works with zero refactoring. We deeply appreciate the Rust Foundation team for building and maintaining this open-source project. ## Cargo.toml toml ``` [dependencies] async-openai = "0.26" tokio = { version = "1", features = ["full"] } ``` ## async-openai rust ``` use async_openai::{config::OpenAIConfig, Client, types::*}; #[tokio::main] async fn main() { let config = OpenAIConfig::new() .with_api_base("https://api.hanzo.ai/v1") .with_api_key(std::env::var("HANZO_API_KEY").unwrap()); let client = Client::with_config(config); let request = CreateChatCompletionRequestArgs::default() .model("zen4-pro") .messages([ChatCompletionRequestUserMessageArgs::default() .content("Hello from Rust!") .build() .unwrap() .into()]) .build() .unwrap(); let response = client.chat().create(request).await.unwrap(); println!("{}", response.choices[0].message.content.as_ref().unwrap()); } ``` ## reqwest raw HTTP rust ``` use reqwest::Client; use serde_json::json; #[tokio::main] async fn main() { let client = Client::new(); let resp = client .post("https://api.hanzo.ai/v1/chat/completions") .bearer_auth(std::env::var("HANZO_API_KEY").unwrap()) .json(&json!({ "model": "zen4-pro", "messages": [{"role": "user", "content": "Hello!"}] })) .send() .await .unwrap(); println!("{}", resp.text().await.unwrap()); } ``` ## Build and run bash ``` export HANZO_API_KEY="your-hanzo-api-key" cargo build --release ./target/release/my-ai-app ``` ## Ready to get started? Create a free account and get your API key. 100K API calls/month free forever. [Get API Key — Free](https://hanzo.ai/signup)[Browse Models](https://hanzo.ai/models) ## More integrations [OpenAI Python SDK](https://hanzo.ai/integrations/openai-sdk)[Anthropic SDK](https://hanzo.ai/integrations/anthropic-sdk)[LangChain](https://hanzo.ai/integrations/langchain)[LlamaIndex](https://hanzo.ai/integrations/llamaindex)[Vercel AI SDK](https://hanzo.ai/integrations/vercel-ai-sdk)[Hugging Face](https://hanzo.ai/integrations/huggingface)[AutoGen](https://hanzo.ai/integrations/autogen)[CrewAI](https://hanzo.ai/integrations/crewai)[DSPy](https://hanzo.ai/integrations/dspy)[Haystack](https://hanzo.ai/integrations/haystack)[Cursor](https://hanzo.ai/integrations/cursor)[Continue.dev](https://hanzo.ai/integrations/continue-dev)[GitHub Copilot](https://hanzo.ai/integrations/github-copilot)[Docker](https://hanzo.ai/integrations/docker)[Kubernetes](https://hanzo.ai/integrations/kubernetes)[Python](https://hanzo.ai/integrations/python)[TypeScript](https://hanzo.ai/integrations/typescript)[Go](https://hanzo.ai/integrations/go)