You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added support for Claude 3.7 Sonnet with both thinking and 128k output capacity through an existing variant: claude-3-7-sonnet-20250219:thinking. This enhancement provides users with access to the extended output capabilities of Claude 3.7 while maintaining thinking functionality.
Implementation
The implementation required changes in several key areas:
Updated model definition in anthropicModels in api.ts for the 128k
Enhanced the getModel() method to track the original "virtual" model ID alongside the actual model ID
Added header support for the 128k output capability using the anthropic-beta: output-128k-2025-02-19 header
I maintained a consistent pattern for handling feature-specific headers by implementing the same header selection logic across all API methods. This keeps the code maintainable while supporting both prompt caching and extended output capabilities.
Screenshots
before
after
Only standard Claude 3.7 Sonnet with thinking was available
Users can now select Claude 3.7 Sonnet with thinking and 128k output capacity
How to Test
Set your model to claude-3-7-sonnet-20250219:thinking-128k in your configuration
Generate a response that requires a large output (e.g., ask for a comprehensive analysis of a complex topic)
Verify that:
The model correctly uses the thinking capability
The model can generate responses beyond the standard 64k token limit
All API calls (streaming, completion, token counting) work correctly
Get in Touch
I'm available on the Roo Code Discord as @monotykamary if you have any questions!
Important
Updates claude-3-7-sonnet-20250219:thinking model variant with 128k output capacity and updates header handling for extended output capabilities.
Behavior:
Updates claude-3-7-sonnet-20250219:thinking model variant in anthropicModels in api.ts with 128k output capacity.
Updates getModel() in anthropic.ts to track virtualId for special variant handling.
Adds header anthropic-beta: output-128k-2025-02-19 for 128k output capability in createMessage.
Misc:
Ensures consistent header application across all API calls for prompt caching and extended output capabilities.
This description was created by for aec03d7. It will automatically update as commits are pushed.
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
monotykamary
changed the title
feat: add virtual id for extended output 128k claude
feat: update virtual id for extended output 128k claude
Mar 3, 2025
As a follow-up we might want to also update OpenRouter and Vertex. I believe that OpenRouter already transparently sets this header for us, so we should just be able to update the maxTokens value. I'm not sure if it's being set for Vertex.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
EnhancementNew feature or requestlgtmThis PR has been approved by a maintainersize:SThis PR changes 10-29 lines, ignoring generated files.
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Added support for Claude 3.7 Sonnet with both thinking and 128k output capacity through an existing variant:
claude-3-7-sonnet-20250219:thinking. This enhancement provides users with access to the extended output capabilities of Claude 3.7 while maintaining thinking functionality.Implementation
The implementation required changes in several key areas:
anthropicModelsinapi.tsfor the 128kgetModel()method to track the original "virtual" model ID alongside the actual model IDanthropic-beta: output-128k-2025-02-19headerI maintained a consistent pattern for handling feature-specific headers by implementing the same header selection logic across all API methods. This keeps the code maintainable while supporting both prompt caching and extended output capabilities.
Screenshots
How to Test
claude-3-7-sonnet-20250219:thinking-128kin your configurationGet in Touch
I'm available on the Roo Code Discord as
@monotykamaryif you have any questions!Important
Updates
claude-3-7-sonnet-20250219:thinkingmodel variant with 128k output capacity and updates header handling for extended output capabilities.claude-3-7-sonnet-20250219:thinkingmodel variant inanthropicModelsinapi.tswith 128k output capacity.getModel()inanthropic.tsto trackvirtualIdfor special variant handling.anthropic-beta: output-128k-2025-02-19for 128k output capability increateMessage.This description was created by
for aec03d7. It will automatically update as commits are pushed.