# Use Hanzo AI with OpenAI Python SDK โ€” Hanzo AI > Use the official OpenAI Python SDK with Hanzo AI by pointing it to our OpenAI-compatible API endpoint. Access 500+ models with your existing OpenAI code โ€” no refactor needed. [Integrations](https://hanzo.ai/integrations)/OpenAI Python SDK ๐ŸAI SDKs # Use Hanzo AI with OpenAI Python SDK Use the official OpenAI Python SDK with Hanzo AI by pointing it to our OpenAI-compatible API endpoint. Access 500+ models with your existing OpenAI code โ€” no refactor needed. 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 [OpenAI](https://openai.com) License: MIT ยท [View source on GitHub โ†’](https://github.com/openai/openai-python) Hanzo AI is OpenAI-compatible, so existing OpenAI Python SDK code works with zero refactoring. We deeply appreciate the OpenAI team for building and maintaining this open-source project. ## Install & configure python ``` pip install openai from openai import OpenAI client = OpenAI( api_key="your-hanzo-api-key", base_url="https://api.hanzo.ai/v1", ) response = client.chat.completions.create( model="zen4-pro", messages=[{"role": "user", "content": "Hello!"}], ) print(response.choices[0].message.content) ``` ## Streaming python ``` stream = client.chat.completions.create( model="openai/gpt-4.1", messages=[{"role": "user", "content": "Write a haiku"}], stream=True, ) for chunk in stream: print(chunk.choices[0].delta.content or "", end="") ``` ## Vision model python ``` response = client.chat.completions.create( model="google/gemini-2.0-flash", messages=[{ "role": "user", "content": [ {"type": "text", "text": "What is in this image?"}, {"type": "image_url", "image_url": {"url": "https://example.com/img.png"}}, ], }], ) ``` ## Environment variable bash ``` export HANZO_API_KEY="your-hanzo-api-key" export OPENAI_API_KEY="$HANZO_API_KEY" export OPENAI_BASE_URL="https://api.hanzo.ai/v1" ``` ## 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 [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)[Rust](https://hanzo.ai/integrations/rust)