⌨️CLAUDE_CODE_MAX_CONTEXT_TOKENS
Also known as CLAUDE_CODE_MAX_CONTEXT_TOKENS environment variable
It tells Claude Code the model's real context size.
Think of it like
It is like you tell a friend the real size of a box. The label on it was wrong.
Example
Emma's gateway serves a model with a 128,000 token window under a Claude name. Chats crashed when full. She sets the real size, and they squeeze in time.
Why it matters
If Claude Code thinks the window is too big, a chat can spill over before it is squeezed.
Definition
Example code
bash
export ANTHROPIC_BASE_URL=https://llm.example.com
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=128000
claudeCommon mistake
Key takeaways
- 1Says the real size. Not a bigger one.
- 2For gateways. Odd model names.
- 3Fixes the squeeze point. And the meter.