AI Gateway
Create an AI Gateway routing rule
Create an organization-owned routing rule. Data capture overrides are managed independently. Each tier has an ordering, which defaults to configured. A weighted_affinity tier distributes first-choice assignments by relative target weights (1 to 10000, default 1) and accepts only distinct model targets with an explicit provider. Weights need not total 100. Configured tiers must omit weights or set them to null.
post/api/v2/routing-rules
Request
- Base URLhttps://api.datadoghq.com
- Auth
- API key in header DD-API-KEY and API key in header DD-APPLICATION-KEY
- or OAuth 2Authorization code/oauth2/v1/authorizeToken URL/oauth2/v1/tokenScopesai_gateway_config_write
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Example request
{
"data": {
"attributes": {
"slug": "coding",
"tiers": [
{
"ordering": "configured",
"targets": [
{
"id": 901,
"model": "gpt-5.2-codex",
"model_id": 101,
"provider": "prod-us",
"reasoning_level": "medium",
"slug": "coding-fallback",
"type": "model",
"weight": 70
}
]
}
]
},
"type": "routing-rules"
}
}Response
Created
Example response
{
"data": {
"attributes": {
"created_at": "2026-08-24T12:00:00Z",
"route_id": 123,
"tiers": [
{
"ordering": "configured",
"ordering_issue": "mixed",
"targets": [
{
"id": 901,
"model": "gpt-5.2-codex",
"model_id": 101,
"provider": "prod-us",
"reasoning_level": "medium",
"slug": "coding-fallback",
"type": "model",
"weight": 70
}
]
}
],
"updated_at": "2026-08-24T12:00:00Z"
},
"id": "coding",
"type": "routing-rules"
}
}Changes
Changes to this operation have not been checked yet.