[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

Open 💬 41 comments Opened May 30, 2026 by david-r-code

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_

View original on GitHub ↗

41 Comments

portaliertom14-dot · 1 month ago

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.

robgrahamau · 1 month ago

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.

lampv6290 · 1 month ago

Same issue on Max plan

rolandmano · 1 month ago

Same issue on Pro plan via Visual Studio, win11

rolandmano · 1 month ago

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/claude-code@2.1.149 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.

SvanGooswilligen · 1 month ago

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.

aaryansharma25 · 1 month ago

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?

0ffbyone · 1 month ago

Pro plan, can't compact conversation

0ffbyone · 1 month ago
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

lifugui2021-glitch · 1 month ago

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

cjmsync · 1 month ago

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%)

mnsrt · 1 month ago

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%)

abhilash-coact · 1 month ago

Same issue. I switched from Sonnet to Opus & that worked for me.

adamy · 1 month ago

Environment: Claude Code VS Code extension (not CLI)
Plan: Pro

Issue:
When the conversation context exceeds 200k tokens, I hit a complete deadlock:

  1. Got error: "Usage credits required for 1M context" — even though I had only used ~10–13% of my weekly Pro plan quota.
  2. Tried /model to switch to standard context → "isn't available in this environment" (VS Code extension doesn't support this command).
  3. Tried /compact manually → fails with the same 1M context error, because compaction itself tries to call the model with the full context.
  4. Auto-compact never triggered before hitting the limit.
  5. 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.

unkownxxx · 1 month ago

I have the same issue, easily resolved for me by doing /clear,

Hope claude team can fix this as soon as possible.

adamy · 1 month ago
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.)

unkownxxx · 1 month ago
> 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.)

Thanks!!!

portaliertom14-dot · 1 month ago

Same issue on Cowork Pro plan.
Does anyone have any idea when it will be resolved or how resolve it ?

ShadSpb · 1 month ago

Even with the credits available.

  1. Current balance not used at all.
  2. 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.

ganji1225 · 1 month ago

Same issue here on MAX plan.

Dr-yangyangzhang · 1 month ago

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

manirajanvn · 1 month ago

Same issue, unable to /compact. we are forced use /usage-credits or /clear the context.

PromptButVerify · 1 month ago

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.

enzorossi11 · 1 month ago

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:

  • Claude Code version: latest
  • OS: Win 11
  • Model: claude-sonnet-4-6 (standard 200k — never selected a 1M model)
  • Billing: prepaid usage credits

What happened:

  • Context meter showed 369.9k / 200k (185%), messages alone at 346.4k. Auto-compaction never ran successfully around the ~190k mark where it should have.
  • Every request and every /compact then fails with:

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

  • I never requested or selected a 1M-context model.

Billing impact:

  • This runaway context consumed prepaid usage credits during the failed-compaction loop. Per the docs, failed requests are not supposed to be billed, so these charges look incorrect.

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.

gucluy-sketch · 1 month ago

same issue here and AI chatbot of Claude rejects refunding. Shame.

pikifou · 1 month ago

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.

bastie · 1 month ago

same problem

varigg · 1 month ago

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).

a3vt · 1 month ago

Same issue here and burned my added credits in minutes after Claude adviced me to add them with small change it should be burned...

M4CC · 1 month ago

Still happening to me too.

kapilparab · 1 month ago

A solution that worked for me:

  1. Switch to Haiku
  2. Run /compact
  3. Switch back to Sonnet.
CoreyGrant · 1 month ago

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.

ADrever · 1 month ago

Still no movement from Claude on this?

brassman · 1 month ago

Is anybody working on this? It's a serious blocker. I have plenty of credits and can't use them.

MwaniN · 1 month ago

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)

Kartalops · 1 month ago

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.

aarynverma · 1 month ago

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"

jkf7998vkz-coder · 1 month ago

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.

tfinity · 1 month ago
A solution that worked for me: 1. Switch to Haiku 2. Run /compact 3. Switch back to Sonnet.

Worked for me. Thanks.

technocubeenergie-arch · 21 days ago

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" />

popowere · 20 days ago

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.