Routing guide

Choose a model route, keep sessions stable and understand safe failover.

Model routes

Administrators publish model routes in Model management → Model routes. Customers select route names such as coding in the model directory and API key model limits, then call that name without configuring provider routes.

  • Platform and project pools share one routing engine. Project pools keep their alias/name namespace and project permissions.
  • Text generation pools reuse the gateway’s OpenAI, Responses, Anthropic and Gemini adaptors. Every candidate must support the request’s capabilities; media jobs are not text pools.
  • Send a stable Session-Id per conversation. Without an explicit session identifier, the route is fixed per API key and pool. Bindings are tenant-isolated and survive restarts.
  • Existing sessions stay on the same model and channel. A permitted fallback is saved after upstream output is accepted. Removed targets and expired provider-bound continuations do not silently migrate.
  • Session bindings also pin the upstream credential by fingerprint, including multi-key channels. Reordering keys does not change the account. Disabled or replaced credentials cannot be used for provider-bound continuations.
  • After upgrading an older binding without a credential fingerprint, start a new session with full context before using provider-bound continuation IDs. Plain requests can initialise the fingerprint safely.
  • New-session strategies use configured order, recent stability, average latency or comparable published-price estimates. Fewer than 20 recent samples or tiered/incomparable prices use configured order. Cost estimates compare 1K input and 256 output tokens, not a guaranteed bill.
  • Stable routes help preserve prompt cache opportunities. Cache availability and retention remain controlled by each provider; the gateway does not manufacture cache hits.
  • Pool performance statistics count individual upstream attempts, including failed primary attempts; billing still settles once for the final model.
export AI_BASE_URL='https://easyrouteapi.com'
export AI_API_KEY='YOUR_API_KEY'

curl "$AI_BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $AI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Session-Id: YOUR_STABLE_CONVERSATION_ID" \
  -d '{
  "model": "coding",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ]
}'

Project model routes

Open Model routes → Custom routes, select a project and create an alias/name identifier with up to three approved models. You can also open this editor while creating an API key. Routes are shared by every key in that project; changes affect those keys. Call the route ID in the model field. Concrete model names keep their existing behaviour.

  • The platform tries eligible channels for the current model before advancing to the next approved model. The platform attempt limit may stop the request before all models are tried.
  • API key model restrictions apply to each actual model. Unauthorised fallback models are excluded, and a forbidden primary model rejects the request.
  • Billing uses the actual model’s published price. Usage logs and the X-GAE-Resolved-Model response header identify the selected model.
  • Requests with tools, structured output, multimodal input or provider-bound state keep a fixed model after dispatch. Timeouts and output already written are not replayed.
export AI_BASE_URL='https://easyrouteapi.com'
export AI_API_KEY='YOUR_API_KEY'

curl "$AI_BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $AI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Session-Id: YOUR_STABLE_CONVERSATION_ID" \
  -d '{
  "model": "alias/customer-support",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ]
}'

Existing provider-group retries

Provider-group retries are a separate legacy project setting for retrying the same model across approved groups. They are not required to call a published model route. Model routes and project custom routes use the shared pool engine across supported text protocols.

Configure approved groups

Only configure approved groups if you maintain a legacy project retry policy. A fixed-group key stays within its group; cross-group retries need an eligible Auto key and platform permission. Choosing a model route never expands the key’s group or model permissions.

Example: a fixed model

Call a concrete model ID when the model must remain unchanged. The platform may retry eligible channels serving that same model, but it does not replace the concrete model with a different model route.

Example: an approved fallback

Call an enabled route ID and keep Session-Id stable per conversation. If a plain text request receives an eligible 429, 502 or 503 before output starts, policy may try an approved alternative. Strict sessions stop instead. The platform attempt limit and permissions still apply.

Example: stop instead of replay

If a stream has started, a timeout leaves execution uncertain, or a request depends on tools, structured output, multimodal input or provider state, automatic cross-model replay stops. Return the error to the application and inspect Usage Logs; do not promise seamless switching for every request.

Retry boundaries

Eligible upstream failures are HTTP 429, 502 and 503 when platform policy allows retry. Timeouts, uncertain execution, tool requests, cancellation and requests that have started returning output stop automatic replay.

Region & model restrictions

Routing cannot expand key or payer permissions. Existing channel model mappings still apply. Group names alone do not prove EU data residency; verify provider contracts, deployment regions and channel configuration.