Your privacy choices

Allow optional cookies for referral attribution, visit analytics, and Google Ads purchase measurement.

Claude Code API troubleshooting

Fix Claude Code rate limits, 500s, 529 overloads, and API key confusion

A troubleshooting guide for API key setup, Pro or Max versus API billing, Messages-compatible endpoints, rate limits, server errors, and overloaded routes.

claude-code-diagnostics
$ claude-code run --model claude-sonnetAPI Error: rate limit reachedstatus=429 route=messages tokens=128k retries=3Next: reduce concurrency, verify the key, retry with backoff
4 error families1 runbook3 routing checks
Community questions

Questions to ask when diagnosing an error

Use community discussions to identify what to investigate. Verify the actual limit, account state and error meaning using official documentation and your request logs.

Reddit

Rate limit reached during a coding session

Is the limit from the account, workspace, model route, or gateway?

Check account limits, then lower concurrency and retry with a smaller context.
Reddit

API key versus Pro or Max subscription

Does the active authentication method use subscription access or API billing?

Treat subscription access and API billing separately unless the provider explicitly links them.
X / Reddit

500 or 529 during agent loops

Is the failure provider overload, a gateway route issue, or a repeating retry loop?

Record the status, request id, route, model, token size, and retry count before changing code.
Error map

Start from the status code

Separate key and permission problems, quota limits, server errors, and overload before choosing a remedy.

429

Rate limit reached

The account, workspace, model or route has exceeded a request or token limit.

  • Reduce parallel agent runs
  • Trim long context
  • Retry with backoff
  • Check quota and model limits
500

API server error

The provider or route returned a server-side failure. Repeated failures need routing evidence.

  • Capture the request id
  • Retry once with backoff
  • Compare another route if repeated
  • Do not start by rewriting prompts
529

Overloaded

The upstream service is under heavy load. Replacing the API key usually will not fix overload.

  • Wait and back off
  • Try a fallback model
  • Reduce request size
  • Check status and support channels
401/403

API key or permission issue

The active key may be wrong or lack access to the model or endpoint.

  • Confirm ANTHROPIC_API_KEY
  • Check the base URL
  • Verify model access
  • Check the active billing source
Runbook

Collect the facts before changing code

  1. Record the exact error, HTTP status, model, endpoint and time.
  2. Confirm whether you use a direct Anthropic key or a compatible gateway.
  3. Check API billing and quota separately from Pro or Max subscription status.
  4. For 429, reduce concurrency and context size first.
  5. For 500 or 529, retry once with backoff, then compare a route or fallback model.
  6. For a gateway, verify the Messages endpoint, model route, cache behavior and support guidance.

Pro or Max access and API billing are different

Check the active key, base URL and billing source. Do not assume subscription access and API credits share the same balance.

Get API access

Using a gateway? Check the Messages endpoint

Claude-compatible clients need the appropriate Messages endpoint, a valid key and a model route supporting the requested workload.

Check the docs
FAQ

Claude Code API errors

Why does Claude Code say rate limit reached?

A request, token or model-route limit was exceeded. Check the active key, workspace, route, context size and parallel agent runs.

Does Pro or Max include an API key?

Treat subscription access and API billing separately unless the official account page says otherwise. Verify the active authentication method and billing source.

What should I do for API Error 500?

Record the request id and retry once with backoff. If failures repeat, compare a route or contact support with the time, model and request id.

What does 529 overloaded mean?

The upstream service is overloaded. Wait, back off, reduce request size or use a fallback route. A different API key usually does not fix overload itself.

Sources

Where to verify current rules

Official documentation is the authority for limits and error meanings. Community discussions are diagnostic leads, not a substitute for verified facts.