Validate a routing config
/v1/configs/validateValidate a routing config.
Checks a config without saving it, with the same rules as create and update, and answers whether it is valid. Problems are reported with a 200 and valid: false, not as an error status: errors then holds one entry whose message lists each problem with its path.
The rules:
- At least one target; a CONDITIONAL strategy needs at least one condition.
- Each target is either a leaf (
virtual_key_slug) or a nested strategy (strategy_modewith its owntargets), never both and never neither. Strategies nest at most 3 levels below the top. weight, when set, is greater than 0;retry.attemptsis from 1 to 10.override_params:temperature0 to 2,top_p0 to 1,max_tokensat least 1,frequency_penaltyandpresence_penalty-2 to 2,seedat least 0.- Every condition's
then_target_namenames a target at its level; in a nested CONDITIONAL target,conditional_default_target_namenames one of its targets too. - A condition's
queryis not empty and uses onlymetadata.*andparams.*fields (params.model,temperature,max_tokens,top_p,stream), the operators$eq,$ne,$gt,$gte,$lt,$lte,$in,$nin,$regexand$exists, and$and/$orarrays of such queries. - Every virtual key exists in
organizationand is notEXPIRED. A key of another organization is reported exactly as one that does not exist.
Requires membership of organization, or of the workspace named by workspace_id; anyone else gets 403. A body without organization is a 400.
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 check
organizationstringrequiredThe organization slug the config's virtual keys must belong to. Required.
strategy_modeenum<string>requiredThe strategy:
SINGLE,LOADBALANCE,FALLBACKorCONDITIONAL. Required.One of
"SINGLE","LOADBALANCE","FALLBACK","CONDITIONAL"targetsobject[]requiredThe targets. 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.
workspace_idstring<uuid>The workspace the config is for (UUID). Optional: a member of that workspace (or a key scoped to it) may validate with it; without it the caller must be a member of the organization.
conditionsobject[]For
CONDITIONAL(at least one required): the rules that pick a target.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.
on_status_codesinteger<int32>[]For
FALLBACK: the statuses that move on to the next target. Not checked.conditional_default_target_namestringFor
CONDITIONAL: the target used when no condition matches. Not checked at this level.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.
Responses
validbooleanTrue when the config would be accepted by create and update.
errorsobject[]Empty when
validis true; otherwise one entry listing the problems.Child attributes
pathstringWhere the problem is. Currently always
request: the message carries each problem's own path.messagestringThe problems, each as
[path] messageand separated by;, e.g.[targets[0].weight] Weight must be greater than 0.