invalid_api_key
The key is missing or invalid.
Check the bearer header and the key supplied by your server environment.
Fix credentials firstStart with the HTTP status, then identify the specific failure before retrying. An invalid key, an exhausted budget, and a temporary rate limit need different fixes.
Read the response body and headers. For gateway denials, X-Straitly-Error-Code carries the named reason, such as quota_exceeded or budget_exhausted. Do not assume error.code in the JSON body always contains that string.
The body shape depends on the endpoint dialect and where the error originated. Anthropic-format errors differ from OpenAI-format errors; upstream errors can vary too.
HTTP/1.1 402 Payment Required
X-Straitly-Error-Code: quota_exceeded
X-Straitly-Action: raise_cap
{
"error": {
"message": "This key has reached its daily spend cap.",
"type": "invalid_request_error",
"code": 402
}
}Illustrative gateway denial. Keep the error message and request context for diagnosis, but never log your Authorization header or raw API key.
The key is missing or invalid.
Check the bearer header and the key supplied by your server environment.
Fix credentials firstThe key was revoked.
Replace it with an active key and update the application environment.
Replace the keyYour prepaid balance is exhausted.
Add credits. Do not keep retrying the same rejected request in a tight loop.
Add credits firstThis key reached its daily spend cap.
Review the key's cap or wait for the UTC day to reset. Other keys have their own caps.
Review cap / wait for resetThe requested model is not enabled.
Check the model ID against GET /models. For other 404s, check the endpoint and base URL too.
Fix the requestThe request-rate limit was exceeded.
Wait for Retry-After, then retry with a bounded retry policy. Reduce request bursts.
Wait, then retryToo many requests are in flight.
Let active requests finish and reduce parallelism. Respect Retry-After.
Reduce concurrencyA child key used its lifetime budget.
Review the child key's budget. It does not reset like a per-minute rate limit.
Budget change requiredThe gateway or provider could not complete the request.
Use bounded backoff for transient failures. If it persists, inspect Activity and contact support.
Bounded retryNot every 429 is temporary: budget_exhausted needs a budget change. An HTTP retry hint is not permission to bypass a spending limit.
Account limits are shared across your keys. Requests per minute counts how often you send requests; concurrency counts how many are still running. A long streaming response occupies an in-flight slot until it ends.
Your account can have custom limits. Use the Limits page for your current values and higher-limit requests instead of relying only on this default table.
Rate-limit denials carry Retry-After and may include X-RateLimit-Limit and X-RateLimit-Remaining. Do not assume every error or successful response has the same headers.
Daily caps track billed spend, including charges still settling. The displayed tally can lag by about a minute, so treat the cap as a spend control rather than an exact, instantaneous cutoff.
Review limits intentionally before raising them. A capped key stopping does not mean that every other key on the account has stopped.