# Use Hanzo AI with Python — Hanzo AI > Use Hanzo AI in Python with the official OpenAI SDK (fully compatible), the Anthropic SDK, or via HTTP with httpx/requests. Zero lock-in, standard interfaces. [Integrations](https://hanzo.ai/integrations)/Python 🐍Languages # Use Hanzo AI with Python Use Hanzo AI in Python with the official OpenAI SDK (fully compatible), the Anthropic SDK, or via HTTP with httpx/requests. Zero lock-in, standard interfaces. 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 [Python Software Foundation](https://python.org) License: PSF License · [View source on GitHub →](https://github.com/python/cpython) Hanzo AI is OpenAI-compatible, so existing Python code works with zero refactoring. We deeply appreciate the Python Software Foundation team for building and maintaining this open-source project. ## OpenAI SDK (recommended) python ``` pip install openai from openai import OpenAI client = OpenAI( base_url="https://api.hanzo.ai/v1", api_key="your-hanzo-api-key", ) response = client.chat.completions.create( model="zen4-pro", messages=[{"role": "user", "content": "Hello!"}], ) print(response.choices[0].message.content) ``` ## httpx (raw HTTP) python ``` import httpx, json response = httpx.post( "https://api.hanzo.ai/v1/chat/completions", headers={"Authorization": "Bearer your-hanzo-api-key"}, json={ "model": "zen4-pro", "messages": [{"role": "user", "content": "Hello!"}], }, ) print(response.json()["choices"][0]["message"]["content"]) ``` ## Async with asyncio python ``` import asyncio from openai import AsyncOpenAI client = AsyncOpenAI( base_url="https://api.hanzo.ai/v1", api_key="your-hanzo-api-key", ) async def main(): response = await client.chat.completions.create( model="zen4-pro", messages=[{"role": "user", "content": "Hello async!"}], ) print(response.choices[0].message.content) asyncio.run(main()) ``` ## Environment setup python ``` # .env HANZO_API_KEY=your-hanzo-api-key # Load in code from dotenv import load_dotenv import os load_dotenv() from openai import OpenAI client = OpenAI( base_url="https://api.hanzo.ai/v1", api_key=os.environ["HANZO_API_KEY"], ) ``` ## 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)[TypeScript](https://hanzo.ai/integrations/typescript)[Go](https://hanzo.ai/integrations/go)[Rust](https://hanzo.ai/integrations/rust)