An OpenAI-compatible API: one endpoint and one key for GPT, Claude, Gemini, DeepSeek and other chat models, plus image and video generation. Every example below runs as-is.
Quick Start
Just swap in the Base URL and API Key, and your existing OpenAI SDK works out of the box.
https://nezhagate.com/v1
curl https://nezhagate.com/v1/chat/completions -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "gpt-5.5", "messages": [{"role": "user", "content": "Write a short product intro for an AI API"}], "stream": false}'
Full request parameters, examples and async usage for each model live in that model's own doc — open it from the Models & pricing table below.
More runnable examples (Python / Node / curl, including the async image and video flow): github.com/gaoorange/nezhagate-api-examples
Authentication
All API calls require a Bearer Token.
Authorization: Bearer YOUR_API_KEY Content-Type: application/json
Models & Pricing
Full request parameters, examples and async usage for each model live in that model's own doc — open it from the Models & pricing table below.
| Model | Capability | Endpoint | Price | |
|---|---|---|---|---|
| gpt-5.6-sol | Frontier reasoning, agentic coding, long-horizon tasks, structured output | /chat/completions | Input $1.2/1M · Output $6.0/1M | API Docs → |
| gpt-5.6-luna | High-speed chat, agentic coding, high-volume low-latency, structured output | /chat/completions | Input $0.07/1M · Output $0.4/1M | API Docs → |
| gpt-6-astra | Deep reasoning, agentic coding, very long context, image input, structured output | /chat/completions | Input $3.0/1M · Output $15.0/1M | API Docs → |
| gpt-6.1-sol | Agentic coding, complex coding, professional document and analysis work, reasoning, very long context, image input, structured output | /chat/completions | Input $0.6/1M · Output $3.0/1M | API Docs → |
| gpt-6-sol | Complex coding, agentic workflows, reasoning, very long context, image input, structured output | /chat/completions | Input $0.6/1M · Output $3.0/1M | API Docs → |
| gpt-6-luna | High-volume chat, low-latency agent steps, classification and extraction, very long context, structured output | /chat/completions | Input $0.07/1M · Output $0.4/1M | API Docs → |
| gpt-image-2 | Text-to-image, image-to-image, covers, posters, illustrations | /images/generations | 1K $0.005 · 2K $0.025 · 4K $0.04 | API Docs → |
| gpt-image-2.5-flare | Text-to-image, image-to-image, covers, posters, illustration, typography | /images/generations | 1K $0.005 · 2K $0.03 · 4K $0.05 | API Docs → |
| gpt-image-2.5-sunburst | Text-to-image, image-to-image, covers, posters, illustration, typography | /images/generations | 1K $0.005 · 2K $0.03 · 4K $0.05 | API Docs → |
| nano-banana-2 | Text-to-image, image-to-image, covers, posters, illustrations | /images/generations | 1K $0.015 · 2K $0.025 · 4K $0.04 | API Docs → |
| nano-banana-pro | Text-to-image, image-to-image, covers, posters, illustrations, infographics | /images/generations | 1K $0.02 · 2K $0.03 · 4K $0.05 | API Docs → |
| nano-banana-2.1 | Text-to-image, image editing, multi-image composition, posters and infographics, product shots, wide banners | /images/generations | 1K $0.015 · 2K $0.025 · 4K $0.04 | API Docs → |
| grok-imagine-image | Text-to-image, image editing, posters, product shots, social visuals, Chinese and English lettering | /images/generations | 1K $0.005 · 2K $0.005 · 4K $0.0 | API Docs → |
| grok-imagine-image-quality | Covers, posters, product shots, illustration, text-to-image and image editing | /images/generations | 1K $0.01 · 2K $0.01 · 4K $0.0 | API Docs → |
| claude-sonnet-4-6 | Chat, code, reasoning, long context | /chat/completions | Input $1.5/1M · Output $7.5/1M | API Docs → |
| claude-opus-5 | Deep reasoning, code, agents, long context, image understanding | /chat/completions | Input $4.0/1M · Output $20.0/1M | API Docs → |
| claude-fable-5 | Chinese writing, narrative creation, long-form generation, chat, code, image understanding | /chat/completions | Input $8.0/1M · Output $40.0/1M | API Docs → |
| claude-opus-5-5 | Complex reasoning, long-horizon agentic coding, code engineering, tool calling, image and PDF understanding | /chat/completions | Input $2.5/1M · Output $12.5/1M | API Docs → |
| claude-sonnet-5-5 | Everyday coding and agents, long context, tool calling, image and PDF understanding, production traffic at scale | /chat/completions | Input $1.5/1M · Output $7.5/1M | API Docs → |
| gemini-4-argon | Beta · reasoning · long context | /chat/completions | Input $0.5/1M · Output $3.0/1M | API Docs → |
| gemini-3.1-pro | Chat, reasoning, very long context, multimodal | /chat/completions | Input $0.5/1M · Output $3.0/1M | API Docs → |
| gemini-3.8-flash | Chat, reasoning, adaptive thinking, image input, very long context | /chat/completions | Input $0.6/1M · Output $3.6/1M | API Docs → |
| deepseek-v4.1-flash | Chat, reasoning, coding, tool calling, switchable thinking mode | /chat/completions | Input $0.075/1M · Output $0.3/1M | API Docs → |
| deepseek-v4-flash-0731 | Chat, reasoning, coding, tool calling, switchable thinking mode, pinned version | /chat/completions | Input $0.13/1M · Output $0.51/1M | API Docs → |
| glm-5.3 | Chat, coding, agentic workflows, reasoning, Chinese and English writing, tool calling | /chat/completions | Input $1.12/1M · Output $3.52/1M | API Docs → |
| qwen3.8-max | Reasoning, coding, agents and tool calling, Chinese and English writing, image understanding | /chat/completions | Input $1.4/1M · Output $4.2/1M | API Docs → |
| qwen3.8-flash | High-volume chat, classification and extraction, summarising and rewriting, image understanding and OCR, tool calling | /chat/completions | Input $0.1/1M · Output $0.33/1M | API Docs → |
| grok-4.7 | Complex reasoning, coding, long-document analysis, tool calling, structured output, image understanding | /chat/completions | Input $0.3/1M · Output $0.9/1M | API Docs → |
| veo-3.1 | Short clips, product motion, first/last-frame transitions, commercial footage | /videos/generations | $0.2 /clip+ | API Docs → |
| gemini-omni-flash | Multi-shot clips, storyboard narratives, first/last-frame transitions | /videos/generations | $0.05 /s | API Docs → |
| kling-4.0 | Character action, product shorts, motion taken from a reference video | /videos/generations | $0.09 /s | API Docs → |
| seedance-2.5-token | Text, image, video and audio references | /videos/generations | $7.50–13.75 /1M video tokens | API Docs → |
| seedance-2.5-token-draft | Text, image, video and audio references | /videos/generations | $7.50–12.50 /1M video tokens | API Docs → |
| seedance-2.5 | Long-take short films, multi-reference input, commercial footage | /videos/generations | $0.158 /s | API Docs → |
| seedance-2.0 | Short clips, commercial assets | /videos/generations | $0.15 /s | API Docs → |
| seedance-2.0-fast | Bulk assets, quick concept checks | /videos/generations | $0.075 /s | API Docs → |
| seedance-2.0-clip | Short clips featuring real people, product videos, batch production | /videos/generations | $1.0 /clip+ | API Docs → |
| seedance-2.5-30s | Long-take storytelling, long-form product videos | /videos/generations | $2.0 /clip+ | API Docs → |
| wan3.0-video | Long-take storytelling, multi-asset composition, video rewriting | /videos/generations | $0.065 /s | API Docs → |
| wan3.0-video-prime | Deadline footage, batch test shoots | /videos/generations | $0.112 /s | API Docs → |
| minimax-h3 | HD footage, short clips with sound | /videos/generations | $0.036 /s | API Docs → |
| grok-imagine-video-1.5 | Bulk short videos, quick concept checks | /videos/generations | $0.3 /clip+ | API Docs → |
Use it in an app (no code)
In any app that speaks the OpenAI API, fill in these three fields — no programming needed:
| API base URL | https://nezhagate.com/v1 |
| API key | the key you create in the console (Console → API Keys → Copy) |
| Model name | gpt-5.6-sol gpt-5.6-luna gpt-6-astra gpt-6.1-sol gpt-6-sol gpt-6-luna gpt-image-2 gpt-image-2.5-flare gpt-image-2.5-sunburst nano-banana-2 nano-banana-pro nano-banana-2.1 grok-imagine-image grok-imagine-image-quality claude-sonnet-4-6 claude-opus-5 claude-fable-5 claude-opus-5-5 claude-sonnet-5-5 gemini-4-argon gemini-3.1-pro gemini-3.8-flash deepseek-v4.1-flash deepseek-v4-flash-0731 glm-5.3 qwen3.8-max qwen3.8-flash grok-4.7 veo-3.1 gemini-omni-flash kling-4.0 seedance-2.5-token seedance-2.5-token-draft seedance-2.5 seedance-2.0 seedance-2.0-fast seedance-2.0-clip seedance-2.5-30s wan3.0-video wan3.0-video-prime minimax-h3 grok-imagine-video-1.5 |
Verified with ChatBox, Cherry Studio, NextChat, LobeChat, Immersive Translate, Open WebUI, etc.
Step-by-step client guides: SillyTavern · Cherry Studio · Cline
Native Anthropic API (Claude Code)
Beyond the OpenAI-compatible route, Claude models also expose the native Anthropic Messages API. Point Claude Code (or any Anthropic SDK) at the base URL below and use your gateway key as x-api-key — thinking, tool use and prompt caching are all preserved natively.
export ANTHROPIC_BASE_URL=https://nezhagate.com/anthropic export ANTHROPIC_API_KEY=YOUR_API_KEY # claude-sonnet-4-6 / claude-opus-5 / claude-fable-5 / claude-opus-5-5 / claude-sonnet-5-5
curl https://nezhagate.com/anthropic/v1/messages -H "x-api-key: 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"}]}'
Models: claude-opus-5-5, claude-sonnet-5-5, claude-opus-5, claude-sonnet-5, claude-fable-5, claude-sonnet-4-6. Billed exactly like /v1, per token.
Prompt-cache billing: cache hits (cache read) are billed at 1/10 (0.1×) of the input rate, cache writes at 1.25× (per-model rates on the pricing page). A hit needs a stable, long-enough prefix (Claude Opus ≥ 4096 tokens, Sonnet ≥ 2048) repeated within a short window — Claude Code with a large CLAUDE.md / system prompt over a real codebase hits every turn, cutting input cost to ~1/10. Short Playground chats are too small to cache.
Video Generation (async)
Text-to-video / image-to-video are async jobs: the call returns HTTP 202 + a job id immediately ({"id":"img_...","object":"video.generation.job","status":"queued"}); poll GET /v1/videos/jobs/{id} until status=succeeded, result in data[0].url (a re-hosted mp4). 1-12 min per clip. Two billing modes: Veo 3.1 is billed per clip; Seedance 2.x and MiniMax H3 are billed per second (rate x duration). Both hold exactly what they settle and refund in full on failure. Set the aspect ratio via size (16:9 landscape is the default); for image-to-video pass a first-frame reference in image.
curl https://nezhagate.com/v1/videos/generations -H 'Authorization: Bearer YOUR_API_KEY' -H 'Content-Type: application/json' -d '{"model": "veo-3.1", "prompt": "a cat surfing at sunset", "tier": "fast", "resolution": "1080p", "size": "16:9"}'curl https://nezhagate.com/v1/videos/jobs/img_3f9a...c2 -H 'Authorization: Bearer YOUR_API_KEY'
Video models: veo-3.1 gemini-omni-flash kling-4.0 seedance-2.5-token seedance-2.5-token-draft seedance-2.5 seedance-2.0 seedance-2.0-fast seedance-2.0-clip seedance-2.5-30s wan3.0-video wan3.0-video-prime minimax-h3 grok-imagine-video-1.5
Webhooks: get notified when a job finishes
Video and image generation are asynchronous: you submit, get a job ID, and the result arrives a little later. Instead of polling, let us push the result to your server when the job ends, and warn you when your balance runs low.
Rather not poll? Add callback_url when you submit and we push the result to your server when the job ends, or set a default endpoint in the console. Webhook docs →
Agent Skills: make a video in one sentence from your coding agent
Install the NezhaGate skill in Claude Code, Codex, Cursor or another skill-aware agent, then just ask: "turn this image into an 8-second video with seedance-2.5 and save it to ./out". The agent picks the model, uploads your files, waits for the render and saves the result. Available now: the Seedance 2.5 / 2.0 video skill.
npx skills add https://nezhagate.com
export NEZHAGATE_API_KEY=YOUR_API_KEY
github.com/gaoorange/nezhagate-skills · Demo clip (8 s, one request)
Integration Notes to Copy for AI
Send the whole block below to Codex / Claude Code / Cursor and it will know how to integrate. You can also use “Copy Page” in the top right to copy the entire doc.
Integrate NezhaGate through its OpenAI-compatible API.
Base URL: https://nezhagate.com/v1
API Key: read it from the environment variable NEZHAGATE_API_KEY.
Claude models can also use the native Anthropic protocol (for Claude Code / the Anthropic SDK): ANTHROPIC_BASE_URL=https://nezhagate.com/anthropic, headers x-api-key=API Key and anthropic-version: 2023-06-01, POST /anthropic/v1/messages (max_tokens is required), models claude-sonnet-4-6 / claude-opus-5 / claude-fable-5 / claude-opus-5-5 / claude-sonnet-5-5.
Chat models (/chat/completions): gpt-5.6-sol / gpt-5.6-luna / gpt-6-astra / gpt-6.1-sol / gpt-6-sol / gpt-6-luna / claude-sonnet-4-6 / claude-opus-5 / claude-fable-5 / claude-opus-5-5 / claude-sonnet-5-5 / gemini-4-argon / gemini-3.1-pro / gemini-3.8-flash / deepseek-v4.1-flash / deepseek-v4-flash-0731 / glm-5.3 / qwen3.8-max / qwen3.8-flash / grok-4.7
Image models (text-to-image /images/generations; image-to-image /images/edits or add an image parameter): gpt-image-2 / gpt-image-2.5-flare / gpt-image-2.5-sunburst / nano-banana-2 / nano-banana-pro / nano-banana-2.1 / grok-imagine-image / grok-imagine-image-quality
Video models (/videos/generations, async jobs; add reference images for image-to-video; how each model uses them is in its own doc): veo-3.1 / gemini-omni-flash / kling-4.0 / seedance-2.5-token / seedance-2.5-token-draft / seedance-2.5 / seedance-2.0 / seedance-2.0-fast / seedance-2.0-clip / seedance-2.5-30s / wan3.0-video / wan3.0-video-prime / minimax-h3 / grok-imagine-video-1.5
Auth: Authorization: Bearer YOUR_API_KEY
Requirements (chat): return choices[0].message.content; on 401 check the key, 402 means insufficient balance, 429/5xx can be retried.
Requirements (images, async): POST /images/generations or /images/edits returns HTTP 202 with a job id right away ({"id":"img_...","object":"image.generation.job","status":"queued"}); then poll GET /v1/images/jobs/{id} until status=succeeded and read data[0].url (an img.nezhagate.com link kept for 15 days; download it or copy it to your own storage). Do not read data right after submitting.
Requirements (video, async): POST /videos/generations returns HTTP 202 with a job id (object=video.generation.job); then poll GET /v1/videos/jobs/{id} until status=succeeded and read data[0].url (a re-hosted mp4 link kept for 15 days). Render time varies by model (from a minute or two to over an hour); failed jobs are refunded in full.
Check balance & usage
Use any API key to read the account remaining balance and spend — no dashboard login needed. Simplest: GET /v1/usage. Also OpenAI-compatible: /v1/dashboard/billing/credit_grants (balance = total_available).
curl https://nezhagate.com/v1/usage -H "Authorization: Bearer YOUR_API_KEY"
curl https://nezhagate.com/v1/dashboard/billing/credit_grants -H "Authorization: Bearer YOUR_API_KEY"
Error Codes
Errors from the /v1 endpoints share the shape below (the /anthropic endpoints use Anthropic's own format). code is a stable, machine-readable identifier: branch on code, never on the message text.
{
"error": {
"message": "human readable",
"type": "invalid_request_error | authentication_error | permission_error | insufficient_quota | rate_limit_error | server_error",
"code": "stable_snake_case",
"param": "field_name_or_null"
}
}
| HTTP | Meaning |
|---|---|
| 400 | A bad parameter or an unknown model (such as model_not_found); error.param names the field. |
| 401 | No key, or the key is invalid or disabled (missing_api_key, invalid_api_key). |
| 402 | Not enough balance, or the key has reached its budget (insufficient_quota). |
| 403 | The model is not on this key's model allowlist, or the request comes from outside the key's IP allowlist (permission_denied). |
| 404 | The path does not exist; or the job id is unknown, past its 3-day record, or was submitted by another account (job_not_found). |
| 429 | Over the per-minute limit set on this key or a free model's daily quota, or every line for the model is busy (rate_limit_exceeded). Wait the seconds in Retry-After when it is there, otherwise a few seconds, then retry. |
| 502 | The upstream failed or timed out and switching lines did not help; code says why, e.g. upstream_timeout or upstream_unavailable. Not billed; safe to retry. |
| 503 | The model is under maintenance (model_maintenance), or something failed on our side for a moment (service_unavailable). Not billed; retry later. |
max_tokens on thinking models — Gemini 3.x Flash (3-flash-preview / 3.6 / 3.7 / 3.8, every tier) spend the budget on hidden reasoning before writing the visible answer, so a small budget is consumed before the answer starts: measured, max_tokens=16 fails outright and 32 / 64 return a plausible-looking wrong value with finish_reason=length. The gateway raises the output budget for those models to at least 512 (you are billed only for tokens actually used), but send >=512 yourself; treat any finish_reason=length as possibly truncated and retry with a larger max_tokens.
Common questions on access, billing, models and safety. NezhaGate FAQ →