Error: Error during compaction: API Error: Usage credits required for 1M context · turn on usage credits at claude.ai/settings/usage, or use --model to switch to standard context
Compaction failed, and it failed for a billing reason rather than an arithmetic
one. That single distinction is the whole page. Nothing is wrong with your
network, your key or the service; the conversation is not malformed; and this is
not the other compaction failure, the one where /compact cannot fit its own
summary into a full window. Here the summary would have fit fine. The request
carrying it was refused before a model saw it, because the account is not enabled
for the 1M-token context tier.
Data as of 2026-09. Vendor limits and defaults change; check the official docs for current values before acting on any number below.
The rescue call needs the capability it was rescuing you from
Compaction is not a local delete. It is a model call: Claude Code sends the conversation it wants summarized and asks for a summary back. So the compaction request carries the same tokens the conversation carries. If the conversation has grown past standard context, the summarization request is itself a long-context request — and if long context is gated on your account, the gate catches the thing that was supposed to get you out.
That is the interaction, and it gets worse when you look at when compaction fires. On models running with a native 1M window, Claude Code’s default is to compact at about 967K tokens — deliberately before the window fills. Models running with a 200K window compact at the 200K boundary instead. Put those two facts together for an account without the 1M tier enabled and you get a setup that cannot work: auto-compact is scheduled to run at a point where every request it could possibly send is already in the gated tier. It is not that compaction failed this time. At those defaults it was never going to succeed.
The underlying refusal is the same one covered on
the plain form of this error,
which is the page to read for what usage credits are, how they differ from a
prepaid balance or a plan allowance, and why /status is the first command to
run. The mechanism by which a full window traps you — a summarizer needs
somewhere to put the summary — is covered on
the compaction deadlock page.
What follows is the part neither of them describes.
Both exits the message offers are blocked, and it does not say so
Read the suggestion in the error carefully: turn on usage credits, or use
--model to switch to standard context. The second half is the trap.
--model is a launch flag, so taking that advice means restarting. Restarting is
safe in itself — claude --resume in the same directory picks the conversation
back up. But you now own a conversation that grew past 200K, running on a model
whose window is 200K. The conversation does not fit. Instead of the gate, you get
Prompt is too long, rendered in an interactive session as Context limit reached · /compact or /clear to continue — which sends you back to /compact,
which is where you started.
So the shape you are actually in is a three-sided box. The conversation is too large for standard context. It is gated out of large context. And compaction, the bridge between those two states, needs the gated side to run. Every remedy that involves sending the conversation somewhere is unavailable, which leaves exactly one category of move: the ones that shrink the conversation without a model call.
Is retrying useful?
Yes — after one change, and the retry is then the confirmation. Running
/compact again right now, with nothing changed, fails identically.
This verdict is the opposite of the one on the conversation-too-long deadlock,
and the reason is worth holding onto because it tells you which failure you have.
There, retrying is pointless by construction: the conversation is the same length
on the second attempt, so the arithmetic that failed fails again, forever. Here
the blocking condition is not in the conversation at all. It is account state,
and it lives outside your process. Enable usage credits — or have an
administrator approve them on Team and Enterprise — and the same /compact, on
the same untouched conversation, succeeds. Nothing about your session has to
change.
That is also why this does not belong in a loop. There is no retry-after header
on this response, so there is no interval to honor and no backoff that terminates.
Claude Code retries transient failures up to ten times with exponential backoff
before showing you anything, printing a Retrying in Ns · attempt x/y line while
it does. This error arrives with no such line in front of it. An instant failure
is evidence that the retry machinery already declined to treat it as transient.
Telling this apart from the other compaction failure
They print in the same place, at the same moment in your workflow, and both say “Error during compaction”. Three observations separate them.
- Read the second half of the line.
Conversation too long. Press esc twice to go up a few messages and try againis the arithmetic deadlock.Usage credits required for 1M contextis this page. The recovery advice differs, and the first one’s advice is what people apply to the second one. - Run
/status. It reports which credential is active. If it names an API key rather than the subscription you expected, you are on a path where/usage-creditsis not offered at all — Claude Code does not expose it under API key authentication — and no amount of clicking in plan settings changes what the request sees. - Check
/contextbefore you conclude the chat is at fault. If the system prompt, tool definitions, attachments and MCP schemas account for most of the window, the conversation is not what pushed you over the standard boundary, and stepping back through your own messages will free less than you expect.
One honest overlap, since it will save somebody time: the deadlock page’s
recovery works here too, for a different reason. Stepping back several turns
shrinks the conversation, and a conversation back under standard context no
longer needs the gated tier — so /compact stops being refused. Same keystrokes,
different mechanism.
The exits, cheapest first
- Shed turns with no model call — press
Esctwice with the prompt input empty to open the rewind menu, or run/rewind. If there is text in the box, the first double-Escclears it instead and the menu never opens; that is why the instruction looks broken. Choose Restore conversation, not the code options — a code restore does not cover files changed by Bash commands or by background subagents, and skips linked paths, so it leaves a mixed tree. - Start over and keep the history —
/clear. The previous conversation is preserved and reopenable with/resume, and transcripts live locally as JSONL under~/.claude/projects/, swept oncleanupPeriodDays(default 30 days). This is the fastest exit and the one people skip because it feels final. - Stop the situation recurring — cap the window so compaction fires while
requests still fit standard context.
CLAUDE_CODE_DISABLE_1M_CONTEXT=1makes native-1M models compact at 200K. For a value of your own,/autocompact <value>writes theautoCompactWindowuser setting, and the--autocompactflag and theCLAUDE_CODE_AUTO_COMPACT_WINDOWenvironment variable override it in that order; the accepted range is 100K to 1M tokens and the environment variable takes only a plain count. - Switch models, but only after shrinking —
/modelchanges the model in session. Done on an oversized conversation it produces a context-limit error instead; done on a shrunken one it works. Order matters. Each model keeps its own prompt cache, so the next request re-reads the conversation uncached. - Enable the tier — turn on usage credits, or request them from an administrator. This is the only option that requires no change to your session, and the only one with a recurring cost. Decide deliberately rather than because it was the first thing the error line suggested.
How to know you are out of it
Two checks, in order, because one of them can pass while the situation is unchanged.
First, run /compact and let it complete without an error. If you enabled usage
credits, run it on the untouched conversation — a success there proves the gate
lifted. If you instead shed turns, a success proves only that you are now under
the boundary.
Second, send a real prompt and let it finish. A successful compaction says the
summarizer got through; it says nothing about whether your next turn will. Then
open /context and confirm the conversation is sitting below the window you
intended, and that the warning line about exceeding the limit or sitting past the
compaction window is gone. If you capped the auto-compact window, the proof is
that the next automatic compaction fires at your boundary rather than hundreds of
thousands of tokens later — watch for it once before you trust the setting.
Related errors
Prompt is too long is the wall you
hit if you take the --model advice without shrinking first, and it explains the
window itself rather than who is entitled to use it. If the refusal turns out to
be about a balance rather than a capability,
credit balance too low arrives as a 400
and the diagnostic order is different. And before enabling paid extra usage
because a compaction failed once, the
Claude Code usage limit calculator
will tell you whether your sessions need a million-token window at all, or
whether a capped auto-compact window solves it for free.