API reference
ezrouter API reference
The ezrouter API exposes two parallel surfaces against the same set of upstream LLM providers. Choose whichever fits your existing client:
| Surface | Base URL | Auth header | Drop-in for |
|---|---|---|---|
| OpenAI-compatible | https://www.ezrouter.dev/v1 | Authorization: Bearer ${API_KEY} | OpenAI Python / Node SDK with base_url override |
| Anthropic-compatible | https://www.ezrouter.dev/anthropic/v1 | x-api-key: ${API_KEY} | Anthropic SDK / Claude Code with base_url override |
Both surfaces accept the same API key and route to the same model catalog. Some models support both surfaces simultaneously — see GET /v1/models for each model's supported_endpoint_types field. {#anthropic-messages}
Authentication
Get an API key from the ezrouter dashboard at https://www.ezrouter.dev/dashboard/#api-keys/. Keys are tied to your account and may be revoked individually.
The OpenAI surface uses standard bearer auth; the Anthropic surface uses Anthropic's x-api-key header convention. Otherwise the two surfaces are independent — a request to one does not consume rate budget on the other any differently.
Endpoints
OpenAI-compatible surface
| Method | Path | Description |
|---|---|---|
POST | /v1/chat/completions | Create chat completion — the primary inference endpoint |
POST | /v1/completions | Legacy completion — exposure status under verification |
GET | /v1/models | List available models — gateway-global catalog |
GET | /v1/user/balance | Get user balance — endpoint specifics under verification |
Anthropic-compatible surface
| Method | Path | Description |
|---|---|---|
POST | /anthropic/v1/messages | Anthropic Messages API — preserves upstream Anthropic spec for claude models |
The Anthropic surface is documented inline here as a routing pointer only; for the request / response schema, refer to Anthropic's official Messages API documentation and substitute the base URL above. ezrouter does not currently fork or extend the Anthropic spec.
Notable behaviors
Before integrating, read these gateway-wide behaviors that differ from typical OpenAI or Anthropic deployments. Full per-endpoint detail lives on each endpoint page.
- The OpenAI surface always streams. Every response from
/v1/chat/completions is text/event-stream, regardless of whether stream: true was sent. See POST /v1/chat/completions → Differences from OpenAI.
- Capacity is governed by fair use, not by published numbers. See
- Error envelope uses ezrouter-specific shapes. See
- Tool-call extraction is reliable on
claude-opus-4-7via the OpenAI surface; for other models, prefer the Anthropic surface for agent applications. See
POST /v1/chat/completions → Tool calls.
Contact
| Purpose | Contact |
|---|---|
| Support | [email protected] |
| Terms of Service | Terms of Service |
| Privacy Policy | Privacy Policy |