---
title: "API Error Codes (401, 402, 429, 529) & Rate Limits | Straitly Docs"
description: "Decode X-Straitly-Error-Code for 401, 402, 429 and Claude 529 overloaded errors. Retry rules, Retry-After backoff, automatic failover and tier limits."
url: https://straitly.ai/docs/errors
updated: 2026-11-28
publisher: Straitly (https://straitly.ai)
---

Docs

API guides

# Errors & limits

Copy docs

**On this page**

Check 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.

### Identify the error

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 example

Copy Copied Failed

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.

### Error reference

401

#### invalid\_api\_key

The key is missing or invalid.

Check the bearer header and the key supplied by your server environment.

Fix credentials first

401

#### key\_revoked

The key was revoked.

Replace it with an active key and update the application environment.

Replace the key

402

#### insufficient\_credits

Your prepaid balance is exhausted.

Add credits. Do not keep retrying the same rejected request in a tight loop.

Add credits first

402

#### quota\_exceeded

This 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 reset

404

#### model\_not\_found

The requested model is not enabled.

Check the model ID against GET /models. For other 404s, check the endpoint and base URL too.

Fix the request

429

#### rate\_limit\_exceeded

The request-rate limit was exceeded.

Wait for Retry-After, then retry with a bounded retry policy. Reduce request bursts.

Wait, then retry

429

#### concurrency\_limit\_exceeded

Too many requests are in flight.

Let active requests finish and reduce parallelism. Respect Retry-After.

Reduce concurrency

429

#### budget\_exhausted

A child key used its lifetime budget.

Review the child key's budget. It does not reset like a per-minute rate limit.

Budget change required

5xx, such as 529

#### upstream\_overloaded

The 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 backoff

5xx

#### upstream error

The gateway or provider could not complete the request.

Use bounded backoff for transient failures. If it persists, inspect Activity and contact support.

Bounded retry

### What does Claude 529 overloaded mean?

Anthropic'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.

[Anthropic API errors](https://platform.claude.com/docs/en/api/errors) [Retry safely](https://straitly.ai/docs/errors#retry-safely)

### Retry safely

- For request-rate or concurrency limits, respect Retry-After when it is present. If no usable retry hint is returned, use exponential backoff with jitter and a maximum attempt count.
- Stop automatic retries for invalid credentials, exhausted credits, spending caps, and lifetime budgets. Waiting a few seconds does not fix these conditions.
- Check whether your SDK already retries. Adding an outer retry loop can multiply attempts unexpectedly.
- A timeout can leave the outcome uncertain. Inspect request history and avoid blindly repeating external tool actions or other side effects.
- After a partial stream, treat a retry as a new generation. Do not silently append the new answer to the old one.

Not every 429 is temporary: budget\_exhausted needs a budget change. An HTTP retry hint is not permission to bypass a spending limit.

[Streaming recovery](https://straitly.ai/docs/streaming)

### Error messages, word for word

Search this list for the exact message you got. Each one names its cause and the fix.

402

#### "Your credit balance is exhausted. Add credits at https://straitly.ai/app/wallet to keep going."

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 first

429

#### "Your remaining credit is already committed to requests in progress."

Requests 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 finish

404

#### "Model '...' is not configured on this gateway. Call GET /v1/models for the list this key can use."

The 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 request

403

#### model\_not\_allowed\_for\_key

This 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 retry

401

#### key\_revoked

The 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 key

200

#### finish\_reason "content\_filter"

The 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 unchanged

400

#### "The model declined to respond to this request."

The model refused the prompt (content\_refused).

Change the prompt. Sending it again unchanged gets the same answer.

Do not resend unchanged

400

#### "This request exceeds the model's context window. Reduce the input and retry."

Input 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 request

400

#### "Inline attachment is larger than the 10 MB (10485760 bytes) per-attachment limit."

One 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 request

400

#### "This attachment is declared as image/jpeg but the file is a PDF."

A PDF was sent as an image.

Send PNG, JPEG, GIF or WebP images, or send the PDF's text.

Fix the request

400

#### "Image data is empty or unreadable (3 bytes)."

The 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 request

400

#### "This model does not accept audio input. Send audio to a Gemini model, or send a transcript instead."

input\_audio was sent to a model without audio input.

Use a Gemini model with audio, or send text.

Fix the request

400

#### "Unsupported input\_audio format 'flac'. Use one of: wav, mp3."

Only wav and mp3 audio are accepted.

Convert the audio to wav or mp3.

Fix the request

400

#### "This model does not support tool calling."

tools were sent to a model without tool support.

Remove tools, or pick a model that supports them.

Fix the request

[Billing & invoices](https://straitly.ai/docs/billing) [Account & sign-in](https://straitly.ai/docs/account) [Images & vision limits](https://straitly.ai/docs/vision#image-and-audio-limits)

### Rate and concurrency

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.

Starter

**300 / minute** 64 requests in flight. Default account limits.

Growth

**1,000 / minute** 200 requests in flight.

Scale

**3,000 / minute** 500 requests in flight.

[View account limits](https://straitly.ai/app/limits)

### Spending controls

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.

Account balance

**Prepaid credits** Shared by requests billed to the account. Exhaustion blocks new paid requests.

Daily key cap

**UTC day** Each key has its own optional cap. The daily window resets at the UTC day boundary.

Child-key budget

**Lifetime** A fixed budget does not reset daily or each minute. Review it before allowing more spend.

[Manage API keys](https://straitly.ai/app/keys) [Child keys](https://straitly.ai/docs/child-keys)

### Diagnose a failure

- Record the time, model ID, endpoint, HTTP status, and X-Straitly-Error-Code when present.
- Inspect Activity for a recorded request and its upstream error. Not every rejected or network-failed attempt is guaranteed to have an individual history row.
- Failed requests are not billed. For an interrupted stream, inspect the final recorded status and charge instead of assuming the client-side error defines the bill.
- When contacting support, include a request identifier if available and a redacted error message. Never include a raw key or a setup command containing one.

[Request activity](https://straitly.ai/app/activity) [Logs & exports](https://straitly.ai/docs/logs) [API keys & authentication](https://straitly.ai/docs/authentication) [Production checklist](https://straitly.ai/docs/production) [Contact support](mailto:support@straitly.ai)

### Common questions

**How do I tell which Straitly error happened?**

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.

**Which errors should my code retry and which should it stop?**

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.

**What does a Claude 529 overloaded error mean on Straitly?**

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.

**Are failed API requests billed?**

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.

**Why did a 429 return budget\_exhausted instead of resetting?**

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.

[Models & pricing](https://straitly.ai/docs/models) [Production checklist](https://straitly.ai/docs/production)

---
Markdown version of https://straitly.ai/docs/errors.
