Documentation

Point your SDK at Model Waygate and reach every provider you hold a key for.

Quickstart

Four steps in the dashboard, then one line in your code. Add a provider (an API key you hold with OpenAI, Anthropic, Gemini or an OpenAI-compatible server), start an endpoint with the New endpoint wizard, which names it and draws its first route to one of your provider's models (or leaves it for you to draw in the editor), then mint a gateway key on the endpoint's page, where the wizard leaves you (or open it from the Endpoints page with its Settings button; every page of an endpoint has a tab bar leading to its Settings, Route, Versions, Deployment and the rest), and copy the endpoint's URL. Point your SDK at that URL, https://modelwaygate.com/USER_ID/ENDPOINT/api/v1, in place of the provider's own. The OpenAI SDKs need nothing else: the gateway speaks their dialect and translates it for whichever provider the endpoint's route reaches.

Request Headers

HeaderRequiredDescription
AuthorizationYesBearer followed by a gateway key, minted on the endpoint's page in the dashboard and shown once.
Content-TypeYesapplication/json
X-Gateway-Task-SessionNoA task session's id (tsk_...) your backend made for this endpoint: the request is the session's, its customer, feature and deadline. See Task sessions.
  • Base URL: https://modelwaygate.com/USER_ID/ENDPOINT/api/v1, which the Endpoints page shows in full for each endpoint, with a Copy button beside it. The OpenAI SDKs take it as base_url (Python) or baseURL (TypeScript).
  • USER_ID and ENDPOINT: USER_ID is your account's public id, 12 characters given to the account when it is made and never changed. ENDPOINT is the slug you gave the endpoint when you added it (lowercase letters, digits and dashes), which never changes either; renaming an endpoint changes only the name the dashboard shows.
  • model: every dialect requires the field and the SDKs always send it, but the endpoint's route decides which provider and which model answer, so its value is not used for routing. Sending the endpoint's slug keeps logs readable. The model field of the response names the provider model that actually answered.
  • Keys: start with mw_ and are sent as the bearer token. A key belongs to one endpoint and works for that endpoint alone: it is minted, capped, disabled and deleted on the endpoint's page, and deleting the endpoint deletes its keys. An endpoint may have several keys, one per app or machine, each with its own monthly cap and requests-per-minute limit if you want them. Set either when minting a key or edit them beside the key on its endpoint page. A blank rate inherits the gateway default; an explicit rate must be a positive whole number at or below that default. Lowering the gateway default also lowers the effective limit of any key above it. Deleting a key keeps what it was billed: the usage log keeps its requests and the month's spend still counts against the account's cap.

Code Examples

curl https://modelwaygate.com/USER_ID/ENDPOINT/api/v1/chat/completions \
  -H "Authorization: Bearer mw_your_gateway_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ENDPOINT",
    "messages": [{"role": "user", "content": "Say hello in three words."}]
  }'
from openai import OpenAI

client = OpenAI(base_url="https://modelwaygate.com/USER_ID/ENDPOINT/api/v1", api_key="mw_your_gateway_key")

response = client.chat.completions.create(
    model="ENDPOINT",
    messages=[{"role": "user", "content": "Say hello in three words."}],
)
print(response.choices[0].message.content)
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://modelwaygate.com/USER_ID/ENDPOINT/api/v1", apiKey: "mw_your_gateway_key" });

const response = await client.chat.completions.create({
  model: "ENDPOINT",
  messages: [{ role: "user", content: "Say hello in three words." }],
});
console.log(response.choices[0].message.content);
OkHttpClient client = new OkHttpClient();

String json = "{\"model\": \"ENDPOINT\", "
    + "\"messages\": [{\"role\": \"user\", \"content\": \"Say hello in three words.\"}]}";

Request request = new Request.Builder()
    .url("https://modelwaygate.com/USER_ID/ENDPOINT/api/v1/chat/completions")
    .header("Authorization", "Bearer mw_your_gateway_key")
    .post(RequestBody.create(json, MediaType.get("application/json")))
    .build();

try (Response response = client.newCall(request).execute()) {
    System.out.println(response.body().string());
}
import Data.Aeson (encode, object, (.=))
import Network.HTTP.Client
import Network.HTTP.Client.TLS (tlsManagerSettings)

main :: IO ()
main = do
  manager <- newManager tlsManagerSettings
  initial <- parseRequest "POST https://modelwaygate.com/USER_ID/ENDPOINT/api/v1/chat/completions"
  let body = object ["model" .= "ENDPOINT", "messages" .= [object ["role" .= "user", "content" .= "Say hello in three words."]]]
      request = initial{requestHeaders = [("Authorization", "Bearer mw_your_gateway_key"), ("Content-Type", "application/json")], requestBody = RequestBodyLBS (encode body)}
  response <- httpLbs request manager
  print (responseBody response)

Anthropic SDK

The gateway speaks the Messages API at https://modelwaygate.com/USER_ID/ENDPOINT/api/v1/messages, so the Anthropic SDKs work against it with their base URL changed to https://modelwaygate.com/USER_ID/ENDPOINT/api: the SDKs add /v1/messages and /v1/models themselves, as they do against api.anthropic.com, so their base URL ends at /api where the OpenAI SDKs' ends at /api/v1. Pass the gateway key as the SDK's API key (api_key in Python, apiKey in TypeScript and Java); no custom headers or SDK changes are needed. The endpoint's route may reach any provider, so a Messages request can be answered by an OpenAI or Gemini model too.

Request Headers

HeaderRequiredDescription
x-api-key or AuthorizationYesOn Messages and its token counting, send the gateway key as x-api-key or Authorization: Bearer. Both headers may be sent only with the same key; differing keys are refused with a 401 authentication_error. OpenAI-shaped routes and info routes accept only Authorization: Bearer.
  • Base URL: https://modelwaygate.com/USER_ID/ENDPOINT/api for the SDKs, which add /v1/messages and /v1/models to it. A request made by hand goes to https://modelwaygate.com/USER_ID/ENDPOINT/api/v1/messages, as the curl and Haskell examples do.
  • max_tokens: required, as the Messages API requires it. Thinking budgets map to a reasoning effort for providers that have one.
  • Streaming: stream: true answers Anthropic's event stream (message_start, content_block_delta, message_delta, message_stop) from whatever provider the route reaches.
  • Token counting: https://modelwaygate.com/USER_ID/ENDPOINT/api/v1/messages/count_tokens counts a Messages body's input tokens without answering it, as Anthropic's own /v1/messages/count_tokens does (the SDKs' messages.count_tokens, and Claude Code, which otherwise estimates its context from characters). Send what a Messages request would, max_tokens left out. Only Anthropic counts tokens, so the count runs the endpoint's route as the Messages request it counts would (a switch's messages rule takes it too) and goes only to Anthropic outputs: forwarded as a /messages request is (see Translation), the output's model in place of the body's, and Anthropic's answer, {"input_tokens": n}, comes back as it came. Any other output is skipped as capability_excluded, so a fallback moves on past it, and a route with no Anthropic output answers a 400 naming count_tokens. A count is recorded and billed by its bytes like any request, its API messages_count_tokens, with no token usage: Anthropic counts it free and nothing was generated.

Code Examples

curl https://modelwaygate.com/USER_ID/ENDPOINT/api/v1/messages \
  -H "x-api-key: mw_your_gateway_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ENDPOINT",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Say hello in three words."}]
  }'
from anthropic import Anthropic

client = Anthropic(base_url="https://modelwaygate.com/USER_ID/ENDPOINT/api", api_key="mw_your_gateway_key")

message = client.messages.create(
    model="ENDPOINT",
    max_tokens=256,
    messages=[{"role": "user", "content": "Say hello in three words."}],
)
print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({ baseURL: "https://modelwaygate.com/USER_ID/ENDPOINT/api", apiKey: "mw_your_gateway_key" });

const message = await client.messages.create({
  model: "ENDPOINT",
  max_tokens: 256,
  messages: [{ role: "user", content: "Say hello in three words." }],
});
console.log(message.content[0].type === "text" ? message.content[0].text : "");
AnthropicClient client = AnthropicOkHttpClient.builder()
    .baseUrl("https://modelwaygate.com/USER_ID/ENDPOINT/api")
    .apiKey("mw_your_gateway_key")
    .build();

MessageCreateParams params = MessageCreateParams.builder()
    .model("ENDPOINT")
    .maxTokens(256)
    .addUserMessage("Say hello in three words.")
    .build();

Message message = client.messages().create(params);
System.out.println(message.content().get(0).text().map(TextBlock::text).orElse(""));
import Data.Aeson (encode, object, (.=))
import Network.HTTP.Client
import Network.HTTP.Client.TLS (tlsManagerSettings)

main :: IO ()
main = do
  manager <- newManager tlsManagerSettings
  initial <- parseRequest "POST https://modelwaygate.com/USER_ID/ENDPOINT/api/v1/messages"
  let body = object ["model" .= "ENDPOINT", "max_tokens" .= 256, "messages" .= [object ["role" .= "user", "content" .= "Say hello in three words."]]]
      request = initial{requestHeaders = [("x-api-key", "mw_your_gateway_key"), ("Content-Type", "application/json")], requestBody = RequestBodyLBS (encode body)}
  response <- httpLbs request manager
  print (responseBody response)

Providers

