Errors
Every failure is RFC 9457 application/problem+json,
including the ones raised before a controller runs. You will never get an HTML error page.
{
"type": "…/errors/insufficient_tokens",
"code": "insufficient_tokens",
"status": 402,
"title": "Not enough tokens",
"detail": "This run costs 750 tokens.",
"hint": "Top up with POST /v1/billing/topup_link, then retry.",
"retryable": false,
"required_tokens": 750,
"available_tokens": 120,
"docs_url": "…/errors/insufficient_tokens",
"request_id": "req_01J…"
}
Branch on
code, never on
detail — the code is the contract, the prose is not.
retryable tells you whether retrying can possibly help.
Retrying a 402 forever burns your rate limit; giving up on a
503 abandons a recoverable job. hint
says what to do about it, and request_id is what support needs.| Code | HTTP | Retryable | Meaning |
|---|---|---|---|
invalid_key | 401 | no | Invalid API key |
key_revoked | 401 | no | API key revoked |
key_suspended | 403 | no | API key suspended |
fetch_quota_exceeded | 429 | yes | URL fetch quota exceeded |
missing_key | 401 | no | Missing API key |
ip_not_allowed | 403 | no | IP not allowed for this key |
tool_not_allowed | 403 | no | Tool not allowed for this key |
email_not_verified | 403 | no | Email not verified |
plan_required | 403 | no | Paid account required |
unknown_tool | 404 | no | Unknown tool |
unknown_run | 404 | no | Unknown run |
unknown_lane | 404 | no | Unknown lane for this tool |
wrong_shard | 421 | no | Wrong API host for this key |
validation_failed | 422 | no | Invalid input |
insufficient_tokens | 402 | no | Not enough tokens |
idempotency_conflict | 409 | no | Idempotency key reused with different input |
run_not_cancellable | 409 | no | Run already finished |
input_too_large | 413 | no | Input too large |
rate_limited | 429 | yes | Rate limit exceeded |
concurrency_limited | 429 | yes | Too many runs in flight |
tool_unavailable | 503 | yes | Tool temporarily unavailable |
upstream_unavailable | 503 | yes | Upstream temporarily unavailable |
api_disabled | 503 | yes | API disabled |
internal_error | 500 | yes | Internal error |