LogoZenn.CEO/
DashboardChatAPI KeysDocs
Documentation

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.

Table of Contents
1. Getting Started2. Base URLs3. Claude Code4. OpenCode5. Codex CLI6. Gemini CLI7. Cursor IDE8. Direct API (cURL)9. Image Generation10. Models & Pricing11. Authentication12. Plans13. Rate Limits & Errors14. Coming Soon

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.

1. Get an API Key

Pick a plan on /pricing, then create a key at /manage-api-keys.

2. Set Base URL

Point your tool at https://zenn.engineering/api/v1.

3. Build

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.

SurfaceBase URLUse With
Anthropic-compatiblehttps://zenn.engineering/api/v1Claude Code, Anthropic SDK, OpenCode (anthropic provider)
OpenAI-compatible (Codex)https://zenn.engineering/api/v1/codexCodex CLI, OpenAI SDK, Cursor
Gemini-compatiblehttps://zenn.engineering/api/v1/geminiGemini CLI, Google AI SDK
Image generationhttps://zenn.engineering/api/v1/images/generationsgpt-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):

shell
export ANTHROPIC_BASE_URL=https://zenn.engineering/api/v1
export ANTHROPIC_API_KEY=ck_YOUR_API_KEY

Step 2 — Restart & run

terminal
# 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

terminal
npm i -g opencode-ai

Step 2 — Create config

Edit ~/.config/opencode/opencode.json:

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

terminal
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

shell
export OPENAI_BASE_URL=https://zenn.engineering/api/v1/codex
export OPENAI_API_KEY=ck_YOUR_API_KEY

Run

terminal
# 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

shell
export GEMINI_BASE_URL=https://zenn.engineering/api/v1/gemini
export GEMINI_API_KEY=ck_YOUR_API_KEY

Run

terminal
gemini --model gemini-3.1-pro-preview
gemini --model gemini-3-flash-preview

7. Cursor IDE

In Cursor → Settings → Models → "Custom OpenAI Model":

FieldValue
Override OpenAI Base URLhttps://zenn.engineering/api/v1/codex
OpenAI API Keyck_YOUR_API_KEY
Add custom modelsgpt-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 · Claude
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 · GPT-5.5
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 · Gemini
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 · gpt-image-2
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 IDInput / MTokOutput / MTokCache ReadStatus
claude-opus-4-7$15.00$75.00$1.50Live
claude-opus-4-6$15.00$75.00$1.50Live
claude-sonnet-4-6$3.00$15.00$0.30Live
claude-haiku-4-5$1.00$5.00$0.10Live

OpenAI / GPT

Model IDInput / MTokOutput / MTokCache ReadStatus
gpt-5.5$5.00$30.00$0.50Live
gpt-5.5-instant$5.00$30.00$0.50Live
gpt-5.5-pro$30.00$180.00$30.00Live
gpt-5.4$5.00$22.50$0.50Live
gpt-5.3-codex$1.75$14.00$0.17Live
gpt-5.2$1.75$14.00$0.17Live

Gemini (Google)

Model IDInput / MTokOutput / MTokCache ReadStatus
gemini-3.1-pro-preview$4.00$18.00$0.40Live
gemini-3-pro-preview$4.00$18.00$0.40Live
gemini-3-flash-preview$0.50$3.00$0.05Live

DeepSeek / Moonshot / Zhipu

Model IDInput / MTokOutput / MTokCache ReadStatus
deepseek-v4-pro$1.74$3.48$0.01Live
deepseek-v4-flash$0.14$0.28$0.0028Live
kimi-k2.6$0.95$4.00$0.16Live
glm-5.1$1.40$4.40$0.26Live

Image (live)

Model IDCredits / imagePrice / imageStatus
gpt-image-260000$0.06Live

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.

HeaderFormatUsed By
x-api-keyck_...Claude Code, Anthropic SDK
AuthorizationBearer ck_...OpenCode, Codex CLI, OpenAI SDK, cURL
anthropic-api-keyck_...Alternate Anthropic header
x-goog-api-keyck_...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.

Pro
$10 · 10,000,000 credits

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
Max
$100 · 400,000,000 credits

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
Enterprise
$1,000 · 6,000,000,000 credits

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

EndpointRequests / hour
/v1/messages, /v1/chat/completions, /v1/gemini1,000
/v1/images/generations500
/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

StatusMeaning
401Missing / invalid API key
402Insufficient credits — top up at /checkout
403Tier doesn't unlock the requested model (e.g. Opus 4.7)
429Per-user rate limit hit
503Model is listed but Coming Soon
504Image generation timed out (retry)

14. Coming Soon

Listed publicly but the API rejects them until margin under the credit-multiplier model stabilizes:

Image (more)

Nano Banana family, Gemini 3 Pro Image, Seedream, GPT-4o Image, Imagen.

Video

Veo 3.1, Kling 3.0, Seedance 2.0, HappyHorse 1.0, MiniMax Hailuo, Vidu Q3, WAN 2.6.

Audio

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.

See PlansManage API Keys
Logo
Zenn.CEOFrontier Intelligence for Everybody
XX (Twitter)GitHubLinkedInEmail
Product
  • Chat
  • API
  • Pricing
Company
  • About
  • Contact
  • Cookie Policy
  • Privacy Policy
  • Terms of Service
  • Refund Policy
All systems normal
•Built from California with Love ❤️
© Copyright 2026. All Rights Reserved.