API Reference & Setup
One ck_ API key works across Claude Code, OpenCode, Codex CLI, Gemini CLI, Cursor, and direct HTTP. Official provider list pricing on a single bill — pay as you go, no subscription required.
1. Getting Started
Zenn.Engineering is a drop-in API gateway for Anthropic, OpenAI, and Google AI models, plus image generation. You use a single ck_-prefixed key everywhere — no code changes, just point your tool at our base URL.
Pick a plan on /pricing, then create a key at /manage-api-keys.
Point your tool at https://zenn.engineering/api/v1.
Works with Claude Code, OpenCode, Codex CLI, Gemini CLI, Cursor, and any OpenAI/Anthropic-compatible client.
2. Base URLs
One key, three protocol-compatible base URLs (Anthropic / OpenAI / Gemini), plus an image-generation endpoint.
| Surface | Base URL | Use With |
|---|---|---|
| Anthropic-compatible | https://zenn.engineering/api/v1 | Claude Code, Anthropic SDK, OpenCode (anthropic provider) |
| OpenAI-compatible (Codex) | https://zenn.engineering/api/v1/codex | Codex CLI, OpenAI SDK, Cursor |
| Gemini-compatible | https://zenn.engineering/api/v1/gemini | Gemini CLI, Google AI SDK |
| Image generation | https://zenn.engineering/api/v1/images/generations | gpt-image-2 (OpenAI-compatible payload) |
3. Claude Code
Anthropic's official CLI for Claude. Set two env vars and it works as a drop-in replacement.
Step 1 — Set environment
Add to your shell profile (~/.zshrc or ~/.bashrc):
export ANTHROPIC_BASE_URL=https://zenn.engineering/api/v1 export ANTHROPIC_API_KEY=ck_YOUR_API_KEY
Step 2 — Restart & run
# Default model (Sonnet 4.6) claude # Pick a different model claude --model claude-opus-4-7 claude --model claude-haiku-4-5
How it works
Claude Code sends the API key via the x-api-key header (Anthropic SDK native) and appends /messages to the base URL. Both anthropic-version and anthropic-beta headers are forwarded upstream. Streaming is supported via SSE.
4. OpenCode
Multi-provider AI coding agent. One JSON config gives you Claude, GPT-5, and Gemini through a single key.
Step 1 — Install
npm i -g opencode-ai
Step 2 — Create config
Edit ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic": {
"options": {
"baseURL": "https://zenn.engineering/api/v1",
"apiKey": "ck_YOUR_API_KEY"
},
"models": {
"claude-opus-4-7": { "name": "Claude Opus 4.7" },
"claude-sonnet-4-6": { "name": "Claude Sonnet 4.6" },
"claude-haiku-4-5": { "name": "Claude Haiku 4.5" }
}
},
"zenn-codex": {
"npm": "@ai-sdk/openai-compatible",
"name": "Zenn Codex",
"options": {
"baseURL": "https://zenn.engineering/api/v1/codex",
"apiKey": "ck_YOUR_API_KEY"
},
"models": {
"gpt-5.5": { "name": "GPT-5.5" },
"gpt-5.5-pro": { "name": "GPT-5.5 Pro" },
"gpt-5.5-instant": { "name": "GPT-5.5 Instant" },
"gpt-5.4": { "name": "GPT-5.4" },
"gpt-5.3-codex": { "name": "GPT-5.3 Codex" }
}
},
"zenn-gemini": {
"npm": "@ai-sdk/openai-compatible",
"name": "Zenn Gemini",
"options": {
"baseURL": "https://zenn.engineering/api/v1/gemini",
"apiKey": "ck_YOUR_API_KEY"
},
"models": {
"gemini-3.1-pro-preview": { "name": "Gemini 3.1 Pro" },
"gemini-3-pro-preview": { "name": "Gemini 3 Pro" },
"gemini-3-flash-preview": { "name": "Gemini 3 Flash" }
}
},
"zenn-chinese": {
"npm": "@ai-sdk/openai-compatible",
"name": "Zenn Chinese (DeepSeek / Moonshot / Zhipu)",
"options": {
"baseURL": "https://zenn.engineering/api/v1/codex",
"apiKey": "ck_YOUR_API_KEY"
},
"models": {
"deepseek-v4-pro": { "name": "DeepSeek V4 Pro" },
"deepseek-v4-flash": { "name": "DeepSeek V4 Flash" },
"kimi-k2.6": { "name": "Kimi K2.6" },
"glm-5.1": { "name": "GLM-5.1" }
}
}
}
}Step 3 — Run
opencode
5. Codex CLI
OpenAI's official CLI for the GPT-5 / Codex family. Set two env vars and point at our Codex base URL.
Set environment
export OPENAI_BASE_URL=https://zenn.engineering/api/v1/codex export OPENAI_API_KEY=ck_YOUR_API_KEY
Run
# Default codex # Pick a model codex --model gpt-5.5 codex --model gpt-5.5-pro codex --model gpt-5.5-instant codex --model gpt-5.3-codex # Chinese coding models (via OpenAI-compatible /v1/codex) codex --model deepseek-v4-pro codex --model kimi-k2.6 codex --model glm-5.1
Codex CLI uses Authorization: Bearer and the OpenAI /chat/completions + /responses shape — both are supported.
6. Gemini CLI
Google's Gemini CLI sends the key via x-goog-api-key. The proxy accepts that header transparently.
Set environment
export GEMINI_BASE_URL=https://zenn.engineering/api/v1/gemini export GEMINI_API_KEY=ck_YOUR_API_KEY
Run
gemini --model gemini-3.1-pro-preview gemini --model gemini-3-flash-preview
7. Cursor IDE
In Cursor → Settings → Models → "Custom OpenAI Model":
| Field | Value |
|---|---|
| Override OpenAI Base URL | https://zenn.engineering/api/v1/codex |
| OpenAI API Key | ck_YOUR_API_KEY |
| Add custom models | gpt-5.5, gpt-5.5-pro, gpt-5.5-instant, gpt-5.4, gpt-5.3-codex, deepseek-v4-pro, kimi-k2.6, glm-5.1 |
Click Verify after saving — Cursor will hit /models on the base URL to confirm the key works.
8. Direct API (cURL)
Three protocol shapes, one key. Pick whichever your client already speaks.
Anthropic-compatible — /v1/messages
curl -X POST https://zenn.engineering/api/v1/messages \
-H "x-api-key: ck_YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello, Claude"}]
}'OpenAI-compatible — /v1/codex/chat/completions
curl -X POST https://zenn.engineering/api/v1/codex/chat/completions \
-H "Authorization: Bearer ck_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"messages": [{"role": "user", "content": "Hello, GPT-5.5"}],
"stream": true
}'Gemini — /v1/gemini/chat/completions
curl -X POST https://zenn.engineering/api/v1/gemini/chat/completions \
-H "Authorization: Bearer ck_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-pro-preview",
"messages": [{"role": "user", "content": "Hello, Gemini"}]
}'9. Image Generation
gpt-image-2 is the only image model currently routable through the API. Resolution tiers (1K / 2K / 4K) are charged at one flat price — see Models for details. Other image, video, and audio models are listed as Coming Soon.
Endpoint
POST https://zenn.engineering/api/v1/images/generations GET https://zenn.engineering/api/v1/images/generations (list models)
Generate an image
curl -X POST https://zenn.engineering/api/v1/images/generations \
-H "Authorization: Bearer ck_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A cinematic photo of a small red apple on a marble countertop",
"n": 1
}'Async behavior
DocsPage.imageGen.asyncBody
In the browser chat
Open /chat, pick "GPT Image 2 — Image Generation" from the model picker, send a prompt, and the image renders inline. The server polls upstream for you and bills 6 credits ($0.06) per image.
10. Models & Pricing
Credit-based billing (1,000,000 credits = $1.00). LLM prices are the official provider list price per million tokens; image is per generation. Models tagged Coming Soon are listed but the API rejects them until they're enabled. Every model burns at official list price — value comes from the credit multiplier at top-up time (Pro 1×, Max 4×, Enterprise 6×). See section 12 for plan details.
Claude (Anthropic)
| Model ID | Input / MTok | Output / MTok | Cache Read | Status |
|---|---|---|---|---|
| claude-opus-4-7 | $15.00 | $75.00 | $1.50 | Live |
| claude-opus-4-6 | $15.00 | $75.00 | $1.50 | Live |
| claude-sonnet-4-6 | $3.00 | $15.00 | $0.30 | Live |
| claude-haiku-4-5 | $1.00 | $5.00 | $0.10 | Live |
OpenAI / GPT
| Model ID | Input / MTok | Output / MTok | Cache Read | Status |
|---|---|---|---|---|
| gpt-5.5 | $5.00 | $30.00 | $0.50 | Live |
| gpt-5.5-instant | $5.00 | $30.00 | $0.50 | Live |
| gpt-5.5-pro | $30.00 | $180.00 | $30.00 | Live |
| gpt-5.4 | $5.00 | $22.50 | $0.50 | Live |
| gpt-5.3-codex | $1.75 | $14.00 | $0.17 | Live |
| gpt-5.2 | $1.75 | $14.00 | $0.17 | Live |
Gemini (Google)
| Model ID | Input / MTok | Output / MTok | Cache Read | Status |
|---|---|---|---|---|
| gemini-3.1-pro-preview | $4.00 | $18.00 | $0.40 | Live |
| gemini-3-pro-preview | $4.00 | $18.00 | $0.40 | Live |
| gemini-3-flash-preview | $0.50 | $3.00 | $0.05 | Live |
DeepSeek / Moonshot / Zhipu
| Model ID | Input / MTok | Output / MTok | Cache Read | Status |
|---|---|---|---|---|
| deepseek-v4-pro | $1.74 | $3.48 | $0.01 | Live |
| deepseek-v4-flash | $0.14 | $0.28 | $0.0028 | Live |
| kimi-k2.6 | $0.95 | $4.00 | $0.16 | Live |
| glm-5.1 | $1.40 | $4.40 | $0.26 | Live |
Image (live)
| Model ID | Credits / image | Price / image | Status |
|---|---|---|---|
| gpt-image-2 | 60000 | $0.06 | Live |
All image, video, and audio models burn at official list price. Other image models (Nano Banana family, Gemini 3 Pro Image, Seedream) are listed in the catalog but currently Coming Soon — the API rejects them until they're enabled. See /models for the full catalog.
11. Authentication
All API keys use the ck_ prefix. The proxy accepts every standard SDK header format so clients work without modification.
| Header | Format | Used By |
|---|---|---|
| x-api-key | ck_... | Claude Code, Anthropic SDK |
| Authorization | Bearer ck_... | OpenCode, Codex CLI, OpenAI SDK, cURL |
| anthropic-api-key | ck_... | Alternate Anthropic header |
| x-goog-api-key | ck_... | Gemini CLI |
Forwarded headers
anthropic-version (defaults to 2023-06-01) and anthropic-beta pass through. SSE streaming is fully supported.
12. Plans
One-time top-up — no subscription. Each top-up locks in a credit multiplier (Pro 1×, Max 4×, Enterprise 6×) — your credits keep that multiplier value until spent. Subsequent top-ups can be at any tier.
Standard pricing. Pay-as-you-go.
- · Every frontier LLM at official list price
- · OpenAI / Anthropic / Gemini compatible API
- · Per-key spend limits, real-time analytics
4× credits — $100 buys $400 of usage at list price.
- · Everything in Pro
- · 4× credits per dollar at top-up time
- · Same list price on every model
- · Priority queue + faster routing
6× credits — $1,000 buys $6,000 of usage + priority Anthropic Max channel.
- · Everything in Max
- · 6× credits per dollar at top-up time
- · Same list price on every model
- · Priority Anthropic Max channel
- · Dedicated support, audit-friendly invoicing
One pricing rule, every model
- · Every LLM, image, video, and audio model burns at the official list price shown on /models.
- · The Max ($100 → 4×) and Enterprise ($1,000 → 6×) value comes from extra credits granted at top-up time, not from per-model discount tiers.
- · No bucket eligibility, no per-model fine print — your credits work the same on Claude Opus, GPT-5.5, and Gemini Flash.
Multipliers apply per top-up. Existing Max credits keep their 4× value until you spend them — top up Pro afterward and that $10 grants 10M credits at 1×. See /pricing for the full breakdown.
13. Rate Limits & Errors
Per-user rate limits
| Endpoint | Requests / hour |
|---|---|
| /v1/messages, /v1/chat/completions, /v1/gemini | 1,000 |
| /v1/images/generations | 500 |
| /v1/responses, /v1/codex/* | 1,000 |
Rate-limit status is returned in response headers: x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-reset.
Error codes
| Status | Meaning |
|---|---|
| 401 | Missing / invalid API key |
| 402 | Insufficient credits — top up at /checkout |
| 403 | Tier doesn't unlock the requested model (e.g. Opus 4.7) |
| 429 | Per-user rate limit hit |
| 503 | Model is listed but Coming Soon |
| 504 | Image generation timed out (retry) |
14. Coming Soon
Listed publicly but the API rejects them until margin under the credit-multiplier model stabilizes:
Nano Banana family, Gemini 3 Pro Image, Seedream, GPT-4o Image, Imagen.
Veo 3.1, Kling 3.0, Seedance 2.0, HappyHorse 1.0, MiniMax Hailuo, Vidu Q3, WAN 2.6.
Fish Audio TTS, Voice Clone, ASR.
See the full listing on /models. Coming-soon entries return HTTP 503 from the API; calling them today is a no-op that doesn't bill credits.
Ready to start?
One key works across Claude Code, OpenCode, Codex CLI, Gemini CLI, and Cursor. Top up credits and create your API key.
