Skip to content
Try Hanzo
Language: English (United States)

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.

Get API key — Free
Dockerfiledockerfile
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"]
2 of 8 lines point at Hanzo

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

API Key: Get yours at platform.hanzo.ai/api-keys · Fully OpenAI-compatible · 400+ models available

compose.yml

yaml

2 of 9 lines point at Hanzo
compose.ymlyaml
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

2 of 6 lines point at Hanzo
Run with envbash
# .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

2 of 6 lines point at Hanzo
App codepython
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"],
)

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.

Ready to get started?

Create a free account and get your API key. The Free plan includes free model requests and Kai decisions, no card.