🐳
Infrastructure

Use Hanzo AI with Docker

Deploy Hanzo AI-powered services in Docker containers. Use the Hanzo API from any containerized application with proper environment configuration.

Base URL: https://api.hanzo.ai/v1

API Key: Get yours at hanzo.ai/signup · Fully OpenAI-compatible · 390+ models available

🐳

Created by Docker / Moby Project

License: Apache-2.0 · View source on GitHub →

Hanzo AI is OpenAI-compatible, so existing Docker code works with zero refactoring. We deeply appreciate the Docker / Moby Project team for building and maintaining this open-source project.

Dockerfile

dockerfile
FROM python:3.12-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .

ENV HANZO_API_KEY=""
ENV OPENAI_API_BASE="https://api.hanzo.ai/v1"

CMD ["python", "main.py"]

compose.yml

yaml
services:
  app:
    build: .
    environment:
      - HANZO_API_KEY=${HANZO_API_KEY}
      - OPENAI_API_BASE=https://api.hanzo.ai/v1
    ports:
      - "8000:8000"
    restart: unless-stopped

Run with env

bash
# .env file
HANZO_API_KEY=your-hanzo-api-key

# Start
docker compose up -d

# Or direct run
docker run -e HANZO_API_KEY=your-key -p 8000:8000 my-ai-app

App code

python
import os
from openai import OpenAI

client = OpenAI(
    base_url=os.environ.get("OPENAI_API_BASE", "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.