A provider is one API key you hold with a model provider, added on the dashboard's Providers page under a name you choose. The name is for you and your routes only: it never appears in a URL, may contain spaces, and must differ from your other providers' names, so several providers of one kind sit side by side (a work and a personal Anthropic key, or two OpenAI-compatible servers). Every call goes out on your own key, so the provider bills you for its tokens directly.

  • Kinds: Anthropic, OpenAI, Gemini (through Google's OpenAI-compatible API), and OpenAI-compatible, which takes the base URL of any server speaking OpenAI's API, up to and including /v1.
  • Names: up to 60 characters, trimmed, and unique among your providers.
  • Secrets: printable ASCII only (no line breaks, tabs or other characters), trimmed, up to 4,096 characters; stored encrypted and used only to forward your requests; the dashboard shows the last four characters and never the key again.
  • How many: an account holds at most 50 providers; delete one to add another past that.
  • Models: the route editor asks a provider for its model list when you pick it for an output or a decider, and offers the list as suggestions (Refresh asks again). A list over 2 MiB is refused as unreadable; of the rest the first 1,000 models are offered, leaving out any whose id is over 256 characters and cutting longer names to that. Any model name may be typed, so a provider whose list cannot be fetched, or a model left off it, still works.
  • Deleting: a provider that any endpoint's live route, or its draft, sends to, as an output or a decider, cannot be deleted; the page names the endpoints using it. Take it out of their routes first. Versions of a route that still name it and are not live are archived when it is deleted, so they can never be deployed again, and keep its kind, name and host in their history. Your capability declarations about it (control API) are kept as history too, with its kind and host, and no longer count for anything.

Routing

Each endpoint is a route you draw in the dashboard. The New endpoint wizard starts it on one model, one model retried, one model with a backup, a retried first model with a backup, a circuit breaker on the first model with a backup, or a concurrency limit on the first model with a backup taking the overflow; or on the input alone; Endpoints, then Edit route, takes it from there. A request to the endpoint starts at the route's input and follows it to one provider's answer. A route is checked when it is saved, so a saved route always holds together, and it is read afresh for every request, so a deployed change applies to the next one.

  • Input: one per route, fixed, with one edge to the node that takes every request. An endpoint started on the input alone leads nowhere, and requests to it are refused with a 409 until a route is saved, published as a version and deployed.
  • Output: one provider and one model, both fixed in the node. The request goes to that provider in its own dialect with the node's model in place of the caller's. An output ends its branch: nothing comes after it.
  • Output timeout: an output may have a timeout of its own, from 1 to 300 seconds. A buffered call must be over within it, its whole answer read (or within the request's own 5 minutes, if that is sooner); a streamed call must have begun within it (or within the 2 minutes every provider has to start answering), and once the stream has begun only the 2-minute silence limit and the 60-minute stream limit hold it. Past its timeout the call counts as unreachable, so a retry tries it again and a fallback moves on, and the error says it was the output's timeout. A timeout longer than 2 minutes only gives a buffered answer longer to finish: the provider still has 2 minutes to begin answering, and missing that fails with the general unreachable message, not the timeout's; for a stream it changes nothing. Without one, only the request's own limits apply.
  • Retry: runs its one child, which may be any node, again after a pause when it fails in a way a second try might not: the provider cannot be reached or ran past a timeout, it answers a 5xx or a 429, or it answers a 2xx that cannot be read, or one that holds no answer (see Empty replies) (a stream refused before it began for any of those included). Any other failure, a 4xx such as a 400 or a 401, a redirect, a provider on a private or local address, or one of the gateway's own refusals, is passed on at once, and so is the last try's failure, so a fallback above moves on. A retry makes from 2 to 5 tries, the first included. The pause before try n grows by its backoff from a base delay of 100 to 10000 ms: fixed waits the base every time, linear the base times n − 1, exponential the base doubled for each try after the second, and none is longer than the retry's longest delay, at most 30000 ms. With jitter on, each pause is a random time from none of that delay to all of it, so callers retrying together spread out.
  • Retry-After: when a failed try's answer carries a Retry-After header, in seconds or as an HTTP date, the pause before the next try is exactly the wait it asks for instead of the backoff, without jitter (a date already past asks for none). A wait no longer than the retry's longest delay is honoured in full. A longer one is never cut short, since trying sooner than the provider said would only be refused again: the retry gives up there with that failure, so a fallback above moves on to its next child at once, and the route taken ends retry n/N skipped (Retry-After 120s). A header that is absent, or that cannot be read (a fraction, a negative number, any other text), leaves the backoff to decide the pause. The route deadline still applies to a wait the provider asked for.
  • Retries and limits: every try is an upstream call like any other: it counts toward the 32-call limit, its request toward the upstream budget, and a try past either stops the route as any call would. A pause is not taken when the next try would start after the route deadline (15 minutes from the request's arrival): the retry gives up with its last failure, and the route taken ends retry n/N skipped (route deadline). Only the try that answers is billed. A streamed request is tried again only until its stream begins; once anything has reached the caller, nothing is.
  • Circuit breaker: guards exactly one output, its one edge, and stops calling it while it keeps failing. Closed, it lets every request through and counts the output's failures in a row: the ones a retry would try again (unreachable, past a timeout, a 5xx, a 429, an unreadable 2xx, an empty reply), and a stream the provider breaks off after it began or ends with no answer in it. A success starts the count again; any other failure, such as a 400 or a 401, a provider on a private address, or one of the gateway's own limits, neither counts nor starts it again. When the count reaches the breaker's threshold (1 to 100, 5 by default) it opens, and every request reaching it is answered at once without calling the output: no upstream call, nothing sent, nothing billed. After its cool-down (1 to 3600 seconds, 30 by default) it lets exactly one test request through, while every other still finds it open: the test answering closes it, the test failing opens it for another cool-down. A streamed test has answered once its stream begins, which closes the breaker there and then; a provider breaking that stream off later counts as one failure against the closed breaker. A slow test keeps every other request out however long it takes; only a test whose server stopped mid-call is given up, 20 minutes after it went out, the longest any request may run. A breaker whose state cannot be written lets traffic through too: a test that could not be recorded as answered is settled again as its stream ends, so its claim is never left held. Each breaker keeps its own state for its endpoint and the output it guards, even two in front of one provider, and that state is shared by every server the gateway runs on; changing a breaker's settings keeps its state, while taking it out of the route, or connecting it to another output or model, forgets it. A breaker whose state cannot be read, the gateway's database failing, lets the request through as if closed. The endpoint's page shows where each stands.
  • Breakers, fallbacks and retries: an open breaker is a failure like any other to a fallback above it, which moves on to its next child. A retry above it does not try it again, since it would answer the same, and a retry's tries each count, so a retry over a breaker can open it partway; the next try then finds it open and the retry stops there. When an open breaker's answer is the route's last failure, the caller gets a 503 circuit_open naming the breaker, with Retry-After saying when a test is allowed (the soonest, of every open breaker the route met).
  • Hedge: cuts the slow tail of a buffered request by asking a second provider when the first is slow, rather than waiting for it to fail. It has two legs, the primary then the backup, each an output, optionally behind its own circuit breaker. The backup delay is 50 to 60000 milliseconds and must be shorter than the primary output's timeout. A buffered request (non-streamed chat in every format, and embeddings) calls the primary; once the primary has been pending for the delay the backup is called too, and the first acceptable reply answers: one the provider sent in full, read and parsed. The other call is then cancelled and its connection closed. A primary that fails before the delay starts the backup at once, and when both fail the request fails with whichever failure came last, as a fallback's would. Two replies already in when the gateway looks go to the primary. Most requests finish inside the delay and make one call; set it near the primary's usual slowest time (its 95th percentile) to pay for a second call on about one request in twenty.
  • Duplicate calls are charged: a hedge is saved only with Accept duplicate calls ticked, beside the editor's disclosure, which says it plainly: "The backup is a second, separate call to its provider. Both calls may be charged to your provider keys, and both count against their rate limits." That includes the loser: a call that answered after the winner, one that failed, and one cancelled partway, which a provider may still bill for the tokens it generated before the connection closed (the gateway cannot know how many). The gateway runs no tools and keeps no provider-side state, so a second call never makes anything happen twice; it only costs twice. Model Waygate's own fee is charged once, for the reply you are sent: losers are never billed, but both requests sent upstream count against the request's upstream budget.
  • When the backup is not called: the backup is optional while the primary can still answer, so nothing about it stops the request: it is not called when the primary was the last of the request's 32 calls, when the route deadline or the task session's deadline has passed, when its circuit breaker is open, or when sending it would take the request past its upstream budget. The request then waits for the primary alone, and the route taken says why, such as hedge h backup not launched (call cap). Once the primary has failed, the backup is called as a fallback's next child would be, and those same limits stop the request. Under a retry, every try is a fresh hedge of up to two calls.
  • Hedges and streams: a streamed request walks the hedge as a two-child fallback: the primary, then the backup only if the primary fails before anything has reached the caller. Nothing is raced and nothing cancelled, and the route taken says so: hedge h backup in turn (stream) → ….
  • Seeing a hedge: the route taken names the leg that answered and what became of the other, such as hedge h backup after 800ms → Work OpenAI (gpt-4.1) → hedge h won; other cancelled. A request's page lists every call each leg made with a line a race above them, such as Hedge: primary (call 1, node out-0) lost, cancelled; backup (call 2, node out-1) won, and GET /requests/{id} gives each call's hedge_leg (primary or backup) and hedge_result (won or lost), both null for a call no hedge raced; a loser's outcome says whether it answered, failed or was cancelled. A leg never called has no call. The editor's node counts show a cancelled leg as cancelled, neither answered nor failed.
  • Concurrency limit: guards exactly one output, its one edge, or a circuit breaker in front of one, and lets at most so many requests through to it at once (1 to 1000, 4 by default). The next is refused at once, without waiting and without calling the output: there is no queue. A refusal is the gateway's own decision, not the provider failing, so it never counts against a circuit breaker or the provider's health, and a retry above does not try it again. A request holds its place from just before its call until the call's connection closes, so a long stream holds it until its last token, and a fallback above it that moves on gives the place back at once. An output has at most one limit and one breaker in front of it, the limit first: a limit can never sit behind a breaker, and two limits are never stacked. The endpoint's page shows how full each limit is, such as pool: 3 of 4 in use.
  • What a limit bounds: requests through this one node of this one endpoint, to the provider and model it guards, counted across every server the gateway runs on. It does not bound your account's total traffic to the provider: two endpoints, or two limit nodes, in front of one model each allow their own count. It is the gateway's count, not the provider's: after a gateway server crashes, the places its requests held are taken back within 60 seconds, so the provider can briefly see more. Rewiring a limit to another output or model, or reusing its id in front of something else, starts a fresh count; changing its setting keeps the count, and a lower setting refuses until the count drops under it.
  • Limits and fallbacks: a full limit is a failure to a fallback above it moving on after any failure, which tries its next child: the way to send the overflow to another model. A fallback with a policy moves on from it only with limit_refused ticked, which a new selective fallback starts with. Without a fallback the caller gets a 429 concurrency_limit_reached with Retry-After: 1. A refusal never hides a real failure: when a call was made and failed, the caller gets that failure, and a refusal only when no call was made, the last one the route met.
  • When a limit cannot count: the count lives in the gateway's database. When it cannot be read, the limit refuses rather than let an unknown number through: a fallback above moves on, and without one the caller gets a 503 concurrency_limit_unavailable quoting the request id. A request holding a place renews its hold every 15 seconds while its call runs; one that can no longer renew it is stopped, concurrency_lease_lost: before its answer began a fallback above moves on, and a stream already under way ends with an error event. Routes with no limit never touch the count.
  • Fallback: children tried in their order, which the side panel moves up and down, until one answers. Anything short of an answer moves on to the next child: the provider cannot be reached, it has not started answering within 2 minutes or finished a buffered answer within 5 minutes, or ran past its output's own timeout, it answers any 4xx (429 included) or 5xx, or redirects (the gateway follows no redirect), it answers 2xx with a body that cannot be read or with no answer in it (see Empty replies), or it cannot do what the request asks, as an Anthropic output cannot embed. When every child fails, the caller gets the last child's error. A fallback may not list the same child twice. That is a fallback moving on after any failure, as every fallback does unless you give it a policy (below).
  • Fallback policy: in the side panel a fallback can move on only after the failures you tick, so a backup answers for an outage or exhausted quota while a request the provider refused as invalid, or a key it refused, comes back at once instead of being tried elsewhere. A new selective fallback starts on unreachable, server_error, rate_limited, empty_reply, circuit_open, limit_refused. Each failure is in at most one category: unreachable, the provider could not be reached, its address is a private or local one, or it ran past a timeout; server_error, it answered a 5xx; rate_limited, it answered a 429; auth_refused, it answered a 401 or 403, refusing the key; client_error, it answered any other 4xx, a 400 or a 404 or a 422, or a redirect (none is followed); protocol_error, it answered a 2xx that could not be read: not its API's JSON, not an event stream when one was asked for, or too long; empty_reply, it answered a 2xx that could be read but held no answer: no text, no tool call, and a finish other than the request's token limit, a filter or a refusal (see Empty replies); capability_excluded, the provider cannot perform the requested operation, such as embeddings on an Anthropic output, or the output was not called because the request holds a field that cannot be translated for its provider; circuit_open, the output was not called, since the circuit breaker in front of it is open; limit_refused, the output was not called, since its concurrency limit is full or could not be checked; losing a lease after admission is not in this category. A child that fails outside the ticked categories (or with the gateway's own internal error, which is in none) stops the fallback there: its error is the fallback's, and goes up the route, where a retry may try it again and a fallback above judges it by its own policy. The route's deadline, its call limit, its upstream budget and a closed task session are no category: they stop the whole request whatever any fallback ticks. A fallback judges a child by the error the child would answer: one that ended on an excluded output after a provider call under it failed is judged by that call's failure, as the request would answer it; an exclusion with no failed call under that child is judged as capability_excluded, whatever failed before it. A stream that has begun is never taken back, so no policy moves on from it. A policy that ticks nothing is refused on save. Changing a policy is a change of the route like any other: it mints a new version, and versions published before policies keep their hashes, moving on after any failure.
  • Streams and fallbacks: a streamed request falls back only until its stream begins, which is when a provider answers 2xx with an event stream. Once that has started reaching the caller nothing is retried: a provider that fails partway ends the stream with an error event in the caller's dialect.
  • Empty replies: a provider's 2xx is a failure, not an answer, when it can be read but holds no answer: no text with anything in it (whitespace counts as text) and no tool call, and the provider's finish is not one that explains the silence. A reply cut off at the request's own token limit (length, max_tokens, max_output_tokens: a reasoning model can spend the whole budget before writing), one withheld by the provider's content filter, and a refusal (Anthropic's refusal stop, or OpenAI's refusal text, which is passed on as the reply's text) are answers, and so is a reply of tool calls alone. Reasoning alone is not an answer. Anything else with nothing in it, content: null with finish_reason: "stop" above all, or an Anthropic message whose content is empty, is the failure empty_reply, whichever of /chat/completions, /responses or /messages the caller used: a retry tries it again, a breaker counts it, a fallback moves on (its policy category is empty_reply, ticked on a new selective fallback), its call is listed failed with class empty_reply in the request's calls and in provider health, and it is never billed. When every output answers so, the caller gets a 502 empty_reply. A stream is judged at its end, by the same rule over its deltas: it began reaching the caller with its first event, so no retry or fallback can follow it; instead it ends with an error event in the caller's dialect saying the provider answered nothing, its call is listed failed with stream end empty, and it is not billed (its cost comment says $0).
  • Decision: a decider (one provider and model, best a small fast one that does not reason first) picks one of the decision's options. Each option has a label, a description and an edge to the branch it leads to, and a default branch takes everything else. The decider is sent a system prompt listing the labels and descriptions and asking for exactly one label, then a transcript of the request: the caller's system prompt (its first 4,000 characters), then the latest turns that fit in about 12,000 characters, with earlier turns marked as left out, tool results cut to 300 characters and images shown as [image]. It may answer in up to 1,024 tokens, which a reasoning model spends on its thinking too.
  • Matching the decider's answer: the answer picks the option whose label it equals, ignoring case and surrounding space; failing that, the one label left when quotes, asterisks and a trailing full stop are stripped from both. An empty answer, an answer that matches no label or matches two, and a decider call that fails all take the default, and the route taken says which: decision default (empty answer), (decider answered "…") or (decider failed). Labels must be unique, ignoring case, and not blank.
  • Weighted split: sends each request down one of its branches, in lasting shares you set, such as 80% to one model and 20% to another. Each branch has an id, which its one edge carries, and a share in basis points from 1 to 10000 (0.01% to 100%; the editor takes percent with up to two decimals); the shares must add up to exactly 10000. A request falls at a place from 0 to 9999, worked out by a keyed hash from the split's salt, your account, the endpoint, the node, the route version and the request's task session (or, without one, its own request id), and takes the branch whose share covers that place, the shares laid end to end in order. Every request of a task session takes the same branch, on every server, for as long as the session runs on one version; a request without a session is placed afresh. Nothing is stored and nothing is learned from answers: this is configuration, not a judgement of which model answers better.
  • Weighted splits, failures and versions: only the branch a request falls on runs. Its failure is the request's, and the split never hands the request to another branch: put a fallback around the split to try another model. A retry around the split tries the same branch again, since the request's place never changes during it. The salt is part of the route: a split saved without one is given one (through the editor or the control API, the salt the node of that id had in the draft before, or a fresh one), and every version published from the draft keeps it. The version is part of the place too, so a new version (deployed, rolled back to, or a session's revalidation moving it to another) places every session afresh.
  • Switch: routes by what the gateway knows of the request for certain, asking no model: no decider call, no tokens, nothing added to the request's calls. Each rule has an id, which its edge carries, and conditions, all of which must hold: api (the route the request came in on: chat_completions, responses, messages or embeddings), stream (whether it asked for a stream), and customer and feature (equal to its task session's). The rules are tried in their order and the first that matches takes the request; a default takes every request no rule matches. A switch may have up to 32 rules, ids of 1 to 64 letters, digits and . _ : -, each different. A rule with no condition, a rule naming a customer or feature no task session can have, and a rule an earlier one always matches first are refused, since each would leave a rule or the default never used.
  • What a switch trusts: a customer or feature comes only from the task session the request presented in its X-Gateway-Task-Session header, which your backend made: a request with no session, or a session without that label, matches no rule asking for it, and a session of another endpoint is refused before anything is routed. Nothing the caller writes is read as a label: not a header, not user or metadata in the body, not the prompt and not a model's answer. Labels are compared exactly, case included. There is no pattern matching, no token counting and no scripting.
  • A switch and what is below it: the case a switch chooses is the request's whole route from there: when it fails, the switch does not try its default, but a fallback above the switch moves on as for any failure. A retry above a switch chooses the same case on every try. The route taken names the switch and the rule's id, or its default, and never the customer or feature: switch kind rule "embed" → … or switch kind default → ….
  • Shared nodes and loops: a node may be reached along several paths, but no path may lead back to where it came from; a decision's or a switch's default counts as a path.
  • Node counts: the editor shows above every node how many requests have passed through it, how many of those the route below it answered and how many failed. Every pass counts, so an output a retry tries three times counts three, and a node reached along two paths counts each; a request no output answered counts as failed at every node it passed, and an open circuit breaker counts as failed while the output behind it, never called, counts nothing. A hedge's leg cancelled once the other leg had won counts as cancelled (⊘), neither answered nor failed, shown only on a node that has any. The input counts every request the route ran. A version's page shows the same counts in a table, and the control API's node_counts gives each node's answered, failed and abandoned (cancelled). Refresh counts brings them up to date without touching the route as drawn; Reset counts starts every node of the endpoint again from zero, from now. Each request is counted under the route version that served it, and the editor adds up every version's counts for the nodes of the route it shows: saving a route keeps the counts of the nodes it kept and stops showing those of the nodes it took out, and a node added back later under the same name shows its earlier counts again.
  • Size: a route may hold up to 200 nodes and lead to at most 256 provider calls with every branch counted, and one request may make at most 32 upstream calls, deciders included. A request that needs more is stopped with a 502 naming the last failure.
  • Upstream budget: every output is sent the whole request, so one request may send at most 64 MiB of requests upstream in all, deciders included. The call that would take it past that is not sent, and the route stops there with a 502, unbilled, whatever outputs or defaults are left; a request of the largest size, 20 MiB, can try about 3 outputs.
  • Route deadline: no call starts once 15 minutes have passed since the request arrived; the route stops there with a 504, unbilled. A call already under way runs to its own limits.
  • Embeddings: POST /embeddings follows the same route. A decider sees the inputs as one user turn, one input per line, and an output whose provider cannot embed fails, so a fallback moves past it.
  • The route taken: every request records the way it went, such as fallback#2 → Work Anthropic (claude-sonnet-4-5), decision "code" via Router (gpt-4o-mini) → Coder (gpt-4o), or retry 2/3 → Work Anthropic (claude-sonnet-4-5) for the second of a retry's three tries. A circuit breaker shows by its node id and what it said: breaker guard closed → …, breaker guard testing → …, or breaker guard open (test in 18s), where the route went no further. A concurrency limit shows by its node id and its places in use with this request's, limit pool 3/4 → …, or limit pool full (4/4) and limit pool unavailable where the request ended there. A fallback records only the child that answered, so a request a full limit spilled to the next child shows that child alone, such as fallback#2 → Work OpenAI (gpt-4o), and the refusal as a route event. A weighted split shows by its node id and the branch taken, weighted split "alt" → …, never the place, the salt or the session that picked it. A fallback whose policy stopped it ends the line after the route that failed: fallback#1 → Work OpenAI (gpt-4o) → fallback chain stopped after #1 (client_error not selected). A request's page in the dashboard and GET /generation show it; the page also lists its route events, each turn a fallback with a policy took (fallback_moved_on or fallback_stopped, naming the fallback, the output that failed, the child's place and the category, never what the provider said), each concurrency limit that refused it (concurrency_limited with the limit and the places in use, or concurrency_unavailable), and the adapter build each call went through.
  • Editing: drag nodes to place them, drag from a node's port onto another node to connect them (a retry's or a circuit breaker's port again moves its one edge, and a breaker's connects only to an output), add nodes from the Add Node menu on the canvas's toolbar, which groups the kinds by what they do (Send, Route, Recover and Protect) and says in a line what each one does, and select a node to set its provider, model, timeout, order, options, rules, retry or breaker settings in the side panel; the Delete key or button removes the selection. The view fits the whole route when the endpoint loads; drag the empty canvas to pan it (one finger on a touch screen), turn the wheel or pinch to zoom about the pointer, and use the buttons in the canvas's corner to zoom out, zoom in or fit the route again. Zooming and panning only change what you see: node positions are saved in the route's own coordinates. Undo and Redo (Ctrl+Z, and Ctrl+Shift+Z or Ctrl+Y; Cmd on a Mac) step back and forward through every change to the draft since it was loaded: nodes added, removed or moved, edges made or removed, and settings changed, a run of typing into one field counting as one change. Panning and zooming are not changes, so undo leaves the view where it is. Undo history belongs to the open editor: it starts afresh when the draft is reloaded or started again from a version, and it never changes a published version. Inside a text field the keys undo the typing in that field instead. Everything works from the keyboard as well: Enter or Space on Add Node opens its menu, the arrow keys move through it, Enter adds the kind chosen and Escape closes it; with a node or an edge focused, the arrow keys pan, plus and minus zoom and 0 fits the route; Tab reaches each node and edge on the canvas and Enter selects it, and the side panel connects what the drag does: the input's, a retry's and a circuit breaker's Routes to, Retries and Guards, each decision option's route, each switch rule's id, conditions and route, its order set with the arrows beside each rule, and a fallback's Children boxes, its order set with the arrows beside each child, and below them what it moves on after: any failure, or only the categories ticked. Save draft stores the route only if it holds together; otherwise the nodes and edges at fault are marked and every problem is listed. Saving never changes what is live (see Drafts, versions and going live, below). Leaving with unsaved changes asks first. The JSON tab, beside Canvas above the route, shows the route as drawn, unsaved changes included, as the JSON the control API gives as a draft's graph (see Control API), following every edit; Copy puts it on the clipboard. It is read-only: the route is changed on the canvas and in the side panel. The editor needs JavaScript and WebAssembly.
  • Testing a route: Test this route, under the canvas, sends one message through the route as drawn, saved or not, so you can see the branch it takes before anything goes live. Each output answers normally or fails in a category you pick, the categories of a fallback's policy: an output marked failing is not called, and fails as a real failure of that kind would, so every fallback, policy and retry above it does what it would do for real. The outputs not marked failing either answer a canned reply, calling no provider, or are called for real on your provider keys (buffered, asked for at most 256 tokens), which your provider may charge for; the editor says which. A decider answers the canned reply, which matches no option, so its default is taken, or with real calls is asked. A switch sees a chat completions request, not streamed, with no task session, and a weighted split places each test at random. The editor shows how it went, each output it tried and how that ended, and the route taken as the request log writes it. A test is never charged: it is listed under Usage marked as a test, made with no gateway key and counted toward no spend cap, and its calls are not recorded, so provider health never sees them. It moves no circuit breaker (every one is closed to it), no concurrency limit (every one has room for it) and no node count, and a retry does not pause between its tries.
  • Drafts, versions and going live: the editor edits the endpoint's draft, so you can work on a route change and come back to it without touching the traffic the endpoint is serving. Going live takes three steps: Save draft, then Publish version, then Deploy that version on the Versions page. Save draft changes nothing live: requests keep using the live version. While nothing is live yet, as on a new endpoint, the editor says so above the canvas and names these steps. Above the canvas the editor says which revision of the draft it holds, which version is live, and whether the draft's content matches it; when it differs, Changes from live lists each change of the draft as saved, one sentence each, as a version's page does. Edit from a version, beside it, starts the draft again from any version not archived (the live one marked), as Edit from vN on the Versions page does: it asks first, since what the draft holds, unsaved changes included, is replaced, and nothing live changes. Publish version makes the saved draft a new numbered version, once it has no unsaved changes and holds together; a draft whose content the latest version already has makes nothing new. A published version is not live: it goes live only when it is deployed from the Versions page (or rolled back to, or through the control API), and requests already running finish on the version they started on. A draft saved in another tab since this one loaded is never overwritten: the editor says so and offers to reload it. Renaming the endpoint does not get in the way of a draft. When the editor itself has been updated, an editor left open from before is told to reload the page.
  • Versions: versions are your record of what served and your way back: when a change misbehaves, roll back to the version before it in one step. Every route that has gone live is kept as a numbered version. The endpoint's Versions page (its page, then Versions) shows which version is live, every version newest first with whether its content is the live version's, and the deployment's history: each change, by whom, from which version to which, and why. Deploy vN makes a version that has never been live serve the next request; Roll back to vN does the same for one that served before; each takes an optional reason for the history. Requests already running finish on the version they started on. Archive vN retires a version that is not live, so it can never serve again. A version's own page lists its nodes with their counts, its edges, and its providers as they were when it was made, kept after a provider is deleted. When another version is live, it also lists the changes from live, one sentence each: nodes added or removed with their settings, each setting changed (for example Output node out: model gpt-4o → gpt-4o-mini), a node whose kind changed, and edges added, removed, reordered or relabelled. Providers there are named as they are now, and one deleted since reads provider #N (deleted). Moving nodes on the canvas changes nothing there, as it mints no version; Same content as live means the version routes exactly as live does. A form from a page loaded before the deployment last changed changes nothing and says so, and a version that no longer works with your providers is refused, naming each node at fault.

API routes

Ten routes under each endpoint's /USER_ID/ENDPOINT/api/v1, all behind the bearer token of a key minted for that endpoint. A missing or unknown key is a 401 whatever the URL; with a good key, an unknown user or endpoint, another endpoint of the same account and another account's endpoint are one and the same 404. The six inference routes take POST only and are answered along the endpoint's route, whatever dialect the route speaks; the four informational routes are GETs, are not rate limited, and carry no billing headers.

  • POST /chat/completions: OpenAI Chat Completions, streamed with stream: true as data: frames ending in [DONE].
  • POST /responses: OpenAI Responses API. To an OpenAI output it goes whole and comes back as OpenAI answered, so a coding agent such as Codex keeps its conversation (see Responses conversations); to any other provider it is translated, with function tools, text formats and reasoning effort.
  • POST /responses/compact: OpenAI's compaction of a Responses conversation, answered only by OpenAI outputs, as OpenAI answered (see Responses conversations).
  • POST /messages: Anthropic Messages API, with tools, structured output and thinking budgets.
  • POST /messages/count_tokens: Anthropic's token count of a Messages body, answered only by Anthropic outputs (see Token counting).
  • POST /embeddings: OpenAI embeddings, float encoding only, answered by outputs whose provider embeds.
  • GET /models: the endpoint itself as the one model, its id the endpoint's slug and owned_by your account's public id, so SDKs that list models first find it. No provider is asked.
  • GET /key: the calling key's name, effective monthly spend cap as limit and this month's spend as usage (dollars), its bytes as usage_bytes, the slug of the endpoint it belongs to as endpoint, and the rate limit.
  • GET /credits: the account's monthly spend cap as total_credits, this month's spend as total_usage (dollars) and its bytes as total_bytes, across every endpoint and key (deleted ones included); then the calling key's endpoint as endpoint, and the key's own label, limit, usage and usage_bytes under key, as GET /key gives them.
  • GET /generation?id=: the recorded request behind a response id (gen-...), for ids this endpoint served: its status, the provider model that answered as model, the caller's model as requested_model, the route taken, token counts, latency, and the bytes_in, bytes_out and cost it was billed, where cost is its Waygate fee. A request past its retention is gone and answers not_found (see Request retention).

Translation

A request reaches an output in one of two ways. When the API it was sent to is the output's provider's own (/messages to an Anthropic output, /chat/completions or /responses to an OpenAI one), it is forwarded: its body goes as it came, fields the gateway does not know included. Otherwise it is translated: parsed into one canonical shape and rendered in the provider's dialect. Either way the answer comes back through the canonical shape in the caller's dialect, except a /responses answer from OpenAI, which comes back as OpenAI sent it. A field the canonical shape cannot carry is never dropped on the quiet in a translation: the output it would have to be translated for is skipped, and a request no output of its route can take is refused with a 400 that names the field. The exceptions are hints that change the price or the latency of an answer rather than its meaning; a translation accepts and ignores those, and they are listed here so nothing is silent.

  • Forwarded: a /messages request (and a /messages/count_tokens one, which is never translated) to an Anthropic output, with every anthropic-* header as sent: anthropic-version (in place of the gateway's own, 2023-06-01), each anthropic-beta, anthropic-workspace-id, and any Anthropic adds later, since the list is open; a /chat/completions request to an OpenAI output's Chat Completions, and a /responses request to its Responses API. What the route owns is still the route's: the output sets the model, whatever the body names, and the call carries the provider key stored with the output's credential, to that credential's address. No other header is forwarded (x-api-key and Authorization carry your gateway key, which the stored provider key replaces, so a claude.ai login cannot be passed through), and nothing in a body or a header can choose the provider, the key or the address. A /chat/completions request to OpenAI is sent the token cap as max_completion_tokens (its reasoning models refuse max_tokens, and the output, not the caller, chooses the model), and a stream asks for its usage (stream_options.include_usage) beside the caller's own stream options, since the gateway reads it; a /responses request needs neither, so only its model changes. OpenAI-compatible servers and Gemini are always translated, since each speaks only part of either dialect. The request body limit, the upstream budget and the timeouts apply as to any call.
  • What comes back from Anthropic, forwarded: what a coding agent's client reads besides the answer comes back as Anthropic sent it on a forwarded /messages or /messages/count_tokens request, buffered or streamed. Its reply headers retry-after (whole seconds, as Anthropic sends it), x-should-retry and every anthropic-ratelimit-* are on the gateway's answer, a success or an error; its other headers (request-id among them) are not, the gateway's own X-Gateway-Request-Id naming the request instead. A stream's ping events are relayed as ping events, so a long pause in which they are all Anthropic sends does not trip the client's idle timeout. An error Anthropic answers is the caller's as it came: its status, 5xx included (a 529 stays a 529, not a 502), and its body byte for byte, so a client that recovers from a refusal by its wording (Claude Code dropping a beta Anthropic named as Unexpected value(s), or retrying without a field) finds Anthropic's own words. A body that is not a JSON object, or is longer than 4 KiB, comes back in the gateway's error envelope with Anthropic's status and those headers beside it. When a route moves on past Anthropic's error (a retry, a fallback), the caller gets whatever ends the run, as ever. Nothing of this crosses a translation: a /chat/completions or /responses caller answered by Anthropic gets the gateway's envelope, OpenAI's dialect has no ping, and a /chat/completions request forwarded to OpenAI is answered in the gateway's envelope too (a /responses one gets OpenAI's own answer, see Responses conversations). A mid-stream error event is still re-encoded, as api_error with Anthropic's message.
  • When a route mixes providers: a request holding something that cannot be translated skips every output it would have to be translated for, as an output that cannot embed is skipped: not called, and judged capability_excluded by a fallback's policy, so a policy that selects it moves on and one that does not stops there. Each skip is a route event (output_excluded, naming the field), and a route that ends at one shows it: … → excluded Work OpenAI (gpt-4o) (cannot translate top_k). The request is answered by the first output it can be sent as it came; if the run reaches none, it gets the 400 that names the field.
  • Thinking: a /messages request answered by Anthropic keeps its thinking whole, so an agent's tool loop can send it back as Anthropic requires. The request's thinking setting and the thinking and redacted_thinking blocks in its history go as sent, and the answer's come back as Anthropic sent them, signatures and redacted data included, in place among the other blocks: buffered as blocks, streamed as their own content blocks, a thinking block's text as thinking_delta events and its signature as a signature_delta. Across a translation there is no faithful mapping, since no other provider reads Anthropic's signed thinking and Anthropic cannot read OpenAI's encrypted reasoning: the history's thinking blocks are left out of a request sent to another provider (its thinking budget still maps to an effort level); an Anthropic answer to a /chat/completions caller streams its thinking text as reasoning deltas and to a /responses caller as reasoning summary text, without signatures or redacted blocks, and a buffered one leaves its thinking out; and a reasoning model behind an OpenAI-compatible server streams its reasoning to a /messages caller as thinking blocks with an empty signature. On the OpenAI side nothing is lost on a same-provider call: OpenAI's Chat Completions sends no reasoning content to pass back, and a /responses conversation with OpenAI keeps its reasoning items, encrypted_content included, both ways (see Responses conversations). Translated, a Responses caller's reasoning items are left out of what is sent.
  • Responses conversations: a /responses request answered by OpenAI goes to OpenAI's own Responses API as it came and comes back as OpenAI sent it, buffered or streamed: its ids, every output item (encrypted reasoning, custom tools' and local shell calls, hosted tools' items, annotations), each event of a stream with OpenAI's own numbering. So a coding agent such as Codex works as it does against OpenAI: with store: false and include: ["reasoning.encrypted_content"] it keeps its own history and sends the reasoning items back each turn, and with store: true OpenAI keeps the conversation for previous_response_id, which then has to reach the same OpenAI provider. The gateway still reads the answer for what it records: the model, the usage (cached, written and reasoning tokens included), and whether it answered anything, so an answer with no text, no call and no compacted window is an empty reply (see Empty replies). An error of the gateway's own in a stream, after OpenAI's last event, is a Responses error event numbered after it. POST /responses/compact compacts a conversation the same way, buffered: only OpenAI outputs can answer it, so a route skips every other output (capability_excluded, cannot translate compaction) and one with no OpenAI output refuses it with a 400; the compaction item it answers with goes back to OpenAI in the next /responses turn as it came. A switch rule for responses matches a compaction too. The Responses API's WebSocket transport is not served: configure Codex with the endpoint as a custom model provider and leave WebSockets off for it, so it streams over HTTPS by server-sent events.
  • Carried in a translation: system and developer prompts, text and image parts, tool definitions (strict included), tool calls and their results, tool_choice and parallel tool calls, the text, json_object and json_schema response formats, temperature, top_p, stop sequences, the token limit, reasoning effort (Anthropic thinking budgets map to an effort level and back), and streaming with usage.
  • Ignored in a translation from /chat/completions: stream_options, service_tier and image_url.detail.
  • Ignored in a translation from /responses: metadata, safety_identifier, user, service_tier, stream_options, reasoning.summary, input_image.detail, and the output preferences include, text.verbosity and truncation.
  • Ignored in a translation from /messages: metadata and service_tier, and cache_control (see Prompt caching).
  • Prompt caching, forwarded: a forwarded request reaches the provider as its own bytes, only the members the route owns rewritten (model, and for OpenAI the token cap's name and a stream's stream_options): keys keep their order and numbers their spelling, so the provider's prompt cache sees the prefix it would see without the gateway. A /messages request to Anthropic carries every cache_control exactly where it was written, on tools, system blocks, message blocks, images, documents and tool results, and the top-level one that asks for automatic caching, with its anthropic-beta headers; a /chat/completions or /responses request to OpenAI carries prompt_cache_key, prompt_cache_retention and prompt_cache_options as written.
  • Prompt caching, translated: a marker is a cost hint, never part of what the answer means, so a translation maps it where the other provider documents the same thing and drops it otherwise. OpenAI's three hints, from /chat/completions or /responses, are dropped for Anthropic, Gemini and OpenAI-compatible servers. cache_control from /messages is dropped for OpenAI, Gemini and OpenAI-compatible servers: OpenAI and Gemini cache a repeated prefix by themselves, with no breakpoints to mark, and an OpenAI-compatible server documents nothing. No request is given a marker its caller did not write, so a /chat/completions or /responses request answered by Anthropic is not cached there: Anthropic caches only what is marked.
  • Cached tokens: every answer's usage says how many input tokens the provider read from its prompt cache and wrote to it, buffered and streamed, in the caller's dialect. On /messages, cache_read_input_tokens and cache_creation_input_tokens, which input_tokens leaves out, as Anthropic's own does; on /chat/completions, prompt_tokens_details.cached_tokens and cache_write_tokens, both counted in prompt_tokens; on /responses, the same two under input_tokens_details. The counts cross dialects: an Anthropic cache write reaches a Chat Completions caller as cache_write_tokens, an OpenAI cache read a Messages caller as cache_read_input_tokens. A count the provider did not report is 0, except cache_write_tokens, which is left out as OpenAI leaves it out. Anthropic's split of writes by lifetime (usage.cache_creation) is not passed on. Both counts are recorded: per call on a request's page in the dashboard (Cache read / write), per endpoint and model on the Usage page, and as cached_tokens and cache_write_tokens in GET /generation and in each upstream call of the control API's request detail.
  • Prompt caching and routing: a provider's prompt cache is per model, so a cache hit needs the next turn of a conversation to reach the same model as the last. A weighted split keeps every request of a task session on one branch for as long as the session runs on one route version, so a session's conversation keeps reaching the model whose cache it warmed; a request without a task session is placed afresh each time and can land on a model whose cache is cold, and a new route version places every session afresh. A fallback or hedge that moves to another model starts that model's cache cold. The gateway does not route by where a cache is warm.
  • Not translated from /chat/completions: n other than 1, logprobs, top_logprobs, logit_bias, audio, prediction, modalities, seed, frequency_penalty and presence_penalty. Each is forwarded to an OpenAI output as it came. A field the gateway does not know at all is forwarded too, and left out of a translation.
  • Not translated from /responses: previous_response_id, conversation, store: true (store: false asks for nothing the gateway would keep, so it is translated), background, prompt, top_logprobs, max_tool_calls, hosted and custom tools (anything but function tools), input items other than messages, function calls, their outputs and reasoning items (custom tools' calls, compaction items, item references), and output_text annotations. Each is forwarded to an OpenAI output as it came. A field the gateway does not know at all is forwarded too, and left out of a translation.
  • Not translated from /messages: top_k, mcp_servers, container, output_config, context_management, citations, an output_format other than json_schema, the tool fields input_examples, defer_loading, allowed_callers and eager_input_streaming. Each is forwarded to an Anthropic output as it came. A field the gateway does not know at all is forwarded too, and left out of a translation.
  • Refused with 400 on /embeddings: an encoding_format other than float.
  • Known limitations: in a translation, thinking and redacted_thinking blocks are left out both ways and echoed reasoning items on /responses are discarded (see Thinking); Anthropic structured output carries the schema only (as a strict format named output); OpenAI credentials receive max_completion_tokens while compatible servers and Gemini receive max_tokens; usage.cost is always null (it is not the Waygate fee; see Limits and billing) and stop_sequence is never reported; native_finish_reason carries the provider's own finish reason beside the translated one.

Limits and billing

Each gateway key may make 60 requests a minute and each account 600, each account may spend $3.00 a month by default, and an answered request costs $0.03 per MB of request and response beyond the free allowance, the Waygate fee. A request refused before an answer starts carries no Waygate fee; a stream that has started is billed even if it fails partway. A buffered answer's fee is shown on the Usage page and in its request detail, and a billed stream carries its own in its closing comment. What your providers charge for the calls is separate.

  • Rate limit: 60 requests a minute per key by default (a key may set a lower limit), and 600 a minute per account, all its keys together, so more keys do not buy more requests. Both are counted in one-minute windows; past either the answer identifies the key or account limit and is a 429 with Retry-After in seconds, and a request the key's limit refuses does not count against the account's. Every request to an inference route counts, one to an unknown endpoint included. The informational GET routes are outside the limits, so a client that has been told to wait can still ask why. Apart from how many start, an account may have 100 requests in flight at once, streams included; past that the answer is a 429 too_many_requests_in_flight until one finishes.
  • Free allowance: the first 100 MB of successful request and response bodies each UTC calendar month are free for every account, subscribed or not. No card is needed, and there is no base fee or subscription price. Without a subscription new requests are refused with 402 at this byte allowance, whatever the account's cap, with a message pointing at the Billing page. In-flight requests can cross it; only excess bytes carry a fee. The allowance is shared across keys, including deleted keys. The final stream cost comment and the request fee are zero inside the allowance; buffered answers carry no cost header, so the Usage page and the request's detail are where a buffered answer's cost is read. Usage shows free allowance used, billable traffic and fee separately, each size scaled to a decimal unit (kB, MB, GB, where a MB is a million bytes) with its exact byte count a hover away.
  • Subscribing: choose Subscribe in the dashboard's Billing section, which opens Polar's checkout for this account; add a payment method there and Polar brings you back to Billing, which shows Subscribed once Polar confirms it, usually within a minute. A subscription has no base fee: a month within the free allowance costs nothing, and beyond it only the bytes past the allowance are metered at $0.03 per MB and invoiced monthly. The monthly cap still applies, and a subscribed account may raise it above the default. Once subscribed, Billing offers Manage Billing instead, Polar's customer portal, for payment details, invoices and cancelling; a cancelled subscription runs to the end of its paid period, then the allowance and the default cap apply again.
  • Monthly caps: $3.00 of spend a month per account by default, counting only billed requests. Lower it any time; raising it above the default takes a subscription. A key may carry its own cap, and the lower of the key's and the account's applies. Once the month's spend reaches the cap the answer is a 402 until the month turns or the cap is raised. Caps cover Waygate fees only, never what your providers bill you. The cap is checked as a request starts, so requests already under way when it is reached finish and are billed, and a month can end over it by what those requests cost.
  • Spend notices: the dashboard warns, and the account holder is emailed at the address they signed in with, when the month's billed spend reaches 80% of the free allowance (without a subscription), of the account's cap or of a key's own cap, and again when it reaches it, with the same figures the dashboard shows and the 402 enforces. A key's email names the key and its endpoint. Each goes once per account or key, limit, threshold and month, however many requests cross it, and is sent after the request that crossed it has been answered, so a mail failure never holds one up. Raising a cap and crossing it again in the same month sends again. The email carries figures, names and links, never a prompt, a key or a provider credential. Switch the emails off under Email Notices on the Billing page; the dashboard warning stays.
  • Fee: $0.03 per MB, where a MB is a million bytes, of billable bytes beyond the free allowance in the request body read and the response body written: billable bytes × the fee, rounded up to a whole micro-dollar. Headers never count. Bytes out is the body as the caller receives it; for a stream, every frame written, its closing frames included, but not the cost comment.
  • What is billed: only an answer a provider gave with a success and the gateway passed on. A buffered answer is billed when it is sent. A stream is billed once it has begun, for what it sent, even if the provider fails partway or the caller hangs up.
  • What is never billed: errors from the gateway (401, 402, 404, 409, 413, 429 and the rest), a provider's error passed on, a 2xx from a provider that could not be read, a 2xx with no answer in it, streamed or not (see Empty replies), a route whose every output failed, an open circuit breaker's answer, a request stopped at the call limit, its upstream budget or its route deadline, the calls a decision makes to its decider, a retry's failed tries, the failed outputs a fallback moved past, and a hedge's losing call (your providers may still charge you for any of those calls). A failure before an answer starts carries no Waygate fee. An unbilled request is still listed in the usage log, with zero bytes and no fee.
  • Stream cost comment: a billed stream writes the final figures as an SSE comment, : gateway-cost bytes_in=… bytes_out=… cost=…, just before its last event ([DONE] on Chat Completions, message_stop on Messages, response.completed on a translated Responses stream), or as its last line when it ends without one or is relayed as OpenAI sent it. Comments are lines beginning with a colon, which every SDK skips, so read the raw stream to see it. A caller that has hung up gets none.
  • Invoices: only bytes beyond the free allowance are metered through Polar and invoiced monthly. Polar prices the exact byte total, while each recorded request rounds its own fee up to a micro-dollar, so an invoice can come to a little less than the request fees on the Usage page added up, never more. The pricing page's calculator rounds a month's total the same way an invoice does, so the request fees that caps and the Usage page add up can come to slightly more than its estimate.
  • Credits: GET /credits reports the cap as total_credits and this month's spend as total_usage, in dollars, with its bytes as total_bytes, and GET /key does the same for one key. The provider bills you for tokens directly.
  • Request size: a request body may be up to 20 MiB; a larger one is refused with a 413 in the caller's dialect, without being read to its end.
  • Request retention: each request in the usage log, with its upstream calls, route version, route events and trusted scope, is deleted 90 days after it arrived. From then on it can no longer be opened by id (the dashboard's request page, GET /requests/gen-... on the control API and GET /generation?id= all answer not found). What a month cost is kept: monthly spend, caps, GET /credits and GET /key and the invoices read monthly totals, which the deletion never touches.
  • Request log download: the Usage page downloads the retained request log as CSV, every endpoint or one, every retained month or one (UTC), oldest first. Each row is one request's metadata, never its prompt or reply: time, endpoint, request_id, api, route_version, status, error_class, requested_model, the model and provider that answered, route, the trusted customer and feature, streamed, latency_ms, the four token counts (blank where the provider reported none), bytes_in, bytes_out, fee_usd and fee_state (billed, waived or not charged). A field that starts with =, +, - or @ is written with a leading apostrophe, so a spreadsheet opens it as text and never runs it as a formula.

Response Headers

HeaderDescription
X-Gateway-Bytes-InThe request body's length in bytes. On every billed answer, buffered or streamed.
X-Gateway-Bytes-OutThe response body's length in bytes. On billed buffered answers.
X-Gateway-Cost-Finalstream: on a billed stream, whose cost is not known until it ends. The figures come in its closing comment.
X-Gateway-Request-IdThe request's id (gen-...), as its reply's id and the usage log carry it. On every answer from an inference route, errors included, so a refused request can be quoted too.
X-Gateway-Route-VersionThe number of the endpoint's route version that served the request, once one was chosen: each request is served by the version live when it arrived, start to finish, even if another is deployed meanwhile. For reading only; it never steers a request.

Task sessions

Use a task session when one piece of work spans many requests and you want it tracked as one unit: the requests belonging to an agent run or support ticket, its deadline, and the customer it was for, rather than a pile of unrelated requests. A task session is one piece of work your backend is doing for someone, a support ticket or an agent's run, made for one of your endpoints before its requests are sent, so that they carry who they are for, stop at a deadline or when the work is closed, stay on one route version. Your backend makes it with a control token holding sessions:write, and your requests present it in the X-Gateway-Task-Session header. Requests that send no such header are answered as ever.

  • Making one: POST /task-sessions with {"endpoint_id": "ep_...", "external_id": "ticket-4711"}, your own id for the work (1 to 200 printable characters, no spaces), unique per endpoint, and optionally key_id (the one key of the endpoint that may present it), customer and feature (1 to 128 letters, digits and . _ : -), deadline (an RFC 3339 time). It is answered 201 with the session, its id tsk_ and 12 characters. Sending the same external_id with the same body again answers that session, 200, so a backend can retry a create safely; with a different body it is a 409 task_session_conflict, and nothing is written.
  • Presenting it: send X-Gateway-Task-Session: tsk_... with each request of the work. An id that is malformed or unknown, another account's, another endpoint's, or held to another key is the one 400 task_session_invalid, whichever it is, and nothing is sent. A session closed, or past its deadline, is a 422 task_session_closed: no call starts under it, and a route whose session closes or reaches its deadline between two of its calls stops there. A call already sent finishes, and is charged.
  • Its route version: a session is pinned to the stable version when it is made. After a deploy or rollback, its next request revalidates against the new stable version, moving its pin if accepted or returning 409 session_migration_required if refused. A session made with nothing live is pinned by its first admitted request. GET /task-sessions/tsk_... exposes the pin and revalidation_due.
  • When the live version changes: any change of what serves, a deploy or rollback, revalidates every session pinned to a version that no longer serves, and none moves silently. Nothing is written when the version changes: the session's next request is checked against the stable version and, when it takes the request, moves the session there (reason revalidated) and is answered by it. When the stable version refuses it before any call, for its route (endpoint_route_invalid) or an unsupported adapter operation, the request is a 409 session_migration_required naming both versions and the reason, nothing is called and the session keeps its version; send a request the stable version takes, or close the session and start a new one for the work. A request already running finishes on the version it started on.
  • Customer and feature: a request's customer and feature are never what the request says: no header and no body field (user, metadata) sets them. They come only from its backend-created task session. Requests without a task session have no customer or feature. Keys do not bind labels or require a task session.
  • Closing it: POST /task-sessions/tsk_.../close with {"state": "completed"} or "cancelled". A session already closed is answered as it is, so a close sent twice is one close.
  • Moving work to another customer: a session's customer, feature, endpoint, key and external id never change. Work that moves to another customer is a new task session; there is no way yet to link the two.
  • Deleting: deleting a session's key or endpoint deletes the session. Its requests keep their customer and feature, the session no longer named.

Provider health

When requests start failing, provider health tells you whether the trouble is yours or your provider's: it shows how each provider and model has been doing for your traffic. The dashboard's Health page, and the control API's GET /health, show how your own production requests' calls to each of your provider records and models have gone over the last 15 minutes, hour and 24 hours. It is read from the calls Model Waygate recorded for you as you ask, and nothing of any other account's is read or shown.

  • Which calls: every call your production requests made, to an output or to a decider, by when it ended (a call ending exactly 15 minutes ago is in the hour, not the 15 minutes). A call of a request that arrived more than 60 minutes before the 24 hours began (a stream that ran that long) is left out.
  • Attempt classes: each call is one of answered, provider_error, protocol_error, empty_reply, timeout, output_timeout, incomplete_stream, rate_limited, auth_refused, client_error, cancelled, gateway_error. answered is an answer; provider_error a 5xx; protocol_error an answer the provider's API does not promise (a 2xx that is not JSON, a stream that was not an event stream, a redirect); empty_reply a 2xx, buffered or streamed, with no answer in it (see Empty replies); timeout no answer within the gateway's own limits, or a refused or dropped connection; incomplete_stream a stream the provider broke after it began; rate_limited a 429; auth_refused a 401 or 403; client_error another 4xx; output_timeout a call your output's own timeout ended; cancelled a caller who left; gateway_error the gateway's own fault.
  • The failure share: provider_error, protocol_error, empty_reply, timeout and incomplete_stream are the provider failing; answered and those are the eligible attempts, and the failure share is the one over the other, with its Wilson 95 % interval. Your own rate limits, refused keys, other 4xx answers, your outputs' own timeouts (which you set, from 1 second), callers who left and the gateway's own faults are listed but never counted as the provider failing, nor as eligible: a storm of 429s from your own quota leaves the share as it was.
  • No evidence is not zero: a window with no calls says "no attempts in this window" (evidence none), never 0 %, and a window with calls but none eligible has no failure share at all (null). A window starting before the call ledger began recording is marked.
  • Latency: first-token p50 and p95 over the calls whose stream sent a first token, and duration p50 and p95 over the answered calls, in milliseconds; the incomplete-stream share is over the calls that streamed.
  • Deleted provider records: calls keep the provider record they went to, so a record deleted since reads provider #N (deleted).

Errors

Errors come back in the dialect of the API route you called: OpenAI's error object on /chat/completions, /responses, /embeddings and the GET routes, Anthropic's on /messages and /messages/count_tokens. The status and code are the same in both. A provider's own 4xx passes through with its status; any other failure of the provider's is a 502 carrying what it sent. The exception is Anthropic answering a forwarded /messages or /messages/count_tokens request, whose error is answered as it came, status and body (see Translation). When a fallback has tried every child, the error is the last child's. An internal failure carries a request id to quote.

Error Responses

StatusErrorDescription
401invalid_api_keyThe bearer token is missing or unknown, the key is disabled, or its account is suspended. Listed in usage under auth.
429rate_limit_exceededMore requests this minute than the key's rate limit, or its account's, allows; Retry-After says when to try again. Listed in usage under rate_limit.
429too_many_requests_in_flightThe account already has 100 requests in flight, streams included, the most it may have at once; Retry-After: 1 asks for a second's wait, and any one finishing makes room. Not billed. Listed in usage under rate_limit.
400invalid_request_errorThe body could not be parsed, or asks for a field the gateway cannot translate and no output of the route speaks the request's API; the message names the field. Listed in usage under parse.
400invalid_request_errorThe same 400, when the route did have an output speaking the request's API but the request never reached one: every output it came to would have needed a translation the field does not survive. The route taken ends `excluded … (cannot translate field)`. See Translation. Listed in usage under unsupported.
404not_foundThe URL names no endpoint this key may use: an unknown user or endpoint, another of the account's endpoints than the key's own, or another account's, all answer alike. A request id the endpoint did not serve is not found either. Listed in usage under not_found.
402insufficient_quotaThe account's or the key's monthly cap is reached, or an unsubscribed account has used its free allowance; the message says which, and for the allowance names the Billing page to subscribe on. Listed in usage under cap.
400unsupported_parameterThe provider behind this credential cannot do what the request asks. Listed in usage under unsupported.
502upstream_errorThe provider answered with an error. Its own 4xx passes through with that status; anything else is this 502, carrying the provider's body, cut to 4 KiB and marked [cut] if it was longer. A `/messages` request forwarded to Anthropic is answered instead with Anthropic's own error as it came: its status, 5xx included, its body, and its retry and rate-limit headers (see Translation, What comes back from Anthropic). Listed in usage under upstream.
502upstream_errorThe provider answered 2xx with a body its API does not promise, so there was nothing to translate. Listed in usage under upstream.
502empty_replyThe provider answered 2xx with a reply that held no answer: no text and no tool call, and a finish other than the request's own token limit, a content filter or a refusal; the message gives the provider's finish. A retry tries it again and a fallback moves on. Not billed. A stream that ends so has already begun, and ends with an error event carrying this message instead. See Empty replies. Listed in usage under empty_reply.
502upstream_unreachableThe provider could not be reached, dropped the connection before answering, did not start answering or finish a buffered answer in time, or its address is a private or local one, which the gateway does not call. Listed in usage under unreachable.
503circuit_openA circuit breaker in front of the output was open, so the output was not called, and nothing after it answered; the message names the breaker, and Retry-After says in how many seconds it lets a test request through. Not billed. Listed in usage under circuit.
429concurrency_limit_reachedEvery place of a concurrency limit in front of the output was in use, so the output was not called, and nothing after it answered; the message names the limit and how many requests at once it allows. Nothing waits for a place: back off and try again, as Retry-After: 1 says, or put a fallback above the limit. Not billed. Listed in usage under concurrency.
503concurrency_limit_unavailableA concurrency limit's count could not be read from the gateway's database, so the limit refused rather than let an unknown number through, and nothing after it answered. Quote the request id in the message when reporting it. Not billed. Listed in usage under concurrency.
503concurrency_lease_lostA call through a concurrency limit could not renew its hold on its place, so the gateway stopped it before it answered; a fallback above moves on, and a stream already under way ends with an error event instead. Not billed. Listed in usage under concurrency.
405method_not_allowedThe inference routes take POST only. Listed in usage under method.
413request_too_largeThe request body is over the gateway's limit of 20 MiB, and was refused without being read to its end. Listed in usage under too_large.
409endpoint_not_readyNo version of the endpoint is live yet: its input connects to nothing, as one started on the input alone does, or no version has been deployed. Draw its route and save the draft, publish it as a version, then deploy that version from Versions. Listed in usage under route.
409endpoint_route_invalidThe endpoint's live route does not hold together against the account's providers as they are now; the message lists the first 5 problems. Open it in the editor, fix it and save the draft, publish the fix and deploy it from Versions. Listed in usage under route.
502route_cap_reachedThe route needed more than 32 upstream calls for one request, deciders included, so it stopped; the message carries the last failure. Listed in usage under route.
502egress_budget_reachedThe next call, output or decider, would have taken the requests sent upstream for this one request past 64 MiB, so it was not sent and the route stopped. Listed in usage under egress.
504route_deadline_reachedThe route was still running 15 minutes after the request arrived, so no further call started. Listed in usage under route.
400unsupported_parameterThe provider cannot perform the requested operation, such as embeddings on an Anthropic output. Nothing was called. Choose a provider supporting that operation. Listed in usage under unsupported.
400task_session_invalidThe X-Gateway-Task-Session header names no task session the key may present on this endpoint: malformed, unknown, another account's, another endpoint's, held to another key, all answered alike. Nothing was sent. See Task sessions. Listed in usage under task_session.
422task_session_closedThe request's task session is closed or past its deadline, so no call was started under it; one already sent finished. Not worth retrying: start a new task session for new work. Listed in usage under task_session.
409session_migration_requiredThe request's task session is pinned to a version that no longer serves the endpoint (a deploy or rollback moved past it), and the stable version refuses this request before any call (its route); the message names both versions and the stable version's reason. Nothing was called and the session keeps its version. Close the session and start a new one for this work, or send a request the stable version takes, which moves the session to it. See Task sessions. Listed in usage under task_session.
500internal_errorThe gateway itself failed. Quote the request id in the message when reporting it; the detail is in the gateway's log under that id. Listed in usage under internal.

Control API

Use the control API when a program rather than a person at the dashboard manages Model Waygate: deploying route versions from CI, opening task sessions from your backend, keeping your routes as code in your own repository. A JSON API for your endpoints, their routes and your requests, under /api/control/v1 on this gateway, not under an endpoint. v1 is stable (see Compatibility). A program signs in with a control token, minted on the dashboard's Tokens page; in a browser where you are signed in, the dashboard's session works too. A gateway key is not a way in; with neither a token nor a session every route is a 401.

  • Control tokens: a control token lets a script or service act on your account without anyone's browser session, and holds only the scopes you grant it, so a leaked one can do no more than you allowed and can be revoked alone. Send one as the bearer token, Authorization: Bearer mwc_... A token is minted on the dashboard's Tokens page, which shows its secret once and never again (the list keeps its first 12 characters), and is revoked there; a token cannot mint another. It holds the scopes you give it: read (every GET here), endpoints:write (drafts, validate, publishing and archiving versions, capability evidence), deployments:write (deploy and roll back), sessions:write (task sessions). A request that sends an Authorization header is signed in by that token alone, never by a session beside it: a revoked or unknown token, a gateway key, or any other value is a 401 unauthenticated. A route the token lacks the scope for is a 403 insufficient_scope, before anything is read or written. A token may be restricted to one endpoint: it then lists and reaches that endpoint and its requests alone (another endpoint is the same not_found as one that does not exist), and everything that belongs to the whole account (capabilities and evidence, the audit log) is a 403 insufficient_scope. Each token may make 600 requests a minute; past that it is a 429 rate_limited until the next minute. Every write a token makes names it as token:ctk_... (its id, never its secret) wherever a write names its author or actor.
  • GET /audit-events?action=&resource=&limit=&cursor=: your account's audit log, newest first, paged like endpoints: each event's id (aud_ and 12 characters), actor (your email, or token:ctk_... for a token), action, resource, idempotency_key, metadata (what it set, never a secret) and created_at. Actions include token_minted, token_revoked, task_session_created or task_session_closed. action and resource narrow the list. It needs read over the whole account; a token restricted to one endpoint is refused. Events are never changed. Deployments and capability evidence keep their own history.
  • GET /endpoints?limit=&cursor=: your endpoints, oldest first, as {"data": [...], "next_cursor": ...}. Each has its id (ep_ and 12 characters, the same for the endpoint's life whatever it is renamed to), slug, name, url (the API root to give an OpenAI SDK), created_at and updated_at. limit is 1 to 200, 50 when left out. Pass next_cursor back as cursor for the next page; it is null on the last one. A cursor stays good after the endpoints before it are deleted.
  • GET /endpoints/ep_...: one endpoint, as the list gives it.
  • GET /endpoints/ep_.../draft: the endpoint's draft: its revision, base_version (the version it was copied from or published as), author, updated_at, content_hash, graph, and problems, what stops it compiling against your providers now (by node or edge; empty when it compiles). The ETag header is "r" and the revision, in quotes.
  • PUT /endpoints/ep_.../draft: save {"graph": ...} as the draft, with If-Match set to the ETag you read it with. The graph must compile against your providers; otherwise a 422 validation_failed names each node or edge and leaves the draft and its revision unchanged. Nothing live changes. Without If-Match it is a 428, and with an ETag the draft has since moved past a 412: read it again.
  • POST /endpoints/ep_.../validate: validate the supplied graph, or the draft when omitted, against your providers without writing.
  • POST /endpoints/ep_.../versions: publish the draft as a version, with {"draft_revision": ...} naming the revision you read: 201 with a new version, or 200 with the latest when it already has the draft's content. Nothing is deployed. A draft that does not compile is a 422 naming each node or edge (graph.nodes.<id>, graph.edges.<place>); a revision the draft has moved past is a 412.
  • GET /endpoints/ep_.../versions?limit=&cursor=: the versions, newest first, paged like endpoints. Each has its number, content_hash (sha256: of its routing content, node positions left out), origin (created or published, or backfill or compatibility on a version from before drafts were the only way to save), author, created_at, archived_at, archived_by, archive_reason, serving (it is live) and same_as_live (its content is the live version's).
  • GET /endpoints/ep_.../versions/3: one version whole: also its graph, the providers it named as they were when it was published (kept after a provider is deleted), its node_counts, the passes through each node while it served.
  • POST /endpoints/ep_.../versions/3/archive: retire a version, so it can never be deployed or rolled back to again. The live version cannot be archived (409); an archived one is answered as it is.
  • GET /endpoints/ep_.../deployment: which version is live: revision, state (unconfigured or stable), stable_version and updated_at. The ETag carries the deployment revision.
  • GET /endpoints/ep_.../deployment/events?limit=&cursor=: the deployment history, newest first: revision, previous_revision, action, from_version, to_version, actor, reason, evidence_ids and created_at. Entries are never changed.
  • POST /endpoints/ep_.../deployment/transitions: {"action": "deploy", "version": 3, "expected_revision": 5, "reason": "..."}, or the same with "action": "rollback", makes the version live from the deployment revision you read, and answers {"deployment": ..., "event": ...}. A rollback goes back to a version that served before. A revision the deployment has moved past, an archived version, or a rollback to a version that never served is a 409 conflict; a version that no longer compiles against your providers is a 422; any other action is a 400, and so is a reason over 500 characters. Asking for the version already live, at the current revision, changes nothing and answers "event": null; at a stale revision it is a 409 conflict like any other. Requests already running finish on the version they started on; the next one uses the new version.
  • Idempotency-Key: every write may carry one, 1 to 255 printable characters with no spaces. Sending the same request again with the same key (the same path, If-Match and body) answers exactly what the first did, ETag included, and does nothing more; the same key with a different request is a 409 idempotency_conflict. A key is kept for 7 days, for its own write and path only, and only when the write succeeded, so a request refused with a 412 or a 409 can be retried with the same key.
  • GET /requests/gen-...: one request, by the id its reply carried: its api, status, error_class, route, latency_ms and created_at; its waygate_fee (billed, waived, bytes_in, bytes_out and amount_microusd); its upstream_calls, each with the adapter build it went through; and its route_version, the endpoint's route version that served it (number, content_hash and the deployment_revision that had made it live), kept after the endpoint is deleted, or null for a request refused before a version was chosen. Its route_events explain fallback decisions and concurrency refusals, in order, with seq, kind, node, role, credential, model and detail. route_events_covered is false for a request from before route events were recorded. task_session_id, customer and feature are the request's trusted scope, supplied by its backend-created task session. A request past its retention is gone and answers not_found (see Request retention).
  • GET /capabilities?credential=&model=&limit=&cursor=: where each of your destinations stands on every capability, paged like endpoints. A destination is one of your providers (credential, its id) and a model: one item per provider with model null (whatever model it is asked for), then one per model your endpoints name, as an output or a decider, in a draft or in any version not archived. Each item gives the provider (kind, name, host), the adapter build that speaks to it (as anthropic/r1), and for each capability (image_input, tools, tool_choice, parallel_tool_calls, strict_tools, json_object, json_schema, strict_json_schema, reasoning_effort, stop_sequences, streaming, embeddings, context_window, max_output_tokens, region, zero_retention) its status, supported, unsupported, unknown or stale, its source (adapter or customer), and when your own declaration is what it rests on, that declaration's evidence_id, value, declared_by, tested_at, expires_at and stale_because. A feature the adapter refuses or would leave out is unsupported whatever you declare. Otherwise your newest declaration about that model counts, or failing one, your newest about every model of the provider; with neither, streaming and stop sequences are supported wherever the adapter sends them, and everything that depends on the model, or on the provider (context window, region, retention), is unknown, never assumed. A declaration past its expires_at is stale (stale_because expired). credential narrows the list to one provider, and credential with model gives that one pair whether or not an endpoint names it; another account's provider is the same not_found as one that does not exist.
  • POST /capabilities/evidence: declare what one of your providers supports, as {"credential": 7, "model": "gpt-4o", "capability": "json_object", "result": "supported"}, answered 201 with the declaration (its id is cev_ and 12 characters). Leave model out, or null, to speak for every model of the provider. Give the value in the one field the capability takes: result (supported or unsupported) for a request feature and zero_retention, amount (tokens, from 1) for context_window and max_output_tokens, region (a lowercase code such as eu or us-east-1) for region; any other field is a 400 naming it. Optional: note (up to 500 characters) and expires_at, after which the declaration is stale; without one it stays in force until you retract it or declare again. A declaration is your own word, labelled customer everywhere and never shown as verified: the gateway does not test it. Declarations are never edited: declare again to replace one, and the newest counts. Another account's provider is the same not_found as an unknown one.
  • POST /capabilities/evidence/cev_.../retract: withdraw a declaration, answered 200 with it, retracted_at and retracted_by filled in; your previous declaration about the same thing, if any, counts again. Retracting one already retracted answers it as it is. Deleting a provider keeps its declarations as history, with credential null and the provider's kind and host as they were; they never count again, even for a provider made later with the same name.
  • POST /task-sessions: make a task session for one of your endpoints, as {"endpoint_id": "ep_...", "external_id": "ticket-4711"}, with key_id, customer, feature and deadline optional; any other field is a 400 naming it. It needs sessions:write. Answered 201 with the session: its id (tsk_ and 12 characters), endpoint_id, key_id, external_id, customer and feature (exactly as supplied when the session is made), state (open, completed or cancelled), deadline, created_by, created_at, closed_by, closed_at and assignment, the route version it is pinned to (null until it is pinned; see Task sessions). The same external_id on the same endpoint with the same body answers that session 200; with another body it is a 409 task_session_conflict. An endpoint that is not yours, or not the restricted token's, is the not_found of an unknown one; a key_id of another endpoint or nobody's, a 400 naming it. It takes an Idempotency-Key like every write, and is in your audit log. See Task sessions.
  • GET /task-sessions/tsk_... and POST /task-sessions/tsk_.../close: one session as it stands, with read; and, with sessions:write, its close, as {"state": "completed"} or "cancelled", answered 200 with the session closed, or as it is when it was closed already. Another account's session, or another endpoint's for a restricted token, is the not_found of an unknown one.
  • GET /health?limit=&cursor=: your account health (see Provider health), with read, over the whole account (a token restricted to one endpoint is a 403 insufficient_scope): as_of, coverage_from (when the call ledger began, or null), unended (calls of the last 24 hours with no end, in no window), next_cursor, and providers, one per provider record and model, ordered by record then model and paged by limit (1 to 100, 50 when left out) and cursor. Each has its provider (id, name, or provider #N (deleted) when deleted since, kind, deleted), model, and windows for 15m, 1h and 24h, each with from, to, covered (false when it starts before coverage_from), attempts and evidence: none and nothing more with no calls; otherwise classes (every attempt class, zero included), eligible, failure_share (value, low, high, method wilson_95; null with nothing eligible), streamed, incomplete_stream_share (null with nothing streamed), first_token_ms and duration_ms (p50 and p95, or null) and newest_attempt_at.
  • Upstream calls: every call the request made to a provider, numbered from 1 in the order they were made: each try of an output and each decider, with its role, node (the node's id, as route events name it), the provider as it was at the time (kind, name and host), model, started_at, first_token_at (streams), ended_at, outcome, upstream_status, error_class, stream_end and usage. Token counts a provider did not report are null, with usage.source not_reported, or incomplete for a stream that did not finish. capture says whether the calls are known: recorded, missing (the request came after recording began but its calls were not written), or before_coverage (the request is from before coverage_started_at); only a recorded request lists them.
  • Errors: every refusal is {"error": {"code", "message", "request_id", "details"}}. Codes include not_found, unauthenticated, insufficient_scope, rate_limited, invalid_parameter, invalid_body, invalid_cursor, conflict, idempotency_conflict, precondition_failed, precondition_required, validation_failed, task_session_conflict, cross_site, payload_too_large, method_not_allowed, unsupported_media_type and internal. request_id is a ctl-... id to quote; details names the field, header or query parameter at fault. Another account's endpoint or request is the same not_found as one that does not exist. Requests from another site are refused as cross_site, bodies over 1 MiB as payload_too_large.
  • Money and time: amounts are whole micro-dollars (millionths of a dollar); times are RFC 3339 in UTC.
  • Export and restore routes: download all live routes from the Endpoints page, or make one call: curl -H 'Authorization: Bearer mwc_...' https://modelwaygate.com/api/control/v1/routes/export -o routes.json. This needs account-wide read; endpoint-restricted tokens get 403. The download is one consistent snapshot, without pagination: {"format_version":1,"endpoints":[{"id":"ep_...","slug":"main","name":"Main","live":{"number":1,"schema_version":1,"content_hash":"...","graph":{...}}}]}. Every endpoint is included; live is null when none is deployed. Drafts and undeployed versions are excluded. Each graph uses the published graph schema in docs/control-api-v1.schema.json (graph); its number and hash identify the immutable live version. No provider secrets or gateway keys are included: credential numbers in output and decider targets reference your provider records. To restore, create the destination endpoint in the dashboard, GET its draft for the ETag, PUT {"graph": <exported live.graph>} to /endpoints/ep_.../draft with that If-Match, POST /endpoints/ep_.../versions with draft_revision set to the returned draft’s revision, then deploy the returned version through /deployment/transitions using the current deployment revision. Writes require their usual scopes and Idempotency-Key. On the same account with unchanged provider references the published content hash is identical. On another account, first add provider credentials and replace the graph's credential references with the new record ids; that changes the hash. Keys must be created separately.
  • Compatibility: v1 is stable. Within v1 changes are additive only: new operations, new optional request fields, new response fields and new enum values, so accept response fields and enum values you do not know. Nothing is removed, renamed, retyped or made stricter within v1. A breaking change ships as /api/control/v2 alongside v1, announced ahead in the release notes, and v1 keeps answering. The wire shapes are published as a JSON Schema, docs/control-api-v1.schema.json, and the gateway's own test suite fails any change to it that is not additive.

Known limits

What the gateway does not do, or does in a way you might not expect, stated here so none of it is a surprise.

  • Junk in an event stream: a stream is committed as soon as a provider answers 2xx with an event stream, so a provider that then sends something other than its events is relayed as it goes: the caller's stream ends with an error event (empty_reply, unbilled, when nothing of an answer came through), and no fallback is tried. A 2xx that is not an event stream at all is refused before anything is sent, and a fallback moves on.
  • Large replies: a provider's buffered reply over 64 MiB is refused as unreadable (unbilled, and a fallback moves on), and a single stream event over 8 MiB ends the stream with an error event, billed for what was sent.
  • Provider error bodies: a provider's error is passed on cut to its first 4 KiB, marked [cut], whether it came as a reply or partway through a stream.
  • Timeouts: a provider has 2 minutes to start answering, and a buffered answer must be finished 5 minutes after it was asked for; past either it counts as unreachable and a fallback moves on, so an answer slower than that must be streamed. An output may set a shorter timeout of its own (see Routing). A stream that sends nothing for 2 minutes, or is still running 60 minutes after it began, ends with an error event, billed for what it sent. No call starts 15 minutes after the request arrived.
  • Deciders: a decider that explains itself rather than answering with a bare label ("I would pick code") matches nothing and takes the default. A very long conversation reaches the decider as its system prompt and latest turns only.
  • Reasoning models as deciders: a model that thinks before it answers (o4-mini, gpt-5-mini, Gemini 2.5 Flash and the like) spends its thinking from the decider's 1,024 tokens, so it is slower and costs more on your key, and one that thinks past the budget answers nothing and takes the default: the route taken then reads decision default (empty answer). A small model that does not reason decides faster.
  • Tool calls: tool-call arguments are passed through to the provider.
  • Forwarded requests: on /messages and /chat/completions only the request is forwarded as it came (see Translation); its answer still comes back through the gateway's canonical shape (a /responses answer from OpenAI comes back as sent, see Responses conversations). A buffered Anthropic answer holding a block that shape has no part for, the server tool blocks mcp_servers or a server tool such as web search answer with, is unreadable (protocol_error, unbilled, and a fallback moves on); a stream leaves such blocks out. A field the gateway does not know is forwarded to an output speaking the request's API, and left out of a translation for any other, so a mixed route skips nothing for it.
  • Spend cap: checked as each request starts, so requests in flight when the cap is reached still finish and are billed.
  • Unknown endpoints: a request with a good key to a URL that names any endpoint but the key's own counts against the key's and the account's rate limits and is listed in the usage log, with no endpoint.
  • Route editor: the JSON tab cannot be edited. While two of a decision's options carry the same label, the edge for that label shows on the first of them; a route with repeated labels cannot be saved, so this lasts only until one is renamed.

Coding-agent compatibility

Fixture checks only; no live client certification or paid provider calls. Gateway credentials are replaced with stored provider keys.

ClientDialectCarriedNot supportedLast checked
Claude Code (BYOK)Anthropic Messages → Anthropicx-api-key gateway auth; every anthropic-* request header (version, beta, workspace-id and any added later); system/tool cache markers; future body fields; token counting; streamed thinking and tool-result history through retry then fallback; the retry-after, x-should-retry and anthropic-ratelimit-* reply headers; ping events; Anthropic error status and body as senta mid-stream error event is re-encoded as api_error, keeping the Anthropic message; claude.ai OAuth forwarding is outside BYOK support2026-11-27
Codex (HTTP)OpenAI Responses → OpenAI ResponsesBearer gateway auth; the request bytes with only the model replaced (store, previous_response_id, include, encrypted reasoning history, custom tools, future fields); answers, SSE events and errors as OpenAI sent them; /responses/compact; through retry then fallbackWebSocket transport (Codex streams over HTTPS instead); to a provider other than OpenAI, encrypted reasoning is left out and custom tools, server-side state and compaction are refused2026-11-20

Support and refunds

Email support@modelwaygate.com for support. We reply within two working days.

We refund any Model Waygate charge on request within 30 days of the charge, no questions asked. To ask for a refund, email support@modelwaygate.com from your account's email address. Refunds go back through the original payment method.

Ready to get started?

Create Your API Key