Skip to main content
kRouter
All posts
Fix an error

Claude Code "rate limit exceeded": every cause and the fix

Claude Code stops with a 429 or a usage limit. Four different limits cause it, each needs a different fix, and the one everyone tries first makes it worse.

Kodelyth · The team behind kRouter
· Updated
7 min read

You are halfway through a refactor and Claude Code stops:

API Error: Request rejected (429) · this may be a temporary capacity issue. If it persists, check https://status.claude.com.

The obvious move is to retry. By the time you see that line, Claude Code has already done it for you: it retries temporary 429s up to 10 times with exponential backoff before it shows an error. Retrying by hand mostly lands you back inside the same window.

There are four different things that can stop Claude Code with a limit. They look nearly identical and they need completely different responses.

1. Per-minute limits on an API key

The most common one on an API key, and the most misread. Anthropic limits each organization by requests per minute, input tokens per minute and output tokens per minute, separately for each model class and separately from any monthly budget. Agentic coding pushes hardest on the input limit: every tool call and every file read resends the conversation so far.

Prompt caching softens this. For most Claude models only uncached input counts toward the input-tokens-per-minute limit, so a long session that keeps hitting the cache costs little against it. A cache miss -- after you switch models, for example -- pushes the whole context through the window at once.

How to tell: Claude Code shows Request rejected (429) and you are using an API key, Bedrock or Google Cloud. Run /status first: a stray ANTHROPIC_API_KEY in your environment can route you through a low-tier key instead of your subscription. Anthropic's limits refill continuously rather than resetting on the minute, and each 429 carries a retry-after header with the seconds to wait, so this usually clears within a minute.

The fix: stop sending everything at once. In practice that means slowing the agent down, or spreading the traffic across more than one account so no single one absorbs the whole burst.

This is worth being precise about, because the distinction matters for what you do next: your monthly budget can be almost untouched while you are being rate limited every few minutes.

2. Session, weekly or monthly allowance used up

Different problem entirely. You have spent the allowance for the period, and no amount of waiting a minute helps.

How to tell: the message names a reset time. On a Claude subscription it reads like this:

You've hit your session limit · resets 3:45pm
You've hit your weekly limit · resets Mon 12:00am

The session and weekly limits are shared across all models, so switching models does not restore access. Only the separate Opus and Sonnet limits can be sidestepped with /model. On an API key, the equivalent is your usage tier's monthly spend cap: a 429 whose message says when you regain access, with no retry-after header, because nothing changes until the first of next month.

The fix: wait for the real reset, buy more, or route the work somewhere else in the meantime. /usage shows your plan limits and when they reset, and /usage-credits buys extra usage on Pro and Max. Retrying every few minutes just burns requests against a wall. The weekly cap has its own guide: Claude Code weekly limit reached.

If you use kRouter, this is the case it handles specifically: when the upstream reports a real reset time, that model on that account is parked until the reset (for at most six hours) instead of coming back on a short timer to fail again. That distinction -- per-minute limit versus genuine exhaustion -- is why an exhausted account stops blipping in and out of rotation.

3. Bursts and short-lived throttles

Less common, easy to miss. Anthropic enforces its per-minute limits over shorter intervals too -- its rate-limit docs give the example of 60 requests per minute being enforced as one per second -- and adds acceleration limits when an organization's usage jumps sharply. Separately, the API sometimes throttles for reasons unrelated to your quota; Claude Code labels that one Server is temporarily limiting requests (not your usage limit).

How to tell: it fires soon after a burst, such as several subagents starting at once, and clears within seconds.

The fix: reduce concurrency. Claude Code's own docs suggest running fewer parallel subagents or lowering CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY. If your usage is new or growing fast, ramp it up gradually.

A 529 Overloaded is a different thing again: capacity on Anthropic's side, not a limit on yours. It has its own guide.

4. Organization-level limit

Anthropic sets API limits per organization, not per key. Every key and workspace in the organization draws from the same pool unless an admin has set per-workspace limits, so someone else's batch job can exhaust the capacity you need. Your own usage looks fine and you are still blocked.

How to tell: colleagues in the same organization are blocked at the same time, and the Console's Usage page shows the organization at its limit.

The fix: this is an admin conversation, not a client-side one. Workspace limits can fence off a heavy user so they cannot starve everyone else.

