API reference
The inference surface is OpenAI/OpenRouter-compatible. Route and response drift is a breaking change for every customer, so the contract below is normative.
Base URLs
Each region has its own gateway host — your traffic stays in the region of execution. The marketing site, console and control plane live outside the region and carry metadata only.
| Region | Base URL |
|---|---|
| --- | --- |
| EU | https://gateway.eu.securerouter.com/v1 |
| US | https://gateway.us.securerouter.com/v1 |
| CH | https://gateway.ch.securerouter.com/v1 |
Authentication
Inference requests authenticate with a bearer API key. Keys start with sk-sr- and are shown once at creation.
Authorization: Bearer sk-sr-...
Chat completions
POST {base}/chat/completions
{
"model": "anthropic/claude-sonnet",
"messages": [{ "role": "user", "content": "Hello" }],
"stream": false
}
The request body follows the OpenAI chat schema. Response fields and error envelopes match the OpenRouter contract (id, choices, usage, error).
Streaming
Set "stream": true to receive a server-sent events stream. Chunks follow the OpenAI SSE format, including the final usage chunk and keep-alive comments.
Region pinning
A request may pin the executing region explicitly:
{ "provider": { "region": "eu" } }
The guarantee engine validates the pin against the contract before routing. A pin outside the promised region set fails with no_compliant_provider.
Errors
Errors use the envelope { "error": { "code", "message" } }. Key codes:
| Code | Meaning |
|---|---|
| --- | --- |
invalid_api_key | Missing or malformed bearer token |
no_compliant_provider | No endpoint satisfies the region/ZDR constraints — fail-closed, never a silent downgrade |
rate_limit_exceeded | Per-key limit hit; check X-RateLimit-* headers |
insufficient_credits | The account balance cannot cover the request |
Metadata and usage
The usage object is always present and costs are computed from the price map, even when the upstream reports none. Every generation record stores the serving region, the ZDR posture and the provider — verifiable per request.
Playground
The console includes a chat playground wired to your key for quick experiments.