[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
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
I ran into this last night. Windows 11, using PowerShell. Same issue as everyone else.
I turned off autoUpdates and reverted to 2.1.149 and that fixed it.
settings.json { "autoUpdatesChannel": "latest", "theme": "dark", "autoUpdates": false, "env": { "CLAUDE_CODE_DISABLE_1M_CONTEXT": "1" } }
revert to 2.1.149 -
npm install -g @anthropic-ai/[email protected]
Then closed all windows, opened them up and I was able to work again. YMMV.
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
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 context
Basically forced to/clear
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. 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 to switch 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:
- Got error: "Usage credits required for 1M context" — even though I had only used ~10–13% of my weekly Pro plan quota.
- Tried /model to switch to standard context → "isn't available in this environment" (VS Code extension doesn't support this command).
- Tried /compact manually → fails with the same 1M context error, because compaction itself tries to call the model with the full context.
- Auto-compact never triggered before hitting the limit.
- settings.json already has "model": "claude-sonnet-4-6" set correctly — didn't help.
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.
I have the same issue
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:
- Windows: C:\Users<your-username>.claude\settings.json
- Mac/Linux: ~/.claude/settings.json
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.)
I have the same issue
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:
- Windows: C:\Users
.claude\settings.json - Mac/Linux: ~/.claude/settings.json
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.
- Current balance not used at all.
- I payed around 17$ simply to continue, this balance "burned" within 15 minutes.
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.