-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: Add Claude Sonnet 4.5 1M context window support for Claude Code… #8586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Claude Sonnet 4.5 1M context window support for Claude Code… #8586
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found some issues that need attention before this can be merged.
| supportsReasoningBudget: false, | ||
| requiredReasoningBudget: false, | ||
| }, | ||
| "claude-sonnet-4-5-20250929[1m]": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Model ID naming inconsistency. The model ID "claude-sonnet-4-5-20250929[1m]" includes a date (20250929) that doesn't exist in the base anthropic models. The base model being spread is "claude-sonnet-4-5" (no date), not "claude-sonnet-4-5-20250929".
This creates confusion because:
- The date in the model ID suggests it's based on a dated model variant
- But it's actually spreading from the undated
"claude-sonnet-4-5"base model - This inconsistency could lead to maintenance issues
Consider either:
- Using
"claude-sonnet-4-5[1m]"to match the base model name, OR - Documenting why the date is included if it has semantic meaning for Claude Code
| }, | ||
| "claude-sonnet-4-5-20250929[1m]": { | ||
| ...anthropicModels["claude-sonnet-4-5"], | ||
| contextWindow: 1_000_000, // 1M token context window (requires [1m] suffix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Major: Missing pricing information for 1M context. The base claude-sonnet-4-5 model in anthropic.ts has tiered pricing for 1M context (lines 21-29 in anthropic.ts):
- Input: $6 per million tokens (vs $3 for ≤200K)
- Output: $22.50 per million tokens (vs $15 for ≤200K)
- Cache writes: $7.50 per million tokens (vs $3.75 for ≤200K)
- Cache reads: $0.60 per million tokens (vs $0.30 for ≤200K)
The current implementation inherits the base pricing ($3/$15) which is incorrect for 1M context usage. You should either:
- Override the pricing fields to match the 1M tier pricing, OR
- Document that Claude Code uses different pricing than the Anthropic API
| requiredReasoningBudget: false, | ||
| }, | ||
| "claude-sonnet-4-5-20250929[1m]": { | ||
| ...anthropicModels["claude-sonnet-4-5"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Consider adding a test case for the new 1M context model in __tests__/claude-code.spec.ts to verify:
- The model ID is valid and can be retrieved
- The contextWindow is correctly set to 1_000_000
- The model properly inherits other properties from the base model
feat: Add Claude Sonnet 4.5 1M context window support for Claude Code provider
Related GitHub Issue
Closes: #8585
Roo Code Task Context (Optional)
Description
Adds support for Claude Sonnet 4.5 with 1M token context window to the Claude Code provider.
Changes made in
packages/types/src/providers/claude-code.ts:claude-sonnet-4-5-20250929[1m]contextWindow: 1_000_000(overrides default 200K from base anthropic model)claude-sonnet-4-5modelImplementation Details:
This follows the same pattern used by Bedrock and Anthropic API providers for 1M context support:
contextWindow: 200_000)contextWindow: 1_000_000overrides the inherited valuegetModel()method returns the full ModelInfo object with the overridden contextWindowsrc/core/sliding-window/index.tsuses this contextWindow value to determine when to truncate messagesWhen users select this model via
/model sonnet[1m]in Claude Code:contextWindow: 1_000_000Test Procedure
Manual Verification:
/model sonnet[1m]in Claude CodeCode Review:
satisfies Record<string, ModelInfo>)webview-ui/src/components/ui/hooks/useSelectedModel.ts(lines 203-211 for Bedrock)webview-ui/src/components/ui/hooks/useSelectedModel.ts(lines 367-397 for Anthropic)Pre-Submission Checklist
Screenshots / Videos
N/A - This is a backend model configuration change with no UI modifications.
Documentation Updates
[1m]suffix in Claude Code.Additional Notes
This implementation adds the model definition but relies on the existing infrastructure:
ClaudeCodeHandler.getModel()method already properly returns model info with all propertiescontextWindowproperty from model infoGet in Touch
Discord:
Important
Adds
claude-sonnet-4-5-20250929[1m]model with 1M token context window to Claude Code provider, overriding default 200K token limit.claude-sonnet-4-5-20250929[1m]model with 1M token context window inclaude-code.ts.contextWindowof 200K tokens to 1M tokens.src/core/sliding-window/index.tsrespects the 1M token limit.claude-sonnet-4-5and overridescontextWindow.getModel()method inClaudeCodeHandlerreturns model info with updated context window.This description was created by
for e014043. You can customize this summary. It will automatically update as commits are pushed.