Expand description
Context window management defaults Based on Anthropic context window documentation: https://docs.anthropic.com/en/docs/build-with-claude/context-windows
Constants§
- BETA_
CONTEXT_ 1M - Beta header for 1M token context window Include in requests to enable extended context for Sonnet 4/4.5
- CODE_
HEAD_ RATIO_ PERCENT - Head ratio percentage for code files (legacy, kept for compatibility)
- CONTEXT_
AWARE_ MODELS - Models that support context awareness (budget tracking in prompts) Context awareness: model tracks remaining token budget throughout conversation Currently: Claude Sonnet 4.5, Claude Haiku 4.5
- DEFAULT_
THINKING_ BUDGET - Default thinking budget for production use
- ENTERPRISE_
CONTEXT_ WINDOW - Claude.ai Enterprise context window (500K tokens)
- EXTENDED_
CONTEXT_ ELIGIBLE_ MODELS - Models eligible for 1M context window (beta) Requires usage tier 4 or custom rate limits
- EXTENDED_
CONTEXT_ WINDOW - Extended context window size (1M tokens) - beta feature Available for Claude Sonnet 4, Sonnet 4.5 in usage tier 4 Requires beta header: “context-1m-2025-08-07”
- LOG_
HEAD_ RATIO_ PERCENT - Head ratio percentage for log files (legacy, kept for compatibility)
- MIN_
THINKING_ BUDGET - Minimum budget tokens for extended thinking (Anthropic requirement)
- RECOMMENDED_
THINKING_ BUDGET - Recommended budget tokens for complex reasoning tasks
- STANDARD_
CONTEXT_ WINDOW - Standard context window size (200K tokens) - default for most models
- TOKEN_
BUDGET_ CRITICAL_ THRESHOLD - Critical threshold - immediate action required At 90% usage: Force context handoff or summary
- TOKEN_
BUDGET_ HIGH_ THRESHOLD - Second warning threshold - active context management needed At 85% usage: Actively summarize and persist state
- TOKEN_
BUDGET_ WARNING_ THRESHOLD - First warning threshold - start preparing for context handoff At 70% usage: Consider updating key artifacts to persist context
Functions§
- supports_
context_ awareness - Check if a model supports context awareness
- supports_
extended_ context - Check if a model is eligible for 1M context window