[Bug] Anthropic API Error: Usage credits required for 1M context window

Resolved 💬 16 comments Opened May 19, 2026 by SlimeyD Closed May 31, 2026

Bug Description
Getting an error when trying to use sonnet xAPI Error: Usage credits required for 1M context · run /usage-credits to turn them on, or /model to switch to standard context

Environment Info

  • Platform: darwin
  • Terminal: cursor
  • Version: 2.1.145
  • Feedback ID: 55d4d99b-83c9-4d3f-9c24-b8128d1b991c

Errors

[]

View original on GitHub ↗

16 Comments

QSimpleIOT · 1 month ago

Claude give me the awnser:

Open VS Code
click Ctrl + Shift + P
Typ Open User Settings JSON
add this line: "claudeCode.defaultModel": "claude-sonnet-4-6"
Restart

CarlosFMeneses · 1 month ago

Temporary Workaround Fix: set flag CLAUDE_CODE_DISABLE_1M_CONTEXT=1. Quit and relaunched Claude Code

avulsed87 · 1 month ago

still same problem !!!!!!!!!!!!!!

StevanWhite · 1 month ago

My experience, using Sonnet 4.6 at medium effort in a named session.
I put into settings.local.json:

  "env": {
    "CLAUDE_CODE_DISABLE_1M_CONTEXT": "1"
  },

and re-started the named session. No effect.

But a clean session was unaffected.
So, in that session, I had claude produce a briefing of what it had been doing in that previous named session.
This was enough to get me going again.

blairg23 · 1 month ago
Claude give me the awnser: Open VS Code click Ctrl + Shift + P Typ Open User Settings JSON add this line: "claudeCode.defaultModel": "claude-sonnet-4-6" Restart

This did NOT fix it for me.

itinance · 1 month ago

i got this today on every session , although i set the CLAUDE_CODE_DISABLE_1M_CONTEXT var in settings.local.env

gabrielyork15 · 1 month ago

pessoal mesmo problema aqui

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

<img width="743" height="397" alt="Image" src="https://github.com/user-attachments/assets/865964f8-be33-433c-82ec-894a1ab8252f" />

M4CC · 1 month ago

Still getting this error with version 2.1.259 after updating Claude Code and reloading VSC. Anything else I need to do?

blairg23 · 1 month ago
Still getting this error with version 2.1.259 after updating Claude Code and reloading VSC. Anything else I need to do?

Only thing that fixes it for me is to close the session and open a new one. When the context gets too big, it's too big until you allow and pay for more.

St4rtnow · 1 month ago

the bug is in the chat itself not in the extension. open another chat and the bug is gone

tylooor · 1 month ago

<img width="518" height="300" alt="Image" src="https://github.com/user-attachments/assets/33fe1d85-f0a1-4464-9ec4-d74ac8b44bf8" />

They seem to have changed this

https://code.claude.com/docs/en/model-config#extended-context-with-1m

zekicandemiralay · 1 month ago

/compact command solved problem for me. I could continue to use same session after compacting.

blairg23 · 1 month ago
/compact command solved problem for me. I could continue to use same session after compacting.

That does work sometimes, not always though.

zekicandemiralay · 1 month ago
> /compact command solved problem for me. I could continue to use same session after compacting. That does work sometimes, not always though.

Okay, i got same error again today, and compacting didnt solve it, and doing remote connection (/remote_connection or /rc) and then using it from remote session worked. not real solution but can be helpful.

blairg23 · 1 month ago
> > /compact command solved problem for me. I could continue to use same session after compacting. > > > That does work sometimes, not always though. Okay, i got same error again today, and compacting didnt solve it, and doing remote connection (/remote_connection or /rc) and then using it from remote session worked. not real solution but can be helpful.

Yeah, it seems erratic at best. Today I worked for exactly 10 min before it said I ran out of tokens and had to wait for 3 hours for the next token re-up.

cibernicola · 1 month ago

And again