Description
This issue had an initial gap in OpenCode’s Responses caching chain: previous_response_id was not persisted/reused across turns.
That part is now fixed in PR #20848, but we also found a second cache-hit gap:
For custom providers using npm: "@ai-sdk/openai" (with a non-openai provider ID), promptCacheKey was not always set because the old condition mostly relied on providerID === "openai" (or manual setCacheKey).
So requests could carry previous_response_id but still miss stable cache routing from prompt_cache_key.
This is now addressed by extending cache option wiring for SDK-based OpenAI providers.
Plugins
oh-my-opencode
OpenCode version
- Reproduced on: v1.3.13 and local dev build
- Verified fixed on:
0.0.0-feat/gpt-incremental-caching-202604031035
Steps to reproduce
- Configure a custom provider using
npm: "@ai-sdk/openai" with a provider ID not equal to openai.
- Start a multi-turn session with a stable large prompt prefix.
- Inspect outgoing requests / logs.
- Before fix:
previous_response_id may be present, but prompt_cache_key may be missing.
- After fix: both are present and cache behavior improves.
Screenshot and/or share link
N/A
Operating System
Linux
Terminal
bash
Description
This issue had an initial gap in OpenCode’s Responses caching chain:
previous_response_idwas not persisted/reused across turns.That part is now fixed in PR #20848, but we also found a second cache-hit gap:
For custom providers using
npm: "@ai-sdk/openai"(with a non-openaiprovider ID),promptCacheKeywas not always set because the old condition mostly relied onproviderID === "openai"(or manualsetCacheKey).So requests could carry
previous_response_idbut still miss stable cache routing fromprompt_cache_key.This is now addressed by extending cache option wiring for SDK-based OpenAI providers.
Plugins
oh-my-opencode
OpenCode version
0.0.0-feat/gpt-incremental-caching-202604031035Steps to reproduce
npm: "@ai-sdk/openai"with a provider ID not equal toopenai.previous_response_idmay be present, butprompt_cache_keymay be missing.Screenshot and/or share link
N/A
Operating System
Linux
Terminal
bash