Endpoints and dialects
The relay serves these routes. A machine-readable description is in the Relay API reference.
| Route | Dialect | Notes |
|---|---|---|
POST /v1/chat/completions |
OpenAI Chat Completions | The most widely supported client format. |
POST /v1/responses |
OpenAI Responses | background: true is refused. previous_response_id works only for responses your organisation created through the gateway. |
POST /v1/messages |
Anthropic Messages | max_tokens is required. |
POST /v1beta/models/{model}:generateContentPOST /v1beta/models/{model}:streamGenerateContent |
Gemini | Streaming is a JSON array unless you add ?alt=sse. |
POST /v1beta/models/{model}:embedContentPOST /v1beta/models/{model}:batchEmbedContents |
Gemini embeddings | |
POST /v1/embeddings |
OpenAI embeddings | |
POST /v1/images/generations, POST /v1/images/edits |
OpenAI images | edits is multipart. |
POST /v1/audio/speech, POST /v1/audio/transcriptions, POST /v1/audio/translations |
OpenAI audio | The last two are multipart. |
GET /v1/models, GET /v1/models/{model}, GET /v1beta/models |
OpenAI / Anthropic / Gemini | Models your key may call right now. |
GET /v1/generation?id= |
Gateway | Cost and usage of one request. See cost. |
Everything else (files, batches, assistants, legacy /v1/completions, /v1/messages/count_tokens, Gemini countTokens) is not served.
One model, any chat dialect
Section titled “One model, any chat dialect”A model is not tied to the dialect of its provider. Call a Claude model through /v1/chat/completions, or a GPT model through /v1/messages; the gateway converts the request to whatever the serving provider speaks and converts the answer back to the dialect you called.
# A Claude model, called in the OpenAI Chat format.curl https://api.test.whocare.xyz/v1/chat/completions \ -H "Authorization: Bearer $GATEWAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "claude-sonnet-5-5", "messages": [{"role": "user", "content": "Say hello in one word."}]}'The gateway maps messages, system prompts, tool calls and results, images, structured output, reasoning and cache markers between dialects, and reports stop reasons and usage in the dialect you called. When the serving provider speaks the same dialect as the request, the body is forwarded as is, apart from the gateway’s own fields and with the cost added to the usage object. Provider-specific fields can therefore behave differently on the two paths. If you depend on one, pin a provider that speaks your dialect (routing) and check X-Gateway-Provider in the response.
A request the chosen model cannot serve is refused before anything is sent upstream and nothing is charged: 400 unsupported_capability when the model lacks a capability the request needs (images on a text-only model, tools, structured output, a provider-run tool, a non-default service_tier), and 400 unsupported_operation when the model’s kind does not match the endpoint (an embedding model on a chat route).
Anthropic Messages
Section titled “Anthropic Messages”curl https://api.test.whocare.xyz/v1/messages \ -H "x-api-key: $GATEWAY_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-5-5", "max_tokens": 64, "messages": [{"role": "user", "content": "Say hello in one word."}] }'Errors come back in Anthropic’s envelope. Insufficient balance is billing_error with HTTP 402; an overloaded provider is HTTP 529.
Gemini
Section titled “Gemini”The model name and the method share one path segment, separated by the last colon.
curl "https://api.test.whocare.xyz/v1beta/models/gemini-2.5-flash:generateContent" \ -H "x-goog-api-key: $GATEWAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"contents": [{"role": "user", "parts": [{"text": "Say hello in one word."}]}]}'The cost is usageMetadata.cost. Errors use Google’s envelope with status values such as RESOURCE_EXHAUSTED. Insufficient balance has no Google equivalent and is reported as RESOURCE_EXHAUSTED with HTTP 429; read error.message, which says “Insufficient balance”, or use the OpenAI-shaped endpoints if you need 402.
OpenAI Responses
Section titled “OpenAI Responses”curl https://api.test.whocare.xyz/v1/responses \ -H "Authorization: Bearer $GATEWAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "gpt-4o-mini", "input": "Say hello in one word."}'A follow-up request with previous_response_id is routed to the provider and upstream key that served the first one, for as long as the binding lives (72 hours by default, restarted each time the id is used). Using an id that your organisation did not create answers 404 previous_response_not_found.
Embeddings
Section titled “Embeddings”curl https://api.test.whocare.xyz/v1/embeddings \ -H "Authorization: Bearer $GATEWAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "text-embedding-3-small", "input": "hello"}'Fields the gateway adds
Section titled “Fields the gateway adds”These three top-level request fields are read by the gateway and removed before the request reaches a provider. They are accepted on every route above that takes JSON (multipart routes take them as form fields holding JSON).
| Field | Purpose |
|---|---|
provider |
Routing preferences: order, only, ignore, sort, allow_fallbacks. See routing. |
models |
A fallback model. See routing. |
usage |
{"include": true} is accepted and removed. The cost is returned either way. |
The model field also takes <model>:<provider> to pin a provider.
Request limits
Section titled “Request limits”These are deployment settings; the values below are the defaults.
| Limit | Default | Error |
|---|---|---|
| JSON body size | 32 MiB | 413 request_too_large |
| Multipart body size (audio uploads, image edits) | 100 MiB | 413 request_too_large |
| Time to receive the body | 2 minutes | 400 body_read_timeout |
max_tokens and its synonyms |
262,144 | 400 max_tokens_too_large |
| A key repeated inside a JSON body | not allowed | 400 duplicate_key |
Response headers
Section titled “Response headers”| Header | Value |
|---|---|
X-Request-Id |
The id of this request. Keep it: it is the id for /v1/generation and the id shown in the request log. |
X-Gateway-Provider |
Tag of the provider that served the request. Absent when that provider has no tag. |
X-Gateway-Attempts |
Number of upstream attempts made, including the successful one. |
x-ratelimit-*, Retry-After |
See rate limits. |
Model lists
Section titled “Model lists”GET /v1/models returns the models your key may call that currently have a price and at least one provider. The shape follows the client: OpenAI by default, Anthropic when the request has anthropic-version and no Authorization header, and GET /v1beta/models returns the Gemini shape with supportedGenerationMethods. Each OpenAI entry also carries context_length and max_output_tokens when the catalog has them, and deprecated: true for models being retired.