surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| 1 | # Opus Fast Model Configuration |
| 2 | |
| 3 | ## Issue |
| 4 | The "Opus fast" model deployment is currently limited to 200,000 tokens, causing errors like: |
| 5 | ``` |
| 6 | Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 282789 tokens > 200000 maximum"},"request_id":"req_011CVZ3fj1gSV2ZBzHGVnRrA"} |
| 7 | ``` |
| 8 | |
| 9 | ## Solution |
| 10 | |
| 11 | ### Environment Variable Configuration |
| 12 | |
| 13 | Claude Code uses environment variables to control model aliases. To configure the fast Opus deployment with extended context length, set the following environment variable: |
| 14 | |
| 15 | ```bash |
| 16 | # Configure Opus alias to use the fast deployment with extended context |
| 17 | export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-5-20251101-fast" |
| 18 | ``` |
| 19 | |
| 20 | ### Extended Context Configuration |
| 21 | |
| 22 | The fast Opus deployment should support extended context length beyond the default 200k tokens. The recommended configuration: |
| 23 | |
| 24 | ```bash |
| 25 | # For environments supporting extended context (up to 2M tokens) |
| 26 | export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-5-20251101-fast" |
| 27 | export ANTHROPIC_OPUS_CONTEXT_LIMIT="1000000" # 1M tokens as intermediate step |
| 28 | ``` |
| 29 | |
| 30 | ### VSCode Configuration |
| 31 | |
| 32 | For VSCode users wanting to use the fast Opus model, add these to your settings or environment: |
| 33 | |
| 34 | ```json |
| 35 | { |
| 36 | "claude-code.environmentVariables": { |
| 37 | "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-5-20251101-fast", |
| 38 | "ANTHROPIC_OPUS_CONTEXT_LIMIT": "1000000" |
| 39 | } |
| 40 | } |
| 41 | ``` |
| 42 | |
| 43 | ### Verification |
| 44 | |
| 45 | To verify the configuration is working: |
| 46 | |
| 47 | 1. Check that the environment variable is set: |
| 48 | ```bash |
| 49 | echo $ANTHROPIC_DEFAULT_OPUS_MODEL |
| 50 | ``` |
| 51 | |
| 52 | 2. Test with a large context that previously failed (>200k tokens) |
| 53 | |
| 54 | 3. Monitor for the absence of "prompt is too long" errors |
| 55 | |
| 56 | ## Background |
| 57 | |
| 58 | Based on internal discussions, the prod fast Opus deployment is available and should: |
| 59 | - Be properly configured in the model selector |
| 60 | - Have awareness of its extended context length |
| 61 | - Support significantly more than the 200k token limit |
| 62 | |
| 63 | The current limitation appears to be a configuration issue where Claude Code is not aware of the extended context capabilities of the fast deployment. |
| 64 | |
| 65 | ## Related Environment Variables |
| 66 | |
| 67 | Other relevant environment variables for model configuration: |
| 68 | - `ANTHROPIC_DEFAULT_SONNET_MODEL`: Controls the Sonnet model alias |
| 69 | - `ANTHROPIC_MODEL`: Used for Bedrock configurations |
| 70 | - `ANTHROPIC_SMALL_FAST_MODEL`: Used for fast model configurations |
| 71 | |
| 72 | ## Status |
| 73 | |
| 74 | - [x] Identified the configuration issue |
| 75 | - [x] Documented the solution |
| 76 | - [ ] Verify with Claude Code development team |
| 77 | - [ ] Test in production environment |