OpenAI-compatible API
Base URL, authentication, endpoint mapping and SDK setup for tools and code that speak OpenAI's API format.
When to use this page
Your code or tool speaks only OpenAI's API format (the openai SDKs, LangChain's OpenAI client, editors that take an OpenAI base URL). This page gives the base URL, the endpoints that exist and how to point the SDKs at them. Chat Completions covers the request and response in detail.
Base URL and key
| Setting | Value |
|---|---|
| Base URL | https://api.router.ezat.io/openai/v1 |
| API key | Your EZAT key (ezat_sk_…), sent as Authorization: Bearer <key> |
| Model | An id from Models, for example anthropic/claude-sonnet-5-5 |
The base URL already ends in /v1. Clients add /chat/completions and /models to it. https://api.router.ezat.io/v1 is the Anthropic-format API and has no /chat/completions.
The OpenAI-compatible API uses the same keys, models, balance, limits and routing as the Anthropic-format API. A conversation costs the same through either one, and both show up together on the dashboard's Usage page.
Endpoints
| OpenAI path | EZAT URL | Status |
|---|---|---|
POST /v1/chat/completions | https://api.router.ezat.io/openai/v1/chat/completions | Supported, streaming and not |
GET /v1/models | https://api.router.ezat.io/openai/v1/models | Supported |
GET /v1/models/{model} | https://api.router.ezat.io/openai/v1/models/{model} | Supported. Ids with a slash work as they are, and aliases resolve. |
POST /v1/responses (Responses API) | Not available | |
POST /v1/embeddings | Not available | |
/v1/images/… (image generation) | Not available | |
/v1/audio/… (speech, transcription) | Not available | |
/v1/files, /v1/batches | Not available | |
POST /v1/completions (legacy completions) | Not available | |
POST /v1/moderations | Not available |
A path that isn't available returns 404 with {"statusCode": 404, "message": "Cannot POST /openai/v1/responses"}. That body isn't OpenAI's error format, so SDKs show it as a plain not-found error.
Tools that only call the Responses API (for example recent versions of OpenAI's Codex CLI) don't work yet. See OpenAI-format tools.
Set up the SDKs
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.router.ezat.io/openai/v1",
api_key=os.environ["EZAT_API_KEY"],
)
completion = client.chat.completions.create(
model="anthropic/claude-sonnet-5-5",
max_tokens=64,
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(completion.choices[0].message.content)Install the SDK with pip install openai or npm install openai.
Environment variables
The openai SDKs for Python and Node.js read OPENAI_BASE_URL and OPENAI_API_KEY when you don't pass base_url / baseURL and api_key / apiKey. Many tools built on them read the same two variables:
export OPENAI_BASE_URL="https://api.router.ezat.io/openai/v1"
export OPENAI_API_KEY="$EZAT_API_KEY"These variables also redirect every other program in that shell that uses them. Set them per project or per command if you also call OpenAI itself.
Model ids
Use the same ids as on the Anthropic-format API: canonical author/model ids, or their aliases. The Models page lists them, and so does the API:
curl --fail-with-body https://api.router.ezat.io/openai/v1/models \
-H "Authorization: Bearer $EZAT_API_KEY"{
"object": "list",
"data": [
{ "id": "anthropic/claude-sonnet-5-5", "object": "model", "created": 1790812800, "owned_by": "anthropic" }
]
}The list has the models your key can use. The response's model field echoes the name you sent. An unknown model returns 404 with code model_not_found.
Errors
Errors use OpenAI's envelope, {"error": {"message", "type", "param", "code"}}, so the SDKs raise their usual exceptions. The statuses are those of the Anthropic-format API except one: an overloaded model is 503, not 529. The types and codes are OpenAI's, for example insufficient_quota for an empty balance (402) and model_not_found for an unknown model (404). The full mapping is in Chat Completions.
For AI agents
- Base URL
https://api.router.ezat.io/openai/v1, exactly. Don't usehttps://api.router.ezat.io/v1for OpenAI-format clients. - API key: the EZAT key from
EZAT_API_KEY, asAuthorization: Bearer. With the SDKs, pass it asapi_key/apiKey, or setOPENAI_API_KEY. - Model: an id from
GET https://api.router.ezat.io/openai/v1/models. - Only Chat Completions and the models endpoints exist. Don't configure a tool that requires the Responses API, embeddings, image generation or audio.