Aller au contenu

API console: routing

Cette page est générée à partir de server/api/openapi.yaml. Son contenu est en anglais ; ne la modifiez pas à la main.

Routing policy of the active organisation and its API key overrides (V3 R1). Handlers: internal/console/routing.

Routing policy of the active organisation

operationId routingGetPolicy · auth: orgSession

The organisation default, every API key override and the platform defaults they fall back to. Requires the manage-organisation permission (owner or admin).

Status Meaning Body
200 OK application/json RoutingPolicyOverview
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — RoutingPolicyOverview

  • org_default (RoutingPolicy, required)
    • api_key_id (string, required, nullable) — null for the organisation default.
    • sort (“default” | “price” | “latency” | “throughput” | null, required, nullable) — Provider ranking: default = priority and weight; price = cheapest first; latency = lowest time to first token; throughput = fastest output. null inherits.
    • fallback_models (array of string, required, nullable) — Models tried in order when every provider of the requested model failed before the response started (5xx, timeout, 429, upstream 401/403). [] = no fallback. A request’s own “models” list wins. At most 16; relay.max_model_chain bounds what is used.
    • ignore_providers (array of string, required, nullable) — Provider tags never routed to; a request can add to the list but not remove from it. [] lifts the organisation list (API key override only).
    • auto_models (array of string, required, nullable) — Candidate pool of model “auto” when the request sends no “models” list. null = every model the key may use on the endpoint. 1 to 32 entries.
    • auto_preference (“balanced” | “quality” | “price” | null, required, nullable) — Ranking preference of model “auto” when the request sends no model_routing.preference.
    • updated_at (string, required, nullable) — null when nothing is stored.
  • key_overrides (array of RoutingPolicy, required)
    • api_key_id (string, required, nullable) — null for the organisation default.
    • sort (“default” | “price” | “latency” | “throughput” | null, required, nullable) — Provider ranking: default = priority and weight; price = cheapest first; latency = lowest time to first token; throughput = fastest output. null inherits.
    • fallback_models (array of string, required, nullable) — Models tried in order when every provider of the requested model failed before the response started (5xx, timeout, 429, upstream 401/403). [] = no fallback. A request’s own “models” list wins. At most 16; relay.max_model_chain bounds what is used.
    • ignore_providers (array of string, required, nullable) — Provider tags never routed to; a request can add to the list but not remove from it. [] lifts the organisation list (API key override only).
    • auto_models (array of string, required, nullable) — Candidate pool of model “auto” when the request sends no “models” list. null = every model the key may use on the endpoint. 1 to 32 entries.
    • auto_preference (“balanced” | “quality” | “price” | null, required, nullable) — Ranking preference of model “auto” when the request sends no model_routing.preference.
    • updated_at (string, required, nullable) — null when nothing is stored.
  • platform_default (EffectiveRoutingPolicy, required) — What applies to requests of one API key before the request’s own parameters, and where each value comes from.
    • sort (string, required) — "" = priority and weight.
    • sort_from (RoutingPolicyLevel, required)
    • fallback_models (array of string, required)
    • fallback_models_from (RoutingPolicyLevel, required)
    • ignore_providers (array of string, required)
    • ignore_providers_from (RoutingPolicyLevel, required)
    • auto_models (array of string, required, nullable) — null = every model the key may use.
    • auto_models_from (RoutingPolicyLevel, required)
    • auto_preference (string, required)
    • auto_preference_from (RoutingPolicyLevel, required)
  • max_model_chain (integer, required) — Most models one request may try (setting relay.max_model_chain), the requested model included.

Replace the organisation’s default routing policy

operationId routingPutOrgPolicy · auth: orgSession

Every field is replaced; null inherits the platform default. Applies to new requests on every gateway replica within seconds.

Request body (required) application/json — RoutingPolicyInput

  • sort (“default” | “price” | “latency” | “throughput” | null, nullable) — Provider ranking: default = priority and weight; price = cheapest first; latency = lowest time to first token; throughput = fastest output. null inherits.
  • fallback_models (array of string, nullable) — Models tried in order when every provider of the requested model failed before the response started (5xx, timeout, 429, upstream 401/403). [] = no fallback. A request’s own “models” list wins. At most 16; relay.max_model_chain bounds what is used.
  • ignore_providers (array of string, nullable) — Provider tags never routed to; a request can add to the list but not remove from it. [] lifts the organisation list (API key override only).
  • auto_models (array of string, nullable) — Candidate pool of model “auto” when the request sends no “models” list. null = every model the key may use on the endpoint. 1 to 32 entries.
  • auto_preference (“balanced” | “quality” | “price” | null, nullable) — Ranking preference of model “auto” when the request sends no model_routing.preference.
