Uh oh!
There was an error while loading. Please reload this page.
fix: improve Gemini caching through OpenRouter - #36070
Conversation
The following comment was made by an LLM, it may be inaccurate: Related PR Found:PR #35982: This PR is closely related as it also addresses prompt caching improvements at the provider level. While this current PR (#36070) specifically focuses on enabling Gemini caching through OpenRouter with session ID inclusion, PR #35982 appears to be a broader provider-level caching improvement that may overlap in scope or provide relevant context. |
44a11d5 to
4bd7b36Comparedc71ec6 to
4bd7b36ComparePorted from upstream anomalyco#36070.
Ported from upstream anomalyco#36070.
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes#36069
Type of change
What does this PR do?
Gemini requests through OpenRouter were not using the explicit cache breakpoints already supported by OpenCode.
This enables the existing cache-control behavior for OpenRouter Gemini models and includes the OpenCode session ID in OpenRouter
session_idfield to improve sticky routing and cache reuse.How did you verify your code works?
Ran
bun test test/provider/transform.test.tsfrompackages/opencodewith 295 tests passing.I also inspected the generated OpenRouter request and confirmed it includes the expected
cache_controlmetadata and top-levelsession_id.Checklist