Skip to content

OpenCode Go: glm-5.3-flash returns zero prompt-cache reads while deepseek-v4.1-flash caches #48624

Closed as not planned

Description

@OrionTyce

Summary

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.

Environment

  • Date observed: 2026-09-11 (UTC+8)
  • Service: OpenCode Go
  • Route: https://opencode.ai/zen/go
  • API format: OpenAI Chat Completions
  • Client: Claude Code through CC Switch local proxy
  • Model under test: glm-5.3-flash
  • Control model: deepseek-v4.1-flash

Observed behavior

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:

  1. Whether prompt caching is enabled for glm-5.3-flash in production.
  2. Whether GLM requests can be routed across upstream providers without cache affinity.
  3. Whether cache-read usage is omitted from GLM responses even when cache is used.
  4. 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.

Activity

  1. github-actions commented on Sep 12, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. Kensima2 commented on Sep 14, 2026

    @Kensima2

    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.

  3. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    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:

    The bot will close this issue in 1 day.

  4. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions