🤖
AI SDKs
Use Hanzo AI with Anthropic SDK
Use the Anthropic Python or TypeScript SDK with Hanzo AI to access Claude models alongside 390+ other models through a single API key and billing account.
Base URL: https://api.hanzo.ai/v1
API Key: Get yours at hanzo.ai/signup · Fully OpenAI-compatible · 390+ models available
🤖
Created by Anthropic
License: MIT · View source on GitHub →
Hanzo AI is OpenAI-compatible, so existing Anthropic SDK code works with zero refactoring. We deeply appreciate the Anthropic team for building and maintaining this open-source project.
Python setup
python
pip install anthropic
import anthropic
client = anthropic.Anthropic(
api_key="your-hanzo-api-key",
base_url="https://api.hanzo.ai/v1",
)
message = client.messages.create(
model="anthropic/claude-sonnet-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Claude!"}],
)
print(message.content[0].text)TypeScript setup
typescript
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.HANZO_API_KEY,
baseURL: "https://api.hanzo.ai/v1",
});
const message = await client.messages.create({
model: "anthropic/claude-sonnet-4-6",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello!" }],
});Streaming
python
with client.messages.stream(
model="anthropic/claude-opus-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Tell me a story"}],
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)cURL test
bash
curl https://api.hanzo.ai/v1/messages \
-H "x-api-key: $HANZO_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"anthropic/claude-sonnet-4-6","max_tokens":100,"messages":[{"role":"user","content":"Hi"}]}'Ready to get started?
Create a free account and get your API key. 100K API calls/month free forever.