Status Meaning Body
200 OK application/json RoutingPolicy
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — RoutingPolicy

  • api_key_id (string, required, nullable) — null for the organisation default.
  • sort (“default” | “price” | “latency” | “throughput” | null, required, nullable) — Provider ranking: default = priority and weight; price = cheapest first; latency = lowest time to first token; throughput = fastest output. null inherits.
  • fallback_models (array of string, required, nullable) — Models tried in order when every provider of the requested model failed before the response started (5xx, timeout, 429, upstream 401/403). [] = no fallback. A request’s own “models” list wins. At most 16; relay.max_model_chain bounds what is used.
  • ignore_providers (array of string, required, nullable) — Provider tags never routed to; a request can add to the list but not remove from it. [] lifts the organisation list (API key override only).
  • auto_models (array of string, required, nullable) — Candidate pool of model “auto” when the request sends no “models” list. null = every model the key may use on the endpoint. 1 to 32 entries.
  • auto_preference (“balanced” | “quality” | “price” | null, required, nullable) — Ranking preference of model “auto” when the request sends no model_routing.preference.
  • updated_at (string, required, nullable) — null when nothing is stored.

An API key’s routing override and the policy that applies to it

operationId routingGetKeyPolicy · auth: orgSession

Parameter In Type Required Description
key_id path string<uuid> yes
Status Meaning Body
200 OK application/json KeyRoutingPolicy
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — KeyRoutingPolicy

  • override (RoutingPolicy, required)
    • api_key_id (string, required, nullable) — null for the organisation default.
    • sort (“default” | “price” | “latency” | “throughput” | null, required, nullable) — Provider ranking: default = priority and weight; price = cheapest first; latency = lowest time to first token; throughput = fastest output. null inherits.
    • fallback_models (array of string, required, nullable) — Models tried in order when every provider of the requested model failed before the response started (5xx, timeout, 429, upstream 401/403). [] = no fallback. A request’s own “models” list wins. At most 16; relay.max_model_chain bounds what is used.
    • ignore_providers (array of string, required, nullable) — Provider tags never routed to; a request can add to the list but not remove from it. [] lifts the organisation list (API key override only).
    • auto_models (array of string, required, nullable) — Candidate pool of model “auto” when the request sends no “models” list. null = every model the key may use on the endpoint. 1 to 32 entries.
    • auto_preference (“balanced” | “quality” | “price” | null, required, nullable) — Ranking preference of model “auto” when the request sends no model_routing.preference.
    • updated_at (string, required, nullable) — null when nothing is stored.
  • effective (EffectiveRoutingPolicy, required) — What applies to requests of one API key before the request’s own parameters, and where each value comes from.
    • sort (string, required) — "" = priority and weight.
    • sort_from (RoutingPolicyLevel, required)
    • fallback_models (array of string, required)
    • fallback_models_from (RoutingPolicyLevel, required)
    • ignore_providers (array of string, required)
    • ignore_providers_from (RoutingPolicyLevel, required)
    • auto_models (array of string, required, nullable) — null = every model the key may use.
    • auto_models_from (RoutingPolicyLevel, required)
    • auto_preference (string, required)
    • auto_preference_from (RoutingPolicyLevel, required)

Replace an API key’s routing override

operationId routingPutKeyPolicy · auth: orgSession

Every field is replaced; null inherits the organisation default.

Parameter In Type Required Description
key_id path string<uuid> yes

Request body (required) application/json — RoutingPolicyInput

  • sort (“default” | “price” | “latency” | “throughput” | null, nullable) — Provider ranking: default = priority and weight; price = cheapest first; latency = lowest time to first token; throughput = fastest output. null inherits.
  • fallback_models (array of string, nullable) — Models tried in order when every provider of the requested model failed before the response started (5xx, timeout, 429, upstream 401/403). [] = no fallback. A request’s own “models” list wins. At most 16; relay.max_model_chain bounds what is used.
  • ignore_providers (array of string, nullable) — Provider tags never routed to; a request can add to the list but not remove from it. [] lifts the organisation list (API key override only).
  • auto_models (array of string, nullable) — Candidate pool of model “auto” when the request sends no “models” list. null = every model the key may use on the endpoint. 1 to 32 entries.
  • auto_preference (“balanced” | “quality” | “price” | null, nullable) — Ranking preference of model “auto” when the request sends no model_routing.preference.
Status Meaning Body
200 OK application/json RoutingPolicy
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — RoutingPolicy

  • api_key_id (string, required, nullable) — null for the organisation default.
  • sort (“default” | “price” | “latency” | “throughput” | null, required, nullable) — Provider ranking: default = priority and weight; price = cheapest first; latency = lowest time to first token; throughput = fastest output. null inherits.
  • fallback_models (array of string, required, nullable) — Models tried in order when every provider of the requested model failed before the response started (5xx, timeout, 429, upstream 401/403). [] = no fallback. A request’s own “models” list wins. At most 16; relay.max_model_chain bounds what is used.
  • ignore_providers (array of string, required, nullable) — Provider tags never routed to; a request can add to the list but not remove from it. [] lifts the organisation list (API key override only).
  • auto_models (array of string, required, nullable) — Candidate pool of model “auto” when the request sends no “models” list. null = every model the key may use on the endpoint. 1 to 32 entries.
  • auto_preference (“balanced” | “quality” | “price” | null, required, nullable) — Ranking preference of model “auto” when the request sends no model_routing.preference.
  • updated_at (string, required, nullable) — null when nothing is stored.

Remove an API key’s routing override

operationId routingDeleteKeyPolicy · auth: orgSession

Parameter In Type Required Description
key_id path string<uuid> yes
Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error