Create a routing config
/v1/configsCreate a routing config.
Creates a config in a workspace and answers it with its generated slug (the name in lower case, with a random suffix). The config is validated as by "Validate a routing config" before it is saved.
Requires an organization admin key, or a workspace admin key for workspace_id.
Errors: 400 when a required field is missing; 403 without the required role; 409 when the organization already has a config with this name; 422 when the config is not valid (the message lists each problem with its path, e.g. [targets[0].weight] Weight must be greater than 0).
Authorization
AuthorizationBearer va_A platform API key (
va_...), created under Settings > API keys. Scoped to an organization or one workspace, with an admin or member role. Used by the management API.
Request body application/json
the config to create
namestringrequiredThe config's name, unique within the organization. The slug is derived from it. Required.
organizationstringrequiredThe slug of the organization the config belongs to. Required.
workspace_idstring<uuid>requiredThe workspace the config belongs to (UUID). Required.
strategy_modeenum<string>requiredHow a request picks among
targets. Required.SINGLE: always the first target.LOADBALANCE: one target at random, in proportion to each target'sweight.FALLBACK: the targets in order; the next is tried when one fails with a status inon_status_codes.CONDITIONAL: the first ofconditions(bycondition_order) that matches the request picks itsthen_target_name; if none matches,conditional_default_target_name.
One of
"SINGLE","LOADBALANCE","FALLBACK","CONDITIONAL"targetsobject[]requiredThe targets, in order. At least one. Required.
Child attributes
namestringThe target's name, which conditions and
conditional_default_target_namerefer to. Optional otherwise.virtual_key_slugstringFor a virtual key target: the key's slug. The key must belong to the config's organization and not be
EXPIRED. Requests to this target use the key's provider credential.weightnumber<double>For
LOADBALANCE: the target's share of requests, relative to its siblings. Greater than 0. Default 1.order_indexinteger<int32>The target's position among its siblings, which sets the
FALLBACKorder and which targetSINGLEuses. Absent: its position in the list.strategy_modeenum<string>For a nested strategy target: how it picks among its own
targets:SINGLE,LOADBALANCE,FALLBACKorCONDITIONAL.One of
"SINGLE","LOADBALANCE","FALLBACK","CONDITIONAL"on_status_codesinteger<int32>[]For a nested
FALLBACKtarget: the provider HTTP statuses that move on to its next target. Empty or absent: 429, 500, 502, 503 and 504.conditional_default_target_namestringFor a nested
CONDITIONALtarget: thenameof one of itstargets, used when no condition matches.conditionsobject[]For a nested
CONDITIONALtarget (at least one required): the rules that pick one of its targets.Child attributes
condition_orderinteger<int32>requiredThe rule's position: lower numbers are tried first. Required.
querymap<string, object>requiredWhat the request must match, as a JSON object of field paths to operator objects, all of which must hold, e.g.
{"metadata.tier": {"$eq": "premium"}}. Required and not empty.- Fields:
metadata.followed by a key of the JSON object in the request'sx-metadataheader, andparams.model,params.temperature,params.max_tokens,params.top_p,params.stream(an omittedstreamisfalse). - Operators:
$eq,$ne,$gt,$gte,$lt,$lte(numbers),$in,$nin(arrays),$regex(case-insensitive, must match the whole value) and$exists(trueorfalse). $andand$ortake an array of such objects.
- Fields:
then_target_namestringrequiredThe
nameof the target, at the same level as this rule, that a matching request goes to. Required.
override_paramsobjectRequest parameters a routing target sets on the requests it receives, in place of the caller's. A field left out keeps the caller's value.
model,temperature,max_tokens,top_pandstopare applied; the other fields are validated and stored but not applied at present.Child attributes
modelstringThe model to call instead of the request's, e.g.
gpt-4o-mini.temperaturenumber<double>The sampling temperature, from 0 to 2.
max_tokensinteger<int32>The most tokens to generate; at least 1.
top_pnumber<double>Nucleus sampling, from 0 to 1.
frequency_penaltynumber<double>From -2 to 2. Stored, not applied at present.
presence_penaltynumber<double>From -2 to 2. Stored, not applied at present.
stopstring[]Stop sequences; a non-empty list replaces the request's.
seedinteger<int32>A sampling seed, at least 0. Stored, not applied at present.
response_format_typeenum<string>json_object,textorjson_schema. Accepted, but neither applied nor returned at present.One of
"json_object","text","json_schema"
cacheobjectResponse cache settings stored with a routing config or target. Requests served through a routing config are not answered from the response cache at present.
Child attributes
modestringThe cache mode:
simple(exact match) orsemantic. Absent: none.max_age_secondsinteger<int32>How long a cached answer stays valid, in seconds. Absent: none.
retryobjectRetries for a routing target's provider calls. A failed call with a listed status is tried again after 1, 2, 4, ... seconds (at most 16), until
attemptscalls have been made.Child attributes
attemptsinteger<int32>requiredHow many calls to make in all, the first one included (
1means no retry). From 1 to 10. Required.on_status_codesinteger<int32>[]The provider HTTP statuses to retry. Empty or absent: 429, 500, 502, 503 and 504.
request_timeout_msinteger<int32>For a virtual key target: the time limit for each call to its provider, in milliseconds. A call that takes longer fails. Absent: no limit of its own.
descriptionstringA free-text description. Optional.
on_status_codesinteger<int32>[]For
FALLBACK: the provider HTTP statuses that move a request on to the next target. Any other failure is returned at once. Empty or absent: 429, 500, 502, 503 and 504.conditional_default_target_namestringFor
CONDITIONAL: thenameof the target used when no condition matches. Absent: a request that matches no condition fails with 424.conditionsobject[]For
CONDITIONAL(at least one required): the rules that pick a target. Ignored otherwise.Child attributes
condition_orderinteger<int32>requiredThe rule's position: lower numbers are tried first. Required.
querymap<string, object>requiredWhat the request must match, as a JSON object of field paths to operator objects, all of which must hold, e.g.
{"metadata.tier": {"$eq": "premium"}}. Required and not empty.- Fields:
metadata.followed by a key of the JSON object in the request'sx-metadataheader, andparams.model,params.temperature,params.max_tokens,params.top_p,params.stream(an omittedstreamisfalse). - Operators:
$eq,$ne,$gt,$gte,$lt,$lte(numbers),$in,$nin(arrays),$regex(case-insensitive, must match the whole value) and$exists(trueorfalse). $andand$ortake an array of such objects.
- Fields:
then_target_namestringrequiredThe
nameof the target, at the same level as this rule, that a matching request goes to. Required.
cacheobjectResponse cache settings stored with a routing config or target. Requests served through a routing config are not answered from the response cache at present.
Child attributes
modestringThe cache mode:
simple(exact match) orsemantic. Absent: none.max_age_secondsinteger<int32>How long a cached answer stays valid, in seconds. Absent: none.
retryobjectRetries for a routing target's provider calls. A failed call with a listed status is tried again after 1, 2, 4, ... seconds (at most 16), until
attemptscalls have been made.Child attributes
attemptsinteger<int32>requiredHow many calls to make in all, the first one included (
1means no retry). From 1 to 10. Required.on_status_codesinteger<int32>[]The provider HTTP statuses to retry. Empty or absent: 429, 500, 502, 503 and 504.
request_timeout_msinteger<int32>A time limit in milliseconds. Stored with the config; only the
request_timeout_msof a virtual key target is applied to its calls. Optional.
Responses
Created
idstring<uuid>The config's id (UUID).
slugstringThe config's slug: send it in the
x-configheader, and use it to manage the config.namestringThe config's name, unique within the organization.
descriptionstringA free-text description. Absent when none was set.
organizationstringThe slug of the organization the config belongs to.
workspace_idstring<uuid>The workspace the config belongs to (UUID).
strategy_modeenum<string>How a request picks among
targets:SINGLE(the first),LOADBALANCE(at random, byweight),FALLBACK(in order, moving on at a status inon_status_codes) orCONDITIONAL(byconditions).One of
"SINGLE","LOADBALANCE","FALLBACK","CONDITIONAL"on_status_codesinteger<int32>[]For
FALLBACK: the statuses that move on to the next target. Absent: 429, 500, 502, 503 and 504.conditional_default_target_namestringFor
CONDITIONAL: the target used when no condition matches. Absent: none (such a request fails with 424).targetsobject[]The top-level targets in order; nested strategies carry their own
targets.Child attributes
namestringThe target's name, which conditions refer to. Absent when none was set.
virtual_key_slugstringFor a virtual key target: the key's slug. Absent for a nested strategy target.
weightnumber<double>For
LOADBALANCE: the target's share of requests, relative to its siblings. Default 1.order_indexinteger<int32>The target's position among its siblings (the
FALLBACKorder).strategy_modeenum<string>For a nested strategy target:
SINGLE,LOADBALANCE,FALLBACKorCONDITIONAL. Absent for a virtual key target.One of
"SINGLE","LOADBALANCE","FALLBACK","CONDITIONAL"on_status_codesinteger<int32>[]For a nested
FALLBACKtarget: the statuses that move on to its next target. Absent: the default.conditional_default_target_namestringFor a nested
CONDITIONALtarget: the target used when no condition matches.conditionsobject[]For a nested
CONDITIONALtarget: its rules, incondition_order. Empty otherwise.Child attributes
condition_orderinteger<int32>requiredThe rule's position: lower numbers are tried first.
querymap<string, object>requiredWhat the request must match: field paths (
metadata.*,params.*) to operator objects, as described for the rule's request form.then_target_namestringrequiredThe
nameof the target a matching request goes to.idstring<uuid>The rule's id (UUID). Changes whenever the config's targets are replaced by an update.
override_paramsobjectRequest parameters a routing target sets on the requests it receives, in place of the caller's. A field left out keeps the caller's value.
model,temperature,max_tokens,top_pandstopare applied; the other fields are validated and stored but not applied at present.Child attributes
modelstringThe model to call instead of the request's, e.g.
gpt-4o-mini.temperaturenumber<double>The sampling temperature, from 0 to 2.
max_tokensinteger<int32>The most tokens to generate; at least 1.
top_pnumber<double>Nucleus sampling, from 0 to 1.
frequency_penaltynumber<double>From -2 to 2. Stored, not applied at present.
presence_penaltynumber<double>From -2 to 2. Stored, not applied at present.
stopstring[]Stop sequences; a non-empty list replaces the request's.
seedinteger<int32>A sampling seed, at least 0. Stored, not applied at present.
response_format_typeenum<string>json_object,textorjson_schema. Accepted, but neither applied nor returned at present.One of
"json_object","text","json_schema"
cacheobjectResponse cache settings stored with a routing config or target. Requests served through a routing config are not answered from the response cache at present.
Child attributes
modestringThe cache mode:
simple(exact match) orsemantic. Absent: none.max_age_secondsinteger<int32>How long a cached answer stays valid, in seconds. Absent: none.
retryobjectRetries for a routing target's provider calls. A failed call with a listed status is tried again after 1, 2, 4, ... seconds (at most 16), until
attemptscalls have been made.Child attributes
attemptsinteger<int32>requiredHow many calls to make in all, the first one included (
1means no retry). From 1 to 10. Required.on_status_codesinteger<int32>[]The provider HTTP statuses to retry. Empty or absent: 429, 500, 502, 503 and 504.
request_timeout_msinteger<int32>For a virtual key target: the time limit per provider call, in milliseconds. Absent: no limit of its own.
idstring<uuid>The target's id (UUID). Changes whenever the config's targets are replaced by an update.
conditionsobject[]For
CONDITIONAL: the top-level rules, incondition_order. Empty otherwise.Child attributes
condition_orderinteger<int32>requiredThe rule's position: lower numbers are tried first.
querymap<string, object>requiredWhat the request must match: field paths (
metadata.*,params.*) to operator objects, as described for the rule's request form.then_target_namestringrequiredThe
nameof the target a matching request goes to.idstring<uuid>The rule's id (UUID). Changes whenever the config's targets are replaced by an update.
cacheobjectResponse cache settings stored with a routing config or target. Requests served through a routing config are not answered from the response cache at present.
Child attributes
modestringThe cache mode:
simple(exact match) orsemantic. Absent: none.max_age_secondsinteger<int32>How long a cached answer stays valid, in seconds. Absent: none.
retryobjectRetries for a routing target's provider calls. A failed call with a listed status is tried again after 1, 2, 4, ... seconds (at most 16), until
attemptscalls have been made.Child attributes
attemptsinteger<int32>requiredHow many calls to make in all, the first one included (
1means no retry). From 1 to 10. Required.on_status_codesinteger<int32>[]The provider HTTP statuses to retry. Empty or absent: 429, 500, 502, 503 and 504.
request_timeout_msinteger<int32>The stored time limit in milliseconds (applied only on virtual key targets). Absent when none was set.
schema_versioninteger<int32>The version of the config format. Currently always 1.
created_bystringWho created the config: an identifier of the user, or of the API key, that made the request.
created_atstring<date-time>When the config was created (ISO 8601 date-time).
updated_atstring<date-time>When the config last changed (ISO 8601 date-time).