Guide
OpenAI-compatible API: switch with one base URL
An OpenAI-compatible API accepts the same request and response shapes as OpenAI's API for the endpoints it implements, so the SDKs and tools you already use keep working after you change the base URL and API key.
Point your existing OpenAI client at zcloud and start saving.
Updated
Quickstart: three steps
1. Create an API key
Sign in with Google and open the API keys page in your workspace. Keys start with zr_ and are shown once, so store yours in a secret manager or an environment variable.
Open API keys →2. Point your client at zcloud
Official OpenAI SDKs read their base URL and key from environment variables, so most projects switch without code changes. Anthropic SDKs use the root URL without /v1.
# Official OpenAI SDKs (Python and Node) read these variables
OPENAI_BASE_URL=https://api.zrouter.dev/v1
OPENAI_API_KEY=zr_your_key_here
# Official Anthropic SDKs use the root URL (no /v1)
ANTHROPIC_BASE_URL=https://api.zrouter.dev
ANTHROPIC_API_KEY=zr_your_key_here3. Send a request
Use any model public name from the live catalog. This example uses kimi-k3.1-pro; swap it for the model you need.
curl https://api.zrouter.dev/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"kimi-k3.1-pro","messages":[{"role":"user","content":"Hello"}]}'Supported endpoints
| Endpoint | Protocol | Use it for |
|---|---|---|
| POST /v1/chat/completions | OpenAI | Chat completions, streaming, tool calls |
| POST /v1/responses | OpenAI | Responses API with native response.* stream events |
| POST /v1/messages | Anthropic | Anthropic messages, system prompts, tool use |
| GET /v1/models | OpenAI | List the model names your key can call (requires the key) |
https://api.zrouter.dev
What changes when you migrate
- Base URL and API key — the only required change for OpenAI SDK code.
- Model names — use zcloud public names from the model list; unknown names return model_not_found.
- Billing — requests draw from a model's Token Plan first, then your PAYG balance; an empty balance returns 402 insufficient_balance.
- Errors — OpenAI-compatible endpoints return the OpenAI error envelope, the messages endpoint returns the Anthropic one.
Next: full quickstart · SDK configuration · error codes · per-model pricing
What does OpenAI-compatible mean?
It means a server implements OpenAI's wire protocol for a set of endpoints — on zcloud: chat/completions and responses, with streaming, tool calling and OpenAI-style error envelopes. Clients built for those endpoints talk to it as if it were OpenAI; endpoints it does not implement (for example audio) are not available.
Why OpenAI compatibility matters
OpenAI's protocol is the de facto standard. An entire ecosystem — LangChain, the Vercel AI SDK, agents, plugins — is built on it. An OpenAI-compatible API lets you keep that ecosystem while switching to cheaper or different models underneath.
How zcloud delivers it
zcloud runs an OpenAI-compatible gateway in front of its whole catalog (GPT, Claude, Gemini and more) and also adds an Anthropic-compatible messages endpoint. One API key, both protocols, all at up to ~95% below official pricing.
Frequently asked questions
Can I use my existing OpenAI SDK?
Yes. Set the base URL to zcloud's gateway and your existing OpenAI SDK code keeps working.
Which endpoints are supported?
POST /v1/chat/completions and POST /v1/responses for OpenAI compatibility, POST /v1/messages for Anthropic compatibility, and GET /v1/models to list the model names your key can call.
Do I need a separate key for each model?
No. One zcloud API key works across every model and both protocols.
Is there a free tier?
No. Access is prepaid: Token Plans start at $1 for one model, and a PAYG balance is charged only for the tokens you use.