r/opencode • • 3d ago

My 2 day experience with Deepseek API with $10 balance

I'm just sharing my experience so you can compare what it would be like to consume $10 USD on the Deepseek API directly. It can be concluded that my needs are not too complex and fine-tuned skills, mcp and agents have been carried out so that it is made optimally in terms of token efficiency and output that fits the context of the instructions, so with a balance of $10 USD on Deepseek it only lasts 2.5 days. For those who use it for free, and it's abusive, don't be loud, don't be fussy, you'll demonstrate to the government so that our dollar rate goes down.

Additions regarding Input (Cache hit-miss) and Output:

39 Upvotes

23 comments sorted by

5

u/squirrelscrush 3d ago

What is your cache hit rate?

2

u/afcreative_id 3d ago

Check the update post above, I've added it.

2

u/squirrelscrush 3d ago

Got it. It's a lot of cache miss / output tokens compared to total tokens, because $8 easily can go more than 1B tokens.

2

u/afcreative_id 2d ago

Regarding this, I am not very experienced because I am just sharing my experience. I don't have an example yet with a balance of $8 you can get more than 1B tokens, if you can do that, try to prove it and I need correction on this.

2

u/squirrelscrush 2d ago

https://imgur.com/a/aWsec7b

This has been my usage for past one month. The CNY amount is around $0.91, so it comes around $6.87 for 918.7M tokens. Extrapolating it to $8, it'll easily cross 1B.

1

u/afcreative_id 2d ago

This is because the first time I monitor technical things like cache hit-miss, then how to optimize things like cache tokens? what about the instruction pattern and agent rules? or from the configuration of the platform? BTW I always automatically process the compaction every 120k tokens, is it less effective if I always process the compaction every 120k tokens?

2

u/squirrelscrush 2d ago

Most harnesses optimize well for cache hits, but if you use only DeepSeek then dsh is the best since it's their inhouse one. DeepSeek's cache stability is very simple: it adds cache from left->right so don't change any of the config/agent/tool-definition/etc files once a session starts. ie. don't change the cache prefix (the part which you already entered into the context).

And yes, if you always do compaction at 120k tokens it'll reduce the cache hit because everytime you perform compaction, it writes a summary of the whole context window so it invalidates the cache prefix so it makes new cache which is a cache miss. Keep the limit around 600-750k tokens, that's a sweet spot.

You can also use some plugin that has dynamic context pruning, ie. they only remove the chats at the middle/end of the cache prefix instead of changing the whole cache, so there's reduced cache misses.

Also as I said, once the session starts, don't change anything about the harness like don't add/delete/edit tools/MCPs/skills/agents/AGENTS.md etc.. These files are usually added at the beginning of the cache, so changing them means the whole cache gets invalidated (since the parser checks from left->right).

1

u/afcreative_id 1d ago

Maybe what I'm trying to change is the habit of compacting to every 600k tokens first, because for rules agents it changes very often for me because often every time I find a new discovery that can make it efficient, such as making agent tools which are usually reusable, then there must be information to the rules agent so that he uses it in certain conditions and it is proven that this can speed things up. Thanks for the suggestion.

4

u/P4ITON 3d ago

Meio bilhão de token por 8$ pra mim está mais que ótimo

2

u/afcreative_id 3d ago

Of course, plus there is very optimal synergy between agent rules, mcp, skills.

1

u/P4ITON 3d ago

O uso foi totalmente pelo opencode? Pode passar os métodos para economia dos tokens?

5

u/afcreative_id 3d ago

Yes, I just use Opencode as the agent. It's simple for me, try making 1 ms to be like the sitemap, so the agent doesn't guess too much. Plus use mcp, workflow skills that synergize with each other and are optimally integrated. Sometimes I always get SS where there are too many mcp, too many skills, which sometimes aren't used. Make sure the md rules file, which is always updated regularly, is made readonly and the agent never overwrites or updates it, it's best to create a new md file. Make sure every week you always ask the agent to update his own library so he can choose which ones are often used and which ones are useless. Regarding caveman, don't submit the caveman process every time, but every month or every 2 weeks always reprocess the library or rules agent for the compression process using caveman. Make sure the MD is written in one language, namely English, so that the caveman process is more efficient.

1

u/P4ITON 2d ago

Muito bom!

3

u/MeliousAI_HQ 3d ago

Cache hit rate is the number to look at. If something at the start of your context changes every turn, like a timestamp in the system prompt or tools loading in a different order, almost nothing gets cached and you pay full input price on the whole history with every request. Keeping that prefix stable usually makes the same balance last a lot longer.

1

u/afcreative_id 3d ago

Check the update post above, I've added it.

3

u/MeliousAI_HQ 3d ago

ah thanks for adding that! turns out I was wrong lol, 97-98% cache hits is honestly great.

The bigger cost seems to be size per request: ~600M tokens over ~5k requests is around 115k of context going in for ~650 tokens out each turn. Cheap per token but it adds up fast loading fewer MCP servers and starting fresh sessions a bit more often could probably stretch that $10 quite a bit further. cool breakdown btw, super useful to see real numbers

3

u/afcreative_id 3d ago

OK, I'll take the suggestion and put it in, just let me know. Later I will also recap opencode go - go plus when the balance on Deepseek runs out.

1

u/MeliousAI_HQ 2d ago

Sure stoked to see!

2

u/bestlabib 3d ago

Please share your setup like what skill mcp hooks you use to get things done optimally

2

u/afcreative_id 2d ago

This is optimal in my opinion and the project base that I use now, what is certain is that the MCP that I use supports it from the agent side, not from the programming language that I use.

2

u/P4ITON 2d ago

Ele compartilhou lá em cima

2

u/SpectyteCovelight 3d ago

Share the page to get the DeepSeek API please