Runnable examples for Kunavo — an OpenAI-compatible AI gateway to frontier text, image, video and music models. One base URL, one sk-kunavo- key, one pay-as-you-go balance:
- Chat: Claude, Gemini, GPT — via the unmodified OpenAI SDK
- Image: Nano Banana (incl. Pro), GPT-Image-2 — generate + edit
- Video: Google Veo 3 (text-to-video / image-to-video, native audio)
- Music: Suno V5 (full songs from a prompt)
Everything is priced below the providers' official list (chat models ~30% under; see live pricing and the LLM cost calculator). If your code can call the OpenAI API, it can call Kunavo by changing only the base_url.
from openai import OpenAI
client = OpenAI(
api_key=os.environ["KUNAVO_API_KEY"], # sk-kunavo-...
base_url="https://api.kunavo.com/v1", # the only line that changes
)
resp = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Hello"}],
)- Create a key at kunavo.com/app/keys (pay-as-you-go from a $5 top-up, balance never expires)
export KUNAVO_API_KEY=sk-kunavo-...- Run any example below
| File | What it shows |
|---|---|
python/chat.py |
Claude via the OpenAI SDK — the two-line switch |
python/multi_model.py |
Same code, three providers (Claude, Gemini, GPT) — model string as config |
python/image.py |
Text-to-image with Nano Banana (/v1/images/generations) |
python/image_edit.py |
Image-to-image editing (/v1/images/edits) |
python/video.py |
Veo 3 text-to-video with the async task lifecycle (/v1/videos) |
python/music.py |
Suno V5 song generation with job polling (/v1/audio/music/jobs) |
node/chat.mjs |
Node.js — OpenAI SDK against Claude |
node/image.mjs |
Node.js — Nano Banana image generation |
shell/curl.sh |
Raw curl for every endpoint |
Kunavo publishes a complete, self-contained machine-readable API reference at kunavo.com/llms.txt — model discovery (GET /v1/models), billing units and endpoint shapes, designed so an autonomous agent can integrate without reading docs pages.
One key and one bill instead of N provider accounts; routing and failover across providers; per-key spend caps. The pattern — and when you don't need it — is covered in What is an AI gateway? and the honest OpenRouter alternatives comparison.
MIT — use these snippets in anything.