Re:Claude Sonnet 4 now supports 1M tokens of context
by falcor84 on Tuesday August 12, 2025 @04:06PM
(#44881218)
Have you tested it? I see that this env var isn't specified in their docs
https://docs.anthropic.com/en/docs/claude-code/settings#envi...
Re:Claude Sonnet 4 now supports 1M tokens of context
by bazhand on Tuesday August 12, 2025 @05:56PM
(#44882247)
Add these settings to your `.claude/settings.json`:
```json
{
"env": {
"ANTHROPIC_CUSTOM_HEADERS": {"anthropic-beta":
"context-1m-2025-08-07"},
"ANTHROPIC_MODEL": "claude-sonnet-4-20250514",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": 8192
}
}
```
Re:Claude Sonnet 4 now supports 1M tokens of context
by varyherb on Tuesday August 12, 2025 @09:14PM
(#44883632)
Yup! Claude Code has a lot of undocumented configuration. Once I saw the beta header value in their docs [1], I tried to see in their source code if there was anyway to specify this flag via env var config. Their source code is already on your computer, just gotta dig through the minified JS :) Try:
`cat $(which claude) | grep ANTHROPIC_BETAS`
Sibling comment's approach with the other (documented) env var works too.
[1] https://docs.anthropic.com/en/docs/build-with-claude/context...
Re:Claude Sonnet 4 now supports 1M tokens of context
by anonym29 on Wednesday August 13, 2025 @03:06PM
(#44892484)
Tested this morning. Worked wonderfully, except ran into output issues. Attempted to patched the minified Claude file's CLAUDE_CODE_MAX_OUTPUT_TOKENS hard limit of 32000 on Sonnet to 64000, which worked, and I was able to generate outputs above 32000 tokens, but this coincided with a breakage of the 1m context window for me. Still testing and playing around with this, but this may be getting patched?
ANTHROPIC_BETAS="context-1m-2025-08-07" claude