Routing policies

Decide how a customer's requests pick a model

A routing policy decides how a customer’s requests pick a model. PRIORITY tries a ranked list in order, falling back to the next model if one fails; INTELLIGENT picks per request from an allowed set, optimizing for the policy’s axis (COST, PERFORMANCE, or CAPABILITY). A customer’s default policy applies when a request names no explicit routing_policy_id.

Path: /v1/customers/{customer_id}/routing-policies.

Fields

FieldDescriptionType
idMerge UUIDstring
namePolicy namestring
descriptionOptional free-text descriptionstring, nullable
strategyPRIORITY or INTELLIGENTenum
is_defaultUsed when a request names no explicit policyboolean
allowed_providersProvider slugs (INTELLIGENT only, else null)list
allowed_modelsModel slugs (INTELLIGENT only, else null)list
priority_orderOrdered fallback models (PRIORITY only, else null)list of {model, priority}
axisOptimization axis the router optimizes for: COST, PERFORMANCE, or CAPABILITY (INTELLIGENT only, else null; defaults to COST)enum, nullable
created_at, modified_atTimestampsdatetime

Add a routing policy

PRIORITY tries priority_order in order; INTELLIGENT picks per request from the allowed set.

curl -X POST https://api-gateway.merge.dev/v1/customers/{customer_id}/routing-policies \
-H "Authorization: Bearer mg_<your_production_key>" \
-H "Content-Type: application/json" \
-d '{
"name": "workflow-a",
"description": "Primary workflow routing",
"strategy": "PRIORITY",
"is_default": true,
"priority_order": [
{ "model": "openai/gpt-5.5", "priority": 1 },
{ "model": "anthropic/claude-opus-4-8", "priority": 2 }
]
}'

Remove a policy

Delete a policy to stop routing through it. Deleting the default leaves the customer with no default: requests naming only customer fall back to the org default.

Delete
curl -X DELETE https://api-gateway.merge.dev/v1/customers/{customer_id}/routing-policies/{policy_id} \
-H "Authorization: Bearer mg_<your_production_key>"