Budget, allowed models and expiry date
Limit what a key can spend, which models it can use and how long it works.
Set these when you create a key, or later with Edit on app.nexrouting.com/keys.
- Budget
- The total a key may spend, from $0.01 to $1,000,000. It’s a total over the key’s whole life, not per month. When it’s reached, requests fail with
402and the codekey_budget_exceededuntil you raise the budget. - Allowed models
- All models, or Only these. Other models fail with
403and the codemodel_not_allowed. Allowing a model also allows its Eco lane; allowing only the Eco lane (…:eco) doesn’t allow Standard. - Expiry date
- The key works until the end of that day (UTC), at most five years ahead. After that, requests fail with
401and the codeapi_key_expired.
Check a key from your code with GET /v1/key. It returns the limit, usage, remaining budget, rate limit, allowed models and expiry date of the key you send:
curl https://api.nexrouting.com/v1/key \
-H "Authorization: Bearer $NEXROUTING_API_KEY"