Skip to navigation

Update Routing Policy

Update the fields you send. The policy is updated in place, so its id stays the same. To change the routing, send strategy with its fields. Needs a management key.

Authentication

AuthorizationBearer

A management key (mgmt_...), sent as Authorization: Bearer <key>. Reading /v1/routing-policies also accepts the organization’s gateway API keys; writing there needs a management key.

Path parameters

policy_idstringRequiredformat: "uuid"

The policy’s id.

Request

This endpoint expects an object.
allowed_modelslist of strings or nullOptional
INTELLIGENT only. Kept in the order sent. A model listed twice is a 422. Models with no capability tier are dropped, so the response can list fewer. Used only when strategy is sent.
allowed_providerslist of strings or nullOptional

INTELLIGENT only, optional. Not stored: responses rebuild it from allowed_models. If sent non-empty, it must name the same providers as allowed_models (order and repeats don’t matter), or the request fails with 422. Checked only when strategy is sent.

axisenum or nullOptional

INTELLIGENT only. What the router optimizes for: COST, PERFORMANCE or CAPABILITY. Omitted or null means COST. Used only when strategy is sent.

Allowed values:
descriptionstring or nullOptional
null keeps the current description. Send "" to clear it.
is_defaultboolean or nullOptional
null keeps the current value.
namestring or nullOptional<=255 characters
null keeps the current name.
priority_orderlist of objects or nullOptional

PRIORITY only. The priority values are kept as sent; responses list the entries sorted by priority. A model listed twice is a 422. Used only when strategy is sent.

slugstring or nullOptional<=100 characters
Renames the policy's model alias. Renaming the policy never changes its alias, since clients send it, so this field is the only way to change it. An alias already in use returns 409, and clients still sending the old alias get 404. null keeps the current one.
strategyenum or nullOptional

Send with its fields to replace the routing. Omitted or null leaves the routing as it is, and allowed_providers, allowed_models, priority_order and axis are ignored.

Allowed values:

Response

The updated routing policy
allowed_modelslist of strings or null
INTELLIGENT only. In the order they were sent.
allowed_providerslist of strings or nullRead-only

INTELLIGENT only. The providers of allowed_models, sorted. Always rebuilt from allowed_models; never stored.

axisenum or null

INTELLIGENT only, else null. What the router optimizes for: COST, PERFORMANCE or CAPABILITY.

Allowed values:
created_atdatetimeRead-only
When the policy was created.
descriptionstring or null
What the policy is for.
idstringRead-only
The policy's id. It stays the same across updates.
is_defaultboolean
Whether this is the organization's default policy.
modelstring or nullRead-only

The ready-to-send model string for this policy, like “@alias/fast-experiment”. Send it as the model in any gateway request to route with this policy.

modified_atdatetimeRead-only
When the policy last changed.
namestring
The policy's name.
priority_orderlist of objects or null
PRIORITY only. Sorted by priority.
slugstring or null

The policy’s model alias as a bare name, like “fast-experiment”. Null only when no alias could be made, such as an organization at its alias limit.

strategyenum

PRIORITY tries priority_order in turn; INTELLIGENT picks among allowed_models per request, optimizing for axis.

Allowed values:

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
422
Unprocessable Entity Error
502
Bad Gateway Error
503
Service Unavailable Error