Introduction
Learn how zrouter unifies frontier AI models behind one API key with OpenAI-compatible and Anthropic-compatible interfaces.
What is zrouter?#
zrouter (operated under the zcloud platform) is a high-performance reseller API gateway for frontier artificial intelligence models. It routes inference requests across dozens of frontier models through upstream providers while providing unified billing, strict token accounting, and native protocol parity.
API surfaces and base URL#
All gateway requests are served from a single canonical base URL. You configure this base URL in your official SDK client (such as OpenAI Python/Node or Anthropic Python/Node) without modifying your core inference logic.
https://api.zrouter.devThe gateway exposes three primary inference endpoints:
- POST /v1/chat/completions — Drop-in OpenAI chat completions protocol with streaming (SSE) and function calling.
- POST /v1/responses — Modern OpenAI Responses API protocol with native event schemas.
- POST /v1/messages — Drop-in Anthropic messages protocol with full support for system prompts, image inputs, and tool use.
Token Plan & PAYG billing#
Every request is metered and debited through a two-tier funding model designed for maximum cost predictability. If an active Token Plan covers the requested model, tokens are deducted from that prepaid allocation first. Once a Token Plan is exhausted or if no plan exists for that model, the gateway automatically falls back to your PAYG (pay-as-you-go) cash balance.
| Funding Source | Priority | Pricing Model | Billing Unit |
|---|---|---|---|
| Token Plan | Primary (1st) | Prepaid tiers per model (see pricing page) | Tokens granted per model |
| PAYG Balance | Fallback (2nd) | Up to 95% off official list (varies per model) | Micro-USD per token settled |
Authentication overview#
Authenticate requests by sending your key either as a standard Authorization: Bearer zr_<public-id>_<secret> header or through the x-api-key: zr_<public-id>_<secret> header. Both headers are interchangeable and accept identical tokens.
curl -X POST "https://api.zrouter.dev/v1/chat/completions" \
-H "Authorization: Bearer zr_<public-id>_<secret>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4",
"messages": [{"role": "user", "content": "Hello world!"}]
}'Glossary#
| Term | Definition |
|---|---|
| API key | Your zr_<public-id>_<secret> credential used to authenticate inference requests. |
| Token Plan | A prepaid plan tied to one model that grants a fixed token allocation; consumed before PAYG. |
| PAYG | Pay-as-you-go cash balance billed at a reseller rate, used when no Token Plan covers the model. |
Model public_name | The human-readable model identifier you pass in the model field of a request. |
| Workspace | Your dashboard area for managing keys, balances, usage, and exports. |
| Inference endpoint | One of /v1/chat/completions, /v1/responses, or /v1/messages. |
How billing works#
Every request is metered by the tokens it consumes and debited in real time. You fund your account with a Token Plan for a specific model or by topping up your PAYG balance — or both.
At request time, the gateway first checks for an active Token Plan covering the requested model and debits it there. When a plan is exhausted, or when no plan exists for that model, the cost automatically falls back to your PAYG balance. If neither can cover the request, it is rejected with 402 insufficient_balance before any upstream work is performed.
Both funding sources accept QRIS and crypto (USDC/USDT on Solana). Tier definitions, precedence rules, and payment specifics live in Billing & Plans.
What you can build#
Because the gateway is a drop-in replacement for the OpenAI and Anthropic protocols, existing SDKs, frameworks, and agents run against zrouter with a one-line base-URL change. Teams use zrouter for:
- Customer-facing chat products that need frontier model quality at reseller pricing.
- Coding agents and tool-using assistants on the Responses and Messages protocols.
- Multi-model routing and A/B comparison behind a single API key.
Next steps#
To start sending production traffic, create an API key in your workspace, review the supported models in our live catalog, or jump into our quickstart guide for your preferred language.