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
OpenCode Go: glm-5.3-flash returns zero prompt-cache reads while deepseek-v4.1-flash caches #48624
glm-5.3-flash on OpenCode Go repeatedly returns zero prompt-cache reads through Claude Code + CC Switch, while deepseek-v4.1-flash returns substantial cache-read tokens through the same account and proxy path.
This appears model-specific rather than a general CC Switch monitoring problem.
For consecutive successful glm-5.3-flash requests, CC Switch showed no cache read or cache creation tokens:
Input tokens
Output tokens
Cache read
33,768
51
0
33,825
77
0
38,207
390
0
38,440
6
0
With deepseek-v4.1-flash on the same OpenCode Go account and CC Switch proxy path, repeated requests showed cache-read values around 42,368 to 44,800 tokens.
Expected behavior
After the first request warms the prompt prefix, repeated turns with a stable long context should return non-zero cache-read tokens for glm-5.3-flash, as they do for DeepSeek through the same setup.
Request
Could the OpenCode Go team please check:
Whether prompt caching is enabled for glm-5.3-flash in production.
Whether GLM requests can be routed across upstream providers without cache affinity.
Whether cache-read usage is omitted from GLM responses even when cache is used.
Whether the OpenAI Chat Completions route for GLM has a cache-specific limitation.
No API keys, account identifiers, or private logs are included. I can provide redacted screenshots and timestamps if useful.
Ran the same probe from a different angle — raw HTTP against https://opencode.ai/zen/go/v1/chat/completions (non-stream, 2026-09-14, headers User-Agent: opencode/x, Accept-Encoding: identity, x-opencode-session constant). Independent confirmation of the glm-5.3-flash behavior, plus two additions:
1. Byte-identical re-request test (stronger than consecutive-turn observation): same messages, re-sent byte-for-byte after 10s:
model
request with replayed reasoning_content
byte-identical re-request (+10s)
glm-5.3
cached 640/736
640/736 = 87%
glm-5.3-flash
0/717
0/717 = 0%
omen-alpha
0/734
0/734
A byte-identical re-request is the easiest possible cache hit; glm-5.3-flash never engages, so this looks route-level rather than cache-affinity or timing.
2. On glm-5.3 the hit extends through the replayed reasoning_content. Its second request hit 640 tokens while the first request's input was only 195 tokens — the cached prefix matched the prior request's generation-side sequence (input + reasoning + content), i.e. that route preserves thinking by default and the cache covers the replayed CoT. This matches Z.ai's official Preserved-Thinking cache design (docs.z.ai → Thinking Mode → Preserved thinking, "increases cache hit rates").
3. The GLM thinking object is rejected with 400 on every GLM route ({"thinking":{"type":"enabled","clear_thinking":false}} → invalid request body: json: unknown field "thinking", error cites the Console Go upstream). That flag enables Preserved Thinking — default-on on GLM's own Coding Plan endpoint and listed in glm-5.3-flash's official recommended parameters — so it is currently impossible to opt in via OpenCode Go. May be worth checking whether the flash/omen routes cache correctly with preserved thinking enabled upstream, or whether caching simply isn't wired on those routes.
Also observed: prompt_tokens_details.cache_write_tokens is always null on these routes.
Related: #48116 (same byte-identical method; deepseek-v4-flash / qwen3.8-max also never cache, glm-5.2 does), #43218. Happy to re-run against any route.
Thanks for the detailed comparison between glm-5.3-flash and deepseek-v4.1-flash. Getting no cache reads on long, stable prompts would mean you pay more per turn than you should.
This concerns the hosted OpenCode Go service, not the OpenCode app. You're calling /zen/go directly through Claude Code and CC Switch. Questions about Go/Zen provider behaviour, caching and usage need the team to look at the service itself, and that isn't handled in GitHub issues. Please email [email protected] with the details: the timestamps of the requests, the models, the route, and the usage numbers you saw. If you've already emailed, the team will get to it, especially now that we've seen it here.
Please keep API keys, account identifiers, email addresses and any payment details out of this public issue and put them in the email instead.
These existing issues are related but describe different problems, in case they're useful:
Hi @OrionTyce, I'm closing this issue as not planned. The prompt-caching behaviour comes from the hosted OpenCode Go service, not the OpenCode app, so it isn't handled here. If you still need help with it, please email [email protected] with your timestamps, the models and the usage figures you saw. Please send keys and account details only in that email, not here. Thanks again for the careful comparison.
Activity
github-actions commentedon Sep 12, 2026
This issue might be a duplicate of existing issues. Please check:
Kensima2 commentedon Sep 14, 2026
Ran the same probe from a different angle — raw HTTP against
https://opencode.ai/zen/go/v1/chat/completions(non-stream, 2026-09-14, headersUser-Agent: opencode/x,Accept-Encoding: identity,x-opencode-sessionconstant). Independent confirmation of the glm-5.3-flash behavior, plus two additions:1. Byte-identical re-request test (stronger than consecutive-turn observation): same messages, re-sent byte-for-byte after 10s:
reasoning_contentglm-5.3glm-5.3-flashomen-alphaA byte-identical re-request is the easiest possible cache hit; glm-5.3-flash never engages, so this looks route-level rather than cache-affinity or timing.
2. On glm-5.3 the hit extends through the replayed reasoning_content. Its second request hit 640 tokens while the first request's input was only 195 tokens — the cached prefix matched the prior request's generation-side sequence (input + reasoning + content), i.e. that route preserves thinking by default and the cache covers the replayed CoT. This matches Z.ai's official Preserved-Thinking cache design (docs.z.ai → Thinking Mode → Preserved thinking, "increases cache hit rates").
3. The GLM
thinkingobject is rejected with 400 on every GLM route ({"thinking":{"type":"enabled","clear_thinking":false}}→invalid request body: json: unknown field "thinking", error cites the Console Go upstream). That flag enables Preserved Thinking — default-on on GLM's own Coding Plan endpoint and listed in glm-5.3-flash's official recommended parameters — so it is currently impossible to opt in via OpenCode Go. May be worth checking whether the flash/omen routes cache correctly with preserved thinking enabled upstream, or whether caching simply isn't wired on those routes.Also observed:
prompt_tokens_details.cache_write_tokensis alwaysnullon these routes.Related: #48116 (same byte-identical method; deepseek-v4-flash / qwen3.8-max also never cache, glm-5.2 does), #43218. Happy to re-run against any route.
opencodejr commentedon Oct 28, 2026
Thanks for the detailed comparison between
glm-5.3-flashanddeepseek-v4.1-flash. Getting no cache reads on long, stable prompts would mean you pay more per turn than you should.This concerns the hosted OpenCode Go service, not the OpenCode app. You're calling
/zen/godirectly through Claude Code and CC Switch. Questions about Go/Zen provider behaviour, caching and usage need the team to look at the service itself, and that isn't handled in GitHub issues. Please email [email protected] with the details: the timestamps of the requests, the models, the route, and the usage numbers you saw. If you've already emailed, the team will get to it, especially now that we've seen it here.Please keep API keys, account identifiers, email addresses and any payment details out of this public issue and put them in the email instead.
These existing issues are related but describe different problems, in case they're useful:
glm-5.3-flashon Go appearing to serve a stale or wrong cached prefixprompt_cache_keyis sentdeepseek-v4.1-flashprompt-cache regression on Go when images are addedThe bot will close this issue in 1 day.
opencodejr commentedon Oct 29, 2026
Hi @OrionTyce, I'm closing this issue as not planned. The prompt-caching behaviour comes from the hosted OpenCode Go service, not the OpenCode app, so it isn't handled here. If you still need help with it, please email [email protected] with your timestamps, the models and the usage figures you saw. Please send keys and account details only in that email, not here. Thanks again for the careful comparison.