r/opencode • • 29d ago

Opencode context stats and token cache hit

Other harnesses have /context command to see stats of the context - how many tokens are in system prompt, how many for tools, etc.
How to get that in Opencode?
Also, how do you see cache hit ratio? Using Claude, Copilot subs, and Deepseek API, and couldn't find anywhere whats the cache stats of each model...

2 Upvotes

4 comments sorted by

2

u/Primary-Meal-2264 29d ago

Just ask opencode agent to build a TUI plugin for you

1

u/RndRedditPerson 29d ago

Good idea, will definitely try it!

1

u/UnusualJackfruit159 29d ago edited 29d ago

Not sure about individual tool spending, but the web console and API reports token spending per model in the week/month time frames. Best possible resolution seems to be requests/h via web console, apparently not exported in API. I built myself a little tool to monitor these and tell me current best models/$:
https://github.com/codesam88/opencode-models

Not very sophisticated, but better (perhaps) than browsing their website every couple days and trying to sort/map tables in my head..

1

u/RndRedditPerson 29d ago

Not what i am asking for, but looks interesting to get at least those global stats! Unfortunatelly i don't use Opencode subscription, would be good to support all connected OC providers