#16504 · @marcelloceschia · opened Mar 7, 2026 at 5:43 PM UTC · last updated Mar 21, 2026 at 8:54 AM UTC
feat(bedrock): add prompt caching support for custom ARNs and inferen…
Score breakdown
Impact
Clarity
Urgency
Ease Of Review
Guidelines
Readiness
Size
Trust
Traction
Summary
This PR adds prompt caching support for Bedrock models via custom ARNs, addressing previous limitations for Claude and Nova models. It also allows configuration of 1M context windows.
Description
…ce profiles
- Enable prompt caching for Bedrock models that support it (Claude, Nova)
- Add 'caching' option for custom ARNs/inference profiles without claude in name
- Disable caching for Llama, Mistral, Cohere models (not supported)
- Add comprehensive tests for all caching scenarios
Fixes: Prompt cache not supported for custom ARN models Fixes: 1M context window not configurable
Users can now configure custom ARNs like:
{
"provider": {
"amazon-bedrock": {
"models": {
"arn:aws:bedrock:...:application-inference-profile/xxx": {
"options": { "caching": true },
"limit": { "context": 1000000, "output": 32000 }
}
}
}
}
}
Issue for this PR
Closes #
Type of change
- [ ] Bug fix
- [x] New feature
- [ ] Refactor / code improvement
- [ ] Documentation
What does this PR do?
Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
I run the code locally and verified with our grafana dashboard, the the chaching is now used
Screenshots / recordings
<img width="1194" height="354" alt="image" src="https://github.com/user-attachments/assets/86102fd2-8b26-416a-9929-e7af51aa07c8" />If this is a UI change, please include a screenshot or recording.
Checklist
- [x] I have tested my changes locally
- [x] I have not included unrelated changes in this PR
If you do not follow this template your PR will be automatically rejected.
Linked Issues
None.
Comments
No comments.
Changed Files
packages/opencode/src/provider/models.ts
+14−0packages/opencode/src/provider/provider.ts
+3−1packages/opencode/src/provider/transform.ts
+52−16packages/opencode/test/provider/transform.test.ts
+104−22