invalid_api_key
The key is missing or invalid.
Check the bearer header and the key supplied by your server environment.
Fix credentials firstCheck the HTTP status and X-Straitly-Error-Code header first before retrying. Retry temporary 429 rate limits and 5xx or 529 upstream overloads with Retry-After or backoff; stop retrying 401 invalid keys, 402 insufficient_credits, 402 quota_exceeded and 429 budget_exhausted.
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 last source Straitly tried was at capacity, for example after Claude returned 529 overloaded_error. If no output has been sent yet, Straitly tries the model's other sources first. Message: "The model is at capacity right now. Please retry shortly."
Retry with backoff. A source's 5xx status comes back as is; a source's 429 comes back as 502.
Retry with backoffThe gateway or provider could not complete the request.
Use bounded backoff for transient failures. If it persists, inspect Activity and contact support.
Bounded retryAnthropic's errors page (read Nov 23, 2026): "529 - overloaded_error: The API is temporarily overloaded." and "A 529 error can occur when the API experiences high traffic across all users."
Through Straitly, a 529 before any output moves the request to the next source for that model. If the last source tried is also at capacity, or the 529 comes mid-stream, you get upstream_overloaded (above). Retry with backoff; Anthropic's SDK already retries 5xx errors twice by default.
Not every 429 is temporary: budget_exhausted needs a budget change. An HTTP retry hint is not permission to bypass a spending limit.
Search this list for the exact message you got. Each one names its cause and the fix.
The account or team that owns this key has no credit left. If your balance shows money, the key usually belongs to another account or team organization, which has its own balance.
Top up the account that owns the key, or use a key from the account that has the balance.
Add credits firstRequests that are still running hold the little credit that is left (concurrency_limit_exceeded).
Wait for those requests to finish, or add credits.
Retry after they finishThe model id is misspelled, retired, or not available to this key.
Copy the id from GET /v1/models. Use the id, not the display name.
Fix the requestThis model is turned off on this key, for example after repeated content-filter blocks. Other models on the key still work.
Use another model, or reply to the email we sent about it.
Do not retryThe key was revoked, or paused after content-filter blocks on several models.
Use an active key. For a paused key, reply to the email we sent.
Replace the keyThe model's safety filter stopped the answer. The reply can be empty or cut short.
Rephrase the request or choose another model. Repeated blocks on one key can turn that model off for the key.
Do not resend unchangedThe model refused the prompt (content_refused).
Change the prompt. Sending it again unchanged gets the same answer.
Do not resend unchangedInput plus requested output is larger than the model's context window.
Trim history or files, lower max_tokens, or pick a model with a larger window.
Fix the requestOne image or file is over the per-attachment limit.
Resize or compress it. All inline attachments together can be up to 32 MB.
Fix the requestA PDF was sent as an image.
Send PNG, JPEG, GIF or WebP images, or send the PDF's text.
Fix the requestThe base64 data is not a real image, often a broken upload or a placeholder.
Check the file you encode and the data URL prefix.
Fix the requestinput_audio was sent to a model without audio input.
Use a Gemini model with audio, or send text.
Fix the requestOnly wav and mp3 audio are accepted.
Convert the audio to wav or mp3.
Fix the requesttools were sent to a model without tool support.
Remove tools, or pick a model that supports them.
Fix the requestAccount 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.
Check the HTTP status code and the X-Straitly-Error-Code response header first. Gateway denials put the exact reason in X-Straitly-Error-Code, such as insufficient_credits, quota_exceeded, rate_limit_exceeded or budget_exhausted, even when OpenAI and Anthropic error body shapes differ.
Retry 429 rate_limit_exceeded, 429 concurrency_limit_exceeded and transient 5xx or 529 upstream_overloaded responses with Retry-After or bounded backoff. Stop automatic retries on 401 invalid credentials, 402 insufficient_credits, 402 quota_exceeded and 429 budget_exhausted.
Anthropic 529 overloaded_error means the upstream provider is temporarily at capacity. Before any output has streamed, Straitly tries the model's other sources first; if the last source is also at capacity or 529 happens mid-stream, Straitly returns upstream_overloaded so you can retry with backoff.
No. Failed requests are not billed and appear in Activity at zero cost with the recorded status and error reason. For an interrupted mid-stream disconnect, inspect Activity for the final recorded usage and charge.
429 budget_exhausted means a child key reached its lifetime total_cap_usd budget, which does not reset every minute or day. Raise the child key's total_cap_usd via PATCH /v1/admin/keys/{key_hash} or mint a new key.