Cost guardrails
Cap per-request spend and lock routes to specific providers. Set them per API key in the dashboard or via the REST API.
Cost cap
Per-request ceiling in USD
If a request's estimated cost exceeds the cap, the router returns 402 before dispatching. Leave blank for no cap.
Provider filter
Allowlist or excludelist
Restrict routing to named providers (allowlist) or block specific ones (excludelist). Useful for compliance or vendor-lock situations.
Set in the dashboard
Open API Keys, expand any key, and use the Guardrails panel. Takes effect on the next request — no re-deploy.
Set a cost cap via API
import requests
requests.patch(
"https://kairosroute.com/api/auth/keys/YOUR_KEY_ID",
headers={"Authorization": "Bearer YOUR_SESSION_TOKEN"},
json={"maxCostPerRequestUsd": 0.05},
)Pass null to remove the cap.
Restrict providers via API
requests.patch(
"https://kairosroute.com/api/auth/keys/YOUR_KEY_ID",
headers={"Authorization": "Bearer YOUR_SESSION_TOKEN"},
json={
"allowedProviders": ["Anthropic", "OpenAI"], # route only to these
# or: "excludedProviders": ["Together AI"], # route to anyone BUT these
},
)Use allowedProviders for strict allowlisting and excludedProviders for blocklisting. Pass an empty array to clear.
What you get back
| Trigger | Status | Error code |
|---|---|---|
| Estimated cost > cap | 402 | cost_guardrail_exceeded |
| No model matches provider filter | 400 | no_models_available |
Advanced: minimum quality floor
Every model carries an internal score (0.0–1.0) that the router uses to pick a fit for each task. You can set a floor with minQualityThreshold on a key, but unless you're tuning against your own evals we recommend leaving it blank — the router already uses smart per-task defaults tuned from daily signal-loop runs.
Scores drift as the signal loop re-fits nightly, so thresholds you set today may filter differently next week. Prefer cost caps and provider filters for stable constraints.