What does not work

Retrying in a tight loop. OpenAI's rate-limit guide says failed requests count toward your per-minute limit, and Anthropic's says retries before the retry-after time will fail. Claude Code already backs off on its own; a manual loop on top only adds requests to the window you are waiting out.

Making prompts shorter. If the limit counts requests rather than tokens, size changes nothing. Check which one you are hitting first.

Creating a second API key on the same account. Limits are enforced per organization, not per key. Same pool, same wall.

Switching models on a session or weekly limit. Both are shared across every model. /model only helps with the separate Opus and Sonnet limits.

The structural fix: more than one backend

Every fix above is a workaround for the same underlying situation -- you have one path to one provider, so when that path is throttled you stop working.

Claude models are not only available from Anthropic directly. GitHub Copilot and Kiro plans include Claude models too, and Claude Code will talk to any endpoint that speaks the Anthropic Messages API. A local router lets it reach all of them through one endpoint:

npm install -g @sifxprime/krouter
krouter -t

Then point Claude Code at it. The dashboard's CLI Tools page can write this into ~/.claude/settings.json for you, or you can set it yourself:

export ANTHROPIC_BASE_URL=http://localhost:20128/v1
export ANTHROPIC_AUTH_TOKEN=<your-krouter-key>

Claude Code does not know anything changed. But when one account hits its per-minute ceiling, the next request goes to another account or another provider automatically, and the task keeps moving instead of stopping.

Two settings matter here:

  • Account selection. With several accounts on one provider, kRouter's default picker scores each by health and remaining quota. Switching that provider to round-robin spreads requests more evenly -- it stays on one account for three calls by default, then moves on -- which helps most against per-minute limits, because those are per account.
  • Combos let you send routine turns to a cheap or free backend and keep the premium account for work that needs it. Most agent traffic is not the hard part of the job. Combos & fallback lists what each kind of error does to the order.

One caution: kRouter shows a risk notice before you connect a Claude, Copilot or Kiro subscription, because those subscriptions are not licensed for proxy use and an account can be restricted. Spreading work across your own accounts does not change a provider's terms. An API key is the clean path.

Working out which limit you hit

Before changing anything, read the actual message:

Claude Code saysYou are hittingDo this
Request rejected (429) on an API keyPer-minute limitLean on caching, lower concurrency, spread across accounts
You've hit your session limit or weekly limit, with a reset timePlan allowance used upWait, buy usage credits, or route elsewhere until the reset
Server is temporarily limiting requests, or a 429 right after a burstShort-lived throttleWait briefly, run fewer parallel subagents
Colleagues blocked at the same timeOrganization limitTalk to your admin

Guessing wrong here is what turns a two-minute interruption into an afternoon.

Common questions

How long does a Claude Code rate limit last?

It depends which limit you hit. A per-minute limit usually clears within a minute; Anthropic's API states the exact wait in the retry-after header, and Claude Code waits it out over up to 10 retries before showing an error. A session or weekly limit does not clear until the reset time the message names. A short-lived throttle clears in seconds. Read the message before deciding to wait.

Does retrying make it worse?

Usually yes. OpenAI counts failed requests toward the per-minute limit, and Anthropic says retries before the retry-after time fail. Claude Code already retries with backoff, so a manual loop on top only adds load to the window you are waiting out.

Will a second API key give me more quota?

No. Anthropic enforces limits per organization, not per key. A second key in the same organization draws from the same pool and hits the same wall.

Will upgrading my plan fix it right now?

For a subscription limit, it can. Anthropic applies a Pro to Max upgrade immediately, with prorated billing, and /usage-credits buys extra usage on Pro and Max without changing plans. A per-minute limit on an API key depends on your usage tier instead, which Anthropic raises automatically as your history grows or on request from the Console's Rate limits page.

Why do I hit this in Claude Code but not in the Claude app?

Agentic coding sends far more tokens per minute than chat. Every tool call and file read resends the accumulated context, and parallel subagents multiply it, so one apparently small turn can push tens of thousands of tokens through the per-minute window.

Kodelyth · The team behind kRouter

Published by Kodelyth, the team that builds kRouter. Posts are drafted with AI assistance and reviewed by a person before they go out. kRouter is free and MIT licensed.

Install kRouter