Repository navigation
Description
Description
I experienced what appears to be a severe caching/billing issue with OpenCode Go + deepseek-v4-flash on August 16, 2026.
My Go usage was around 11% used, and within approximately 20 minutes or less it reached 100%.
When I checked Usage History, I found a very clear change in billing behavior while my session context remained almost the same size.
Before the issue:
~529K–531K input tokens/request
Cost: approximately $0.0040–$0.0044 per request
Examples from my usage history:
Aug 16, 9:59 PM
Input: 528,969
Output: 230
Cost: $0.0041
Aug 16, 10:00 PM
Input: 529,263
Output: 390
Cost: $0.0043
Aug 16, 10:00 PM
Input: 529,716
Output: 144
Cost: $0.0040
Aug 16, 10:01 PM
Input: 530,924
Output: 168
Cost: $0.0041
Aug 16, 10:02 PM
Input: 531,431
Output: 622
Cost: $0.0044
Then suddenly:
Aug 16, 10:03 PM
Input: 532,116
Output: 144
Cost: $0.1172
Aug 16, 10:04 PM
Input: 532,507
Output: 294
Cost: $0.1173
Cache Read: 0
So essentially the same ~530K-token context went from costing around:
$0.004 per request
to:
$0.117 per request
That is approximately a 27x increase per request, without a meaningful increase in context size.
The Usage History tooltip explicitly shows:
Input: 532507
Cache Read: 0
After this happened, my OpenCode Go allowance was consumed extremely quickly.
Expected behavior
Repeated long-session context should continue receiving the expected DeepSeek cache treatment when the prefix/context has not materially changed.
If caching becomes unavailable, there should at minimum be protection against unexpectedly consuming nearly an entire Go allowance in minutes.
Actual behavior
Cache reads appear to have suddenly dropped to zero during an existing long-running DeepSeek V4 Flash session.
The same ~530K-token context then began being charged as fresh input repeatedly, increasing individual request cost by roughly 27x.
This caused my Go usage to go from approximately 11% used to 100% used in around 20 minutes or less.
Impact
This effectively consumed almost my entire available Go quota during one short period of normal usage.
I did not intentionally create a workload that was approximately 27x more expensive. The cost increase corresponds directly with the apparent loss of cache reads.
I have attached a screenshot of the Usage History showing the transition.
There are also other reports today involving unusually rapid Go quota consumption, including:
- OpenCode Go quota was rapidly exhausted by abnormal repeated GLM-5.2 requests with identical 38,914 input tokens #42871
- URGENT: GLM-5.2 continues consuming my Go quota automatically even after I stopped using Go #42884
My case specifically appears related to DeepSeek V4 Flash caching / cache accounting, rather than simply normal heavy usage.
Request
Could the OpenCode team please investigate:
- Why did DeepSeek V4 Flash cache reads suddenly drop to 0?
- Why did essentially identical ~530K-token requests jump from ~$0.004 to ~$0.117 each?
- Was there a DeepSeek/OpenCode Go backend, routing, caching, or pricing change around this time?
- Were these requests incorrectly billed as uncached input?
- Can the Go quota consumed by this apparent cache failure be reviewed and restored?
Given that the usage increase occurred directly after the cache behavior changed, I would appreciate restoration of the Go quota consumed by the abnormal uncached requests if the investigation confirms this was a service-side caching/accounting problem.
Screenshot
I will attach the Usage History screenshot showing:
~531K input → ~$0.004/request
↓
cache behavior changes
↓
~532K input → ~$0.117/request
Cache Read: 0
Environment
Plan: OpenCode Go
Model: deepseek-v4-flash
Date: August 16, 2026
OS: Windows
Issue duration: approximately 20 minutes or less
Usage impact: approximately 11% used → 100% used
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Activity
github-actions commentedon Aug 16, 2026
This issue might be a duplicate of existing issues. Please check:
sunxfancy commentedon Aug 17, 2026
Maybe I have the similar problem: #43009
ZH1K1NG commentedon Aug 18, 2026
I have the similar problem too #43218
Zaczero commentedon Aug 18, 2026
The $0.004 → $0.117 jump is the published Flash off-peak table on the same ~530k tokens, not a bad meter.
https://opencode.ai/docs/go/#usage-limits
Usage History is reporting a real miss: that whole prefix was billed as uncached input. The prompt only grew a few hundred tokens per turn — a normal append — so a prefix-stable cache should have kept hitting.
Two misses in a row (10:03 and 10:04) also rules out a one-shot eviction. DeepSeek writes the prefix at the end of a request; the next request on the same backend should hit.
https://api-docs.deepseek.com/guides/kv_cache
Staying at cache read 0 means either the next request left that cache domain, or the hit was not the field Go reads.
1. The gateway can leave the cache domain without the client changing anything
Session is only pinned when the model has
stickyProviderset. Otherwise the tracker is a no-op:opencode/packages/console/app/src/routes/zen/util/stickyProviderTracker.ts
Lines 4 to 10 in 9e22c40
Provider selection then hashes the last four characters of the session id over the current provider pool. The pool is filtered live by TPM, TPS, and budget — and a 530k miss itself pushes TPM, which can shrink the pool on the very next turn:
opencode/packages/console/app/src/routes/zen/util/handler.ts
Lines 643 to 653 in 9e22c40
#35402 already showed this on GLM-5.2 with byte-identical requests: warm, then a full miss, then warm again, with the usage JSON shape flipping between two upstreams. Flash was the stable control in #31348. This report is the same cliff on Flash.
2. Or the hit is in a field Go does not read
Go’s OpenAI-compatible mapper only accepts
cached_tokens/prompt_tokens_details.cached_tokens. It never reads DeepSeek’sprompt_cache_hit_tokens. An upstream that only emits the native field would look like cache read 0 and bill as input even if the prefix hit:opencode/packages/console/app/src/routes/zen/util/provider/openai-compatible.ts
Lines 61 to 70 in 9e22c40
That is a different bug from a hop, and it is easy to tell apart from the same two usage rows.
How to tell them apart
Look at
provider(orx-opencode-endpoint-id) on the 10:02 vs 10:03 rows:stickyProvider: "prefer"fordeepseek-v4-flash, the same fix Zen: byte-identical requests to glm-5.2 intermittently reroute to a cold-cache provider — please enable stickyProvider for multi-sourced models #35402 asked for on GLM.prompt_cache_hit_tokens > 0→ read that field innormalizeUsage.The $0.117 is the correct uncached list price. The product bug is either losing the warm cache domain or dropping the hit field. Quota from those miss rows is a support restore once one of the first two checks lands.
japr26 commentedon Aug 19, 2026
Same cache-drop pattern on Aug 19 (OpenCode Go + deepseek-v4-flash)
I'm seeing the exact same behavior described here. Same ~290-314K input context, same session (
q5Pd5DYc), but a subset of requests jumped ~20x in cost while the rest stayed at ~$0.0025-0.004.Usage history (Aug 19, 2026):
Key observations:
Cache Read = 0on those.Impact: ~25% of my Go usage was consumed by these 4 cache-miss requests alone during ~45 minutes of normal use.
Requests: Could the billing/backend investigation also cover whether these intermittent cache drops (and resulting 20x charges) should be restored to the Go quota?
japr26 commentedon Aug 19, 2026
Follow-up: still happening — now at ~370K context, 1 in 10 requests is a full cache miss
Update from the same session (
q5Pd5DYc), Aug 19, ~9:06–9:08 AM. Context has grown to ~370K and the cache-drop pattern continues — in this batch, 1 of 10 requests was a full cache miss costing ~25–30x the cached ones:Verification of the miss: 370,272 × $0.22/M + 333 × $0.66/M = $0.0817 — the entire input was billed as fresh (uncached). The 9 hit rows only charged ~7–8K new tokens each.
Why this is now unmanageable:
Escalation: If this continues I will have to switch to another provider and cancel OpenCode Go until it's fixed. Please treat both the quota restoration and the cache-stability fix as urgent.
japr26 commentedon Aug 19, 2026
Stopping Go usage until this is fixed — cache miss at ~390K context, Aug 19, 9:20 AM
Same session (
q5Pd5DYc), ~40 min after my last update. Context now ~390K and the pattern persists: 1 of 12 requests was a full cache miss, this time $0.0868 vs ~$0.003 for the rest.Verification: 388,200 × $0.22/M + 2,063 × $0.66/M = $0.0868 — entire input billed as fresh again.
Escalation — I'm stopping Go usage until there's a fix. The miss cost keeps climbing with session size (~$0.063 at 285K → $0.082 at 370K → $0.087 at 390K) and it happens every few minutes of normal work, draining my quota mid-task. I can't mitigate this client-side. I'll pause using OpenCode Go (and pending a resolution, cancel the subscription) until the cache-drop issue and quota restoration are addressed.
leandrojo commentedon Sep 7, 2026
Additional report: DeepSeek V4 Flash via Codex CLI → local OpenCode Go proxy (Responses API)
Same family of symptoms as this issue / #41125 / #32911, with a control that makes the cache miss look model-specific on the Go path.
Setup
wire_api = responses) pointed at a localopencode-go-proxyonhttp://127.0.0.1:8787/v1model_provider = "opencode-go", default model ingo.config.tomlwasdeepseek-v4-flashwithmodel_reasoning_effort = highLocal metering (proxy
usage-events.jsonl)deepseek-v4-flashdeepseek-v4-flashInput size distribution on 2026-09-06 OK calls: p50 ~181k, p95 ~236k, almost every call >100k. After weekly quota tripped, we saw a long 429 retry storm (no token fields on those rows).
Dashboard at time of report: DeepSeek V4 Flash ~US$15.64 / US$30 monthly (~52%), weekly Go usage ~100%.
Control on the same proxy / same Codex path
muse-spark-1.3-contributorthrough the sameopencode-goprovider shows Codextoken_countwith ~98%cached_input_tokens(hundreds of millions cached vs input)."cache": {"hit": 0, "miss": 99, "ratio": 0.0}andinput_tokens_details.cached_tokens: 0.cache.hit/cached_tokenson later turns.So this does not look like “Codex never caches anything” — Muse on the same wire caches hard; Flash metering stays at full uncached input.
Why this burns Go so fast
prompt_cache_hit_tokensvs OpenAI-shapedcached_tokens).Asks
deepseek-v4-flashon Go currently hasstickyProvider(or equivalent) so concurrent agent sessions do not hop cold backends?prompt_cache_hit_tokenswhen the Responses/OpenAI-compatible path is used by third-party clients (Codex), not only the OpenCode TUI?Happy to share redacted proxy log slices / request_ids if useful. Account email on Go: contact via GitHub
leandrojo.Related: #41125, #32911, #33473, #31348 / sticky discussion in #35402.
zhengkaics commentedon Sep 26, 2026
Reproduced again on 09-25/26 — same signature as your 08-16 episode, ~590k context, same session, prefix growing monotonically:
Token hit rate on my traffic: 99.07% on 09-21 (274 requests) -> ~50% on 09-25/26.
A miss on a 590k prompt costs ~45x a hit ($0.089 vs $0.002), billed at exactly the full input rate while the catalog still lists cache read at $0.003/M — this is exactly what your usage history showed: cache_read collapsing to ~0 while quota burns at full-context speed.
Consolidated evidence (this table, the byte-identical raw-HTTP flap, source analysis of the affinity headers, and the billing math) is in #50258 — worth treating these as one gateway-side issue rather than separate reports.
kevineh commentedon Oct 1, 2026
Happened to me today as well. Seems like opencode constantly switching between deepseek-flash and deepseek-v4.1-flash, whenever it routes to deepseek-v4.1-flash, the cache hit is 0
detail page:
jaehyun-ko commentedon Oct 8, 2026
Additional report for deepseek-v4.1-flash via OpenCode Go, observed on October 7-8, 2026.
Client: OmO Native (Senpi-based), Linux, provider
opencode-go. These are client-recorded usage values, not independently verified dashboard charges. Times below are KST (UTC+9).A long-running session initially had nearly full cache hits, then repeatedly alternated between warm requests and very expensive misses:
No client model switch was recorded during this interval. Some misses followed warm requests by only seconds. The initial token-count drop is unexplained; I have not captured request-body prefix hashes, so I cannot exclude client-side prompt changes or claim byte-identical requests.
Token-weighted cache-read ratios across local OmO + OpenCode records were approximately 96% on Oct 6, 73% on Oct 7, and 55% on Oct 8 through 11:37 KST. On Oct 8, 09:00-10:00 KST (00:00-01:00 UTC), the affected OmO session made 52 calls: 15,403,362 uncached input tokens and 22,420,352 cache-read tokens. The client's catalog-based cost estimate was $2.41 for that hour. I observed approximately $10 of Go usage being consumed around 09:00-10:00 KST and exhausted my weekly allowance, but I have not yet reconciled workspace-wide traffic, model-specific weighting, or dashboard rates against those local estimates. Other clients also use this workspace, so this is not proof of a metering bug.
Could the team please clarify:
prompt_cache_hit_tokensaccounted for on every upstream?I have lowered the client's compaction threshold as a mitigation, but that does not establish the root cause. Related: #42985 and #50258.
neriousy commentedon Oct 21, 2026
Thanks for the detailed request history. The sudden full-price re-reads came from upstream routing at the time: requests landing on a deployment without your cached prefix are billed as uncached input. Go routing and prompt caching have changed a lot since August, so this is most likely resolved. Closing because there's been no activity for a while. If you still see cache reads dropping to 0 mid-session, comment here with the time, session ID and request IDs from the console logs and we'll reopen it. If it used up your allowance, email [email protected] with your workspace ID.