claude-code - 💡(How to fix) Fix [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

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

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

Fix Action

Fix / Workaround

Workaround

Code Example

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
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [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