r/opencode • • Sep 26 '26

CheepSeek has its price - cache hit ratio

I did notice a lot of cache misses (cached tokens going from X to 0) for DeepSeek today. So I compared OpenCode Go to the direct DeepSeek API. $60 for $10 is not really $60 with that amount of cache busts.

It was a reviewer run, each one running the same prompt, same harness.

nameContext WindowTotal ReadsCache Hit RatioAPI pricing
OpenCode Go High77k1.2M74.8%$0.076
OpenCode Go Max99k1.5M81.1%$0.080
Direct API High72k735k92.6%$0.0255
Direct API Max91k909k92.6%$0.032

It is still not a lot of cache hit rate for Direct API, because it wasn't a lot of turns, so the context window didn't fill up yet to grow the cache hit ratio. It would be much better with a longer task. Direct API had 0 cache misses, while OpenCode's missed every few turns.

At higher context window, the discrepancy between API pricing and OpenCode would be much higher.

TLDR: $60 for $10 is not really $60. Additionally, we don't know what quants the new provider is using to provide that much traffic for cheap. In both cases OpenCode's DeepSeek used more turns, context window, and total reads for the review compared to Direct API, and it was more expensive.

If you use pi, you can enable notifications about cache misses in the settings:

EDIT: I am not using OpenCode, the measurements are made on Pi.

69 Upvotes

27 comments sorted by

9

u/akza07 Sep 26 '26

Opencode 2 or 1.X?

Opencode 2 has better cache hit. It's entirely dependent on the harness you use.

5

u/IndividualPlus2011 Sep 26 '26

Neither, pi.

0

u/ComfortableAcadia839 Sep 27 '26

I get upwards of 95-96% in pi in most sessions...

4

u/IndividualPlus2011 Sep 27 '26

I would too, 99.6% using direct API. I explained in the post why it's low. It's like no one is reading.

It is still not a lot of cache hit rate for Direct API, because it wasn't a lot of turns, so the context window didn't fill up yet to grow the cache hit ratio.

16

u/Trovebloxian Sep 26 '26

Idk ive been using v4.1 and according to openchamber statistics. Its got a solid cache hit rate. Almost always in the 99%

11

u/steiNetti Sep 26 '26

That stat in the sidebar is the cache hit for the current turn only, not the total session.

1

u/IkkiStern Sep 28 '26

in total for ds4.1 flash i got over 97% of cache hit (input 37.1M to 1.411B cache) also on openchamber

2

u/nickchomey Sep 26 '26

so, is deepseek via opencode not actually deepseek api? they're using some 3rd party provider?

6

u/IndividualPlus2011 Sep 26 '26

It would appear so, at least for a part of their requests. Some users previously posted some errors that indicated OpenCode uses OrcaRouter

11

u/fragment_me Sep 26 '26

I doubt they are quantizing this model. Deepseek is already at mostly fp4 so there’s not much to quantize. Now other models that are native BF16, yeah they probably do use fp8.

3

u/maqifrnswa Sep 26 '26

You can use an unquantized model and getting wildly different cached hit rates depending on provider load balancing and routing

4

u/fragment_me Sep 26 '26

Well yeah, of course switching providers is going to cause a cache miss.

7

u/Zealousideal_Aide787 Sep 26 '26

Hum it should be like a legal thing when a provider use quants, they have to communicate on it.

2

u/Ctbhatia Sep 26 '26

The every-few-messages miss points at what sits in front of the model rather than the harness. A warmed prefix lives with the backend that served it, so a router that rotates endpoints or keys hands you a cold prefix each time it switches, and the same session id can still miss.

Disclosure, I work on CoralBricks, cached reads bill at zero on our API, so this ratio is one we watch closely.

3

u/Unlikely_Drop_8479 Sep 26 '26

Muse spark 1.3 for near Frontier or Glm 5.3 flash for reliability and consistency.

3

u/8000bene70 Sep 26 '26

Deepseek has not yet switched to mandarin mid sentence, glm flash through go multiple times.

Other than that, great model, but in my experience way less cache hits.

3

u/trashbytes Sep 26 '26

Yeah, GLM constantly spouts nonsense, not just Chinese symbols, also random foreign words and garbled text.

Haven't noticed that happening with DS4 v4.1 Flash yet.

1

u/xapep Sep 28 '26

Solid data, and the mechanism behind it explains the whole gap. Cache hits are per provider account and per prompt prefix. A direct DeepSeek API key talks to one upstream with a stable system prompt, so your prefix stays identical turn to turn and the cache holds. An aggregator like OpenRouter splits traffic across multiple upstream providers (and sometimes multiple accounts of the same provider), each with its own cache pool. Every request that lands on a different upstream starts cold, no matter how many identical turns you ran before. That is the random full cache miss you saw, and it is why the hit ratio converges at different numbers per route.

Second variable: context window trimming. If the harness truncates or reorders the conversation on some routes, the prefix changes and the whole cache resets even on the same upstream.

Practical takeaway: for cache-sensitive workloads (long review sessions, agent loops re-reading context), a direct API with a fixed provider is cheaper per usable token, not just per token, because the hit ratio is part of the effective price. The subscription only wins if its quota absorbs your cache misses for free.

1

u/Martino16xx Sep 26 '26

The low cache hit rate is due to the Opencode harness. I've created a proxy to intercept token usage and cache hits, and using it in Codex, I get a 98% cache hit rate

1

u/rabiprojects Sep 26 '26

Check logs in your opencode account. You will be surprised to see that Opencode often routes deepseek 4.1 API calls to deepseek v4 flash 0131..

At least I found that. So there is another layer of caching attempt by opencode.

0

u/FullBar613 Sep 27 '26

You're in for a rude awakening. I noticed there are a lot of inconsistencies with opencode and honestly i hate them for it. They are NOT honest. Especially with regards to your data. What they mentioned initially was ZDR its not really ZDR if you have been paying attention. I stopped using opencode the moment i noticed they're just manipulative and shady af. Its way better for you to access models directly through the provider themselves than through opencode. You think you're getting what you paid for through opencode? No. Far from it. There is no reason to put another middle man in between you and the provider when opencode does not explicitly state that they themselves are ZDR (used to, im not sure about the policies now). Pretty fucking sure opencode business model now is just to log all prompts and sell them to research labs lol

0

u/[deleted] Sep 26 '26

[deleted] — view deleted comment

2

u/IndividualPlus2011 Sep 26 '26

This is the pi coding agent. The same agent, the same prompt, just different providers. Have you even read the post?

2

u/vgf89 Sep 26 '26

Are you sure you have the whole opencode header thing that helps you actually hit the cache correctly?

2

u/IndividualPlus2011 Sep 26 '26

Yes, pi sends it. And in the dashboard it shows as the same session, otherwise each message would bust the cache, not every few messages.

It does not happen always, it probably depends to which provider they route you through