# Use Hanzo AI with Anthropic SDK — Hanzo AI

> Use the Anthropic Python or TypeScript SDK with Hanzo AI to access Claude models alongside 50+ other models through a single API key and billing account.

[Integrations](https://hanzo.ai/integrations)/Anthropic SDK

🤖AI SDKs

# Use Hanzo AI with Anthropic SDK

Use the Anthropic Python or TypeScript SDK with Hanzo AI to access Claude models alongside 50+ 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](https://hanzo.ai/signup) · Fully OpenAI-compatible · 500+ models available

🤖

Created by [Anthropic](https://anthropic.com)

License: MIT · [View source on GitHub →](https://github.com/anthropics/anthropic-sdk-python)

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="glm-5.2", 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 &#x27;{"model":"anthropic/claude-sonnet-4-6","max_tokens":100,"messages":[{"role":"user","content":"Hi"}]}&#x27;
```

## 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)[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)[Rust](https://hanzo.ai/integrations/rust)
