/context command fails with LiteLLM proxy (Bedrock)
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?
The /context slash command fails with error:
Error: 500 - max_tokens must be greater than thinking.budget_tokens
Occurs even with alwaysThinkingEnabled: false in settings.json
What Should Happen?
Command should respect alwaysThinkingEnabled setting or configure tokens properly
Error Messages/Logs
Error: 500 {"error":{"message":"Error calling litellm.acompletion for non-Anthropic model: litellm.BadRequestError:
BedrockException - {\"message\":\"The model returned the following errors: `max_tokens` must be greater than
`thinking.budget_tokens`. Please consult our documentation at https://docs.claude.com/en/docs/build-with-claude/extended-thinking#
max-tokens-and-context-window-size\"}","type":"None","param":"None","code":"500"}}
Steps to Reproduce
- Configure LiteLLM proxy to Bedrock
- Set alwaysThinkingEnabled: false in settings.json
- Run /context
- See error
Tried DISABLE_INTERLEAVED_THINKING=true - didn't help
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.28
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Claude Code generated this more detailed bug report when prompted:
Bug Report: /context Command Fails with Bedrock Models via LiteLLM Proxy
Summary:
The /context slash command consistently fails with a max_tokens vs thinking.budget_tokens error when using Claude models through a
LiteLLM proxy (Bedrock backend), even when extended thinking is explicitly disabled.
Environment:
- Claude Code Version: 2.0.28
- Model: claude-sonnet-4-5 (via LiteLLM proxy to AWS Bedrock)
- OS: macOS (Darwin 25.0.0)
- Configuration: Using LiteLLM proxy with custom ANTHROPIC_BASE_URL
Settings Configuration:
{
"env": {
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-sonnet-4-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001",
"CLAUDE_TRACE_SUBAGENTS": "1"
},
"alwaysThinkingEnabled": false
}
Error:
Error: 500 {"error":{"message":"Error calling litellm.acompletion for non-Anthropic model: litellm.BadRequestError:
BedrockException - {\"message\":\"The model returned the following errors: `max_tokens` must be greater than
`thinking.budget_tokens`. Please consult our documentation at https://docs.claude.com/en/docs/build-with-claude/extended-thinking#
max-tokens-and-context-window-size\"}","type":"None","param":"None","code":"500"}}
Steps to Reproduce:
- Configure Claude Code with LiteLLM proxy pointing to Bedrock backend
- Set alwaysThinkingEnabled: false in settings.json
- Run /context command
- Observe error
Attempted Workarounds (None Successful):
- /context thinking mode off
- /context extended thinking disabled
- export DISABLE_INTERLEAVED_THINKING=true followed by /context
All attempts resulted in the same error, indicating the /context command may have extended thinking parameters hardcoded that
cannot be overridden.
Expected Behavior:
The /context command should either:
- Respect the alwaysThinkingEnabled: false setting and not use extended thinking, OR
- Configure max_tokens high enough to accommodate the thinking.budget_tokens it's requesting
Actual Behavior:
The command attempts to use extended thinking with incompatible token budget configuration, causing Bedrock to reject the request.
Impact:
Users cannot use the /context command to check context window usage when using Bedrock models through LiteLLM proxy.
Notes:
- Regular conversations work fine with the same configuration
- Other slash commands work without issues
- This appears specific to the /context command's implementation when used with non-native Anthropic API endpoints
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