SDKs & API

One API. Every language.

The Hanzo API is drop-in compatible with both the OpenAI SDK and the Anthropic SDK. Keep the client you already use — change one line, the base URL — and get one gateway to 50+ models plus every Hanzo product SDK.

OpenAI-compatible
base_url
https://api.hanzo.ai/v1
endpoint
/v1/chat/completions
auth
Authorization: Bearer hk-...
Anthropic-compatible
base_url
https://api.hanzo.ai
endpoint
/v1/messages
auth
x-api-key: hk-...
Code Examples

Use the OpenAI SDK

POST /v1/chat/completions — identical request/response to OpenAI Chat Completions.

Point the official OpenAI SDK at the Hanzo gateway.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.hanzo.ai/v1",
    api_key="hk-...",  # your Hanzo API key
)

resp = client.chat.completions.create(
    model="zen5",  # any model on the gateway
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
Code Examples

Use the Anthropic SDK

POST /v1/messages — the native Anthropic Messages API, x-api-key auth and content-block responses.

Point the official Anthropic SDK at the Hanzo gateway.

from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.hanzo.ai",
    api_key="hk-...",  # sent as the x-api-key header
)

msg = client.messages.create(
    model="zen5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(msg.content[0].text)
SDKs & Libraries

Official Hanzo SDKs

Use our official SDKs to integrate Hanzo into your application

Hanzo Python SDK

PyPI
pip install hanzoai

Hanzo TypeScript SDK

npm
npm install hanzoai

Hanzo Go SDK

Go Modules
go get github.com/hanzoai/go-sdk

Hanzo Rust SDK

crates.io
cargo add hanzoai