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
{{ message }}
Repository navigation
Improve prompt caching for Gemini models on OpenRouter #36069
When using Gemini models through OpenRouter, prompt cache reads are low and inconsistent in longer sessions.
OpenCode already adds cache breakpoints for Claude models, but not for Gemini models routed through OpenRouter. OpenRouter supports explicit cache_control breakpoints for Gemini and recommends using a stable session_id for routing.
Could OpenCode enable the existing cache-control behavior for OpenRouter Gemini models and send the OpenCode session ID as session_id?
I tested this locally and it improved cache reuse, although partial reads are still expected because of Gemini's caching limitations.
This issue might be a duplicate of or closely related to an existing issue. Please check:
[FEATURE]: Set prompt_cache_ttl for OpenRouter provider #16848: Also covers cache_control breakpoints for the OpenRouter provider, including the documented mechanism for prompt caching (cache_control: { type: "ephemeral" } on message content). The Gemini-specific session_id routing angle in this issue may be a distinct addition, but the underlying caching infrastructure discussion overlaps significantly.
Activity
github-actions commentedon Jul 9, 2026
This issue might be a duplicate of or closely related to an existing issue. Please check:
cache_controlbreakpoints for the OpenRouter provider, including the documented mechanism for prompt caching (cache_control: { type: "ephemeral" }on message content). The Gemini-specificsession_idrouting angle in this issue may be a distinct addition, but the underlying caching infrastructure discussion overlaps significantly.github-actions commentedon Sep 8, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.