Creating a routing rule¶
Note
The Admin API requires no token. The Admin API is typically protected at the network level.
Send the request as POST to the path /admin/v1/gateways/{gateway_id}/rules.
Request¶
The following parameters are available:
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
gateway_id |
path | string |
yes | ID of the gateway. |
Example¶
Example of the request body:
{
"priority": 10,
"conditions": [
{
"field": "model",
"op": "prefix",
"value": "gpt-"
}
],
"actions": {
"provider": "openai",
"model": "gpt-4o",
"fallbacks": [
{
"provider": "anthropic",
"model": "claude-sonnet-4-6"
}
]
},
"enabled": true
}
Responses¶
The endpoint answers the request with the following status codes:
| Status code | Description |
|---|---|
201 |
Rule created. |
400 |
Invalid request body or missing required field (Admin API). |