Skip to content

[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 #63896

Description

@david-r-code

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions