[BUG] 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
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Description
Auto-compaction silently fails with the following error when a conversation context grows large:
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
Steps to reproduce
Use Claude Code with the default model (no model configured in settings.json)
Have a long conversation until auto-compaction should trigger
Observe the error above
Expected behavior
Compaction should either succeed using the same standard-context model as the conversation, or gracefully fall back to standard context without requiring usage credits or user intervention.
Actual behavior
Compaction attempts to use a 1M context model regardless of the configured conversation model, which requires usage credits to be enabled. The session becomes unusable until the user runs /clear.
This is a new behavior as of a day or so ago.
Workaround
Running /clear restores the session. The error message suggests using --model to switch to standard context, but this requires hardcoding a model name, meaning the user won't automatically benefit from future default model upgrades. And since /model reports the default already, it's unclear if this will help.
Environment
Claude Code version: 2.1.156 (Claude Code)
OS: Windows 11
Model: default (claude-sonnet-4-6)
No model set in settings.json
Additional context
The compaction step appears to independently select a 1M context model regardless of the model used for the conversation. Usage quota on claude.ai is well below limits — this is a feature gate issue, not a quota issue.
What Should Happen?
context should auto-compact with no error message
Error Messages/Logs
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
Steps to Reproduce
spend hours on a long claude code session until the ring context status graph is closed.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
unknown. I don't think it's a model version issue.
Claude Code Version
2.1.156 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
41 Comments
Same issue on Pro plan via Cowork (claude.ai desktop). Getting the same error without ever requesting 1M context. Happens on fresh sessions, not just during compaction.
getting same issue as well, should be auto compacting is not its bloody annoying and even worse can kick in in the middle of claude doing work, which instantly causes a block as well.
Same issue on Max plan
Same issue on Pro plan via Visual Studio, win11
I fixed it - I think :D I'm using the claude-code as extension on VS
I found this issue page: https://github.com/anthropics/claude-code/issues/62063
https://github.com/anthropics/claude-code/issues/62063#issuecomment-4583763898
What I did is to add the line: "env": { "CLAUDE_CODE_DISABLE_1M_CONTEXT": "1" } to my setting in my project folder. I used chatGPT to help me and started a new chat. Now it's working fine.
i ran into somewhat the same error. I couldnt figure out why on my Max subscription it was showing this error. It couldn't compact on opus 4.6 (high), that said i use the desktop application with the Code functionality. I changed the model to Opus 4.8 (1M context) and /compact. After that i could go back to 4.6.
I'm not sure what caused it but this workaround seemed quite easy.
I have just found this same issue on a new session which is only used a few times and instead of compaction it shows me the error and I cant even explain again everything to the new chat.
Does anyone have any idea when it will be resolved?
Pro plan, can't compact conversation
I also can't continue conversation and hit with that
API Error: Usage credits required for 1M context · run /usage-credits to turn them on, or /model to switch to standard contextBasically forced to
/clearAPI Error: Usage credits required for 1M context · turn on usage credits at claude.ai/settings/usage, or use --model to switch to standard context
Same. All Sonnet Team agents are failing with this, not auto compacting. When checking context:
⚠ Context is 225% full
Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.
/context
⎿ Context Usage
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Sonnet 4.6
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ claude-sonnet-4-6
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ 450.8k/200k tokens (225%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Estimated usage by category
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ System prompt: 8.1k tokens (4.0%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ System tools: 22.9k tokens (11.4%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Custom agents: 6k tokens (3.0%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Memory files: 3.6k tokens (1.8%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Skills: 2k tokens (1.0%)
⛁ Messages: 157.5k tokens (78.7%)
Error: Error during compaction: API Error: Usage credits required for 1M context · run /usage-credits to turn them on, or /model toswitch to standard context
❯ /context
⎿ Context Usage
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Sonnet 4.6
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀ ⛁ claude-sonnet-4-6
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ 321.3k/200k tokens (161%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Estimated usage by category
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀ ⛁ ⛁ ⛁ ⛁ System prompt: 6.7k tokens (3.3%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ System tools: 31.3k tokens (15.6%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ MCP tools: 68.2k tokens (34.1%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Custom agents: 5.7k tokens (2.8%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Memory files: 1.4k tokens (0.7%)
⛁ Skills: 1.7k tokens (0.8%)
⛁ Messages: 215.2k tokens (107.6%)
Same issue. I switched from Sonnet to Opus & that worked for me.
Environment: Claude Code VS Code extension (not CLI)
Plan: Pro
Issue:
When the conversation context exceeds 200k tokens, I hit a complete deadlock:
Result: Completely stuck. Cannot continue the session, cannot compact it, cannot recover without either enabling paid usage credits or abandoning the session entirely.
Expected behavior: /compact (or auto-compact) should be able to run without requiring 1M context credits — it should use chunked summarization or a context-independent approach, since it's the only recovery path when context is full.
I have the same issue, easily resolved for me by doing /clear,
Hope claude team can fix this as soon as possible.
If you're getting this error in Claude Code (VS Code or CLI) and don't want to pay for usage credits, here's the fix:
Open your global Claude Code settings file:
Add the env block so your file looks like this:
{
"model": "claude-sonnet-4-6",
"env": {
"CLAUDE_CODE_DISABLE_1M_CONTEXT": "1"
}
}
(Keep any other settings you already have, just add the env part.)
Thanks!!!
Same issue on Cowork Pro plan.
Does anyone have any idea when it will be resolved or how resolve it ?
Even with the credits available.
On a next day, with reset of the limits, still had same message about 1M context window.
Switched to Opus, did compaction, then switched back to Sonnet. Code continue to work fine in this case.
Same issue here on MAX plan.
Similar issue here, but not during compaction with Pro plan.
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
Same issue, unable to /compact. we are forced use /usage-credits or /clear the context.
Same issue using Dispatch on Max plan. Toggling on usage limits to $5 briefly “fixed” the issue, but once it burned through $5, error again.
Same issue here — standard 200k Sonnet 4.6 selected, but auto-compaction silently fails and the session overflows past 200k, then throws "Usage credits required for 1M context."
Environment:
What happened:
API Error: Usage credits required for 1M context · turn on usage credits at claude.ai/settings/usage, or use --model to switch to standard contextBilling impact:
Matches #62063, #63634, #63896. Adding my case for weight. Root cause looks like the compaction step internally requiring a 1M-context model regardless of the user-selected standard model — when that's gated, it neither compacts nor falls back gracefully, so the session just overflows and locks.
same issue here and AI chatbot of Claude rejects refunding. Shame.
Honestly guys, you're lucky not to be on auto-refill mode.
I've just been invoiced 5x12€ before realising I was paying for a bug on their side. I'm so glad I kept those figures so low... It could have gone to thousands and be unnoticed...
Max Plan here, Claude Code gone insane. Switched to opus, seems to be on track again.
same problem
Same here across multiple sessions with Claude Pro in Ubuntu. { "CLAUDE_CODE_DISABLE_1M_CONTEXT": "1" } does not help. Using /context will show >100% size, but /compact has no effect (it does work when context is smaller).
Same issue here and burned my added credits in minutes after Claude adviced me to add them with small change it should be burned...
Still happening to me too.
A solution that worked for me:
I had £35 of usage credits as backup, was never going into them, then suddenly this happens and it ate them all in minutes.
They should 100% refund people for costs incurred by their bug, if not also for the time spent not being able to use the service because of this bug. We are considering switching from copilot at work to using claude directly, and I honestly can't recommend we make that change because of this.
Still no movement from Claude on this?
Is anybody working on this? It's a serious blocker. I have plenty of credits and can't use them.
Same issue for me, I tried changing the settings per above
settings.json { "autoUpdatesChannel": "latest", "theme": "dark", "autoUpdates": false, "env": { "CLAUDE_CODE_DISABLE_1M_CONTEXT": "1" } }But that doesn't work for me, still getting the same issue on the Pro Plan and definitely not using the 1M Context. Particularly since I have it disabled as an option to even choose. This is extremely disruptive to work, I hope it gets fixed soon.
If it makes any difference I'm using it inside the VS Code extension on Ubuntu (in WSL)
Same issue here.
Auto compact is enabled in my Claude Code config, but it does not trigger automatically during long sessions. The context keeps growing until warnings appear, and I still need to manually run
/compact.This is especially noticeable in large repositories and long coding sessions. Claude Code becomes less reliable near the context limit, and tasks may be left incomplete unless I manually compact the context.
Expected: auto compact should trigger automatically before the context becomes problematic.
Actual: no automatic compaction happens; only warnings are shown.
Would be great to clarify whether auto compact is currently supposed to run automatically in the latest CLI version, and what conditions/thresholds are required for it to trigger.
Same issue on extension as well, "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"
This happened to me as well. Burned through all my credits despite me never selecting or requesting the larger context window. I explicitly selected the regular sonnet and it still set my credits on fire. Has anyone else had any luck hearing from or dealing with Anthropic about this? I can't seem to get through the help chat to talk to anyone.
Worked for me. Thanks.
I’m seeing this same error, but in Claude Cowork desktop (Windows):
Error during compaction: API Error: Usage credits required for 1M context
On Pro without usage credits, the conversation becomes unusable once this happens.
Simple workaround that works for me:
Start a new Cowork conversation.
Open the model panel (e.g. Sonnet 4.6, effort Medium).
Turn off the “Reflection” toggle before sending the first message.
With Reflection disabled from the beginning, Cowork no longer triggers the 1M‑context / usage‑credits error, and compaction stays in standard context.
<img width="1123" height="803" alt="Image" src="https://github.com/user-attachments/assets/7cd0d188-ebba-4d1b-878b-29f76062a61e" />
Looks like
Switch to Haiku
Run /compact
Switch back to Sonnet.
Doesn't work after too many compacts and requires new session. Tip, when new session is required, always ask for a plan, it will force entering in plan mode and analyzing again your project, and it will be good to review if claude doesn't destroy your project. And make sure to Git commit before applying the changes, it will save you more than once. Even Claude will be happy to understand what it destroyed if it needs to recover anything from Git.