fix: enable caching for Opus 4.5 model #9568
Merged
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.
Related GitHub Issue
Closes: #9567
Roo Code Task Context (Optional)
N/A - Created by Roo Code agent
Description
This PR fixes the issue where Claude Opus 4.5 (claude-opus-4-5-20251101) was not utilizing Anthropic's prompt caching feature, resulting in significantly higher API costs.
The fix adds the model ID
claude-opus-4-5-20251101to both cache control switch statements in the Anthropic provider implementation, enabling:This brings Opus 4.5 in line with other Claude models that properly support caching.
Test Procedure
cd src && npx vitest run api/providers/__tests__/anthropic.spec.tsTo verify manually:
Pre-Submission Checklist
Screenshots / Videos
Not applicable - backend API configuration change.
Documentation Updates
The change is internal to the API provider configuration and doesn't affect user-facing features or APIs.
Additional Notes
This is a simple but important fix that ensures Opus 4.5 users benefit from the same cost savings through caching that other Claude models provide.
Get in Touch
Agent-generated PR
Important
Enables caching for Opus 4.5 model by adding its ID to cache control in
anthropic.ts, reducing API costs.claude-opus-4-5-20251101to cache control switch statements inanthropic.ts.prompt-caching-2024-07-31beta feature for Opus 4.5.anthropic.spec.tspassed.This description was created by
for b46d1da. You can customize this summary. It will automatically update as commits are pushed.