explaingit

hotakus/opencode-visual-cache

Analysis updated 2026-06-24

37TypeScriptAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

Sidebar plugin for the OpenCode terminal coding tool that shows real time prompt cache hit rate, token breakdown, session cost, and money saved.

Mindmap

mindmap
  root((opencode-visual-cache))
    Inputs
      OpenCode SDK
      Model pricing
      Token events
    Outputs
      Hit rate gauge
      Token breakdown
      Session cost
    Use Cases
      Tune prompt caching
      Track spend per session
      Pick a cheaper model
    Tech Stack
      TypeScript
      OpenCode plugin API
      npm
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Monitor prompt cache hit rate while coding with OpenCode to keep it above 85 percent

USE CASE 2

Track per session AI spend in USD, CNY, EUR, JPY, GBP, or KRW

USE CASE 3

See how tokens split between system prompt, user input, tool calls, and tool results

What is it built with?

TypeScriptOpenCodenpm

How does it compare?

hotakus/opencode-visual-cachejavlonbek1233/greenroommoakk/npmstats
Stars373737
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyeasyeasy
Complexity2/51/52/5
Audiencedevelopervibe coderdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

OpenCode caches the first installed plugin version, so upgrading requires clearing the plugin cache before reinstalling.

MIT license: free to use, modify, and redistribute with attribution and no warranty.

In plain English

OpenCode Visual Cache is a plugin for OpenCode, a terminal coding tool, that shows how often the model's prompt cache is being hit while you work. The README, written in Chinese, frames it as a sidebar panel that updates in real time. Alongside the cache hit rate, it displays a breakdown of tokens read from cache, written to cache, missed, and produced as output, plus the running session cost and how much money the cache has saved you so far. The panel also shows pricing information for the current model, including input, cache read, and cache write unit prices, all pulled dynamically from the provider configuration. There is a separate breakdown that estimates how many tokens are being spent on system prompts versus user input, agent instructions, tool calls, and tool results. Each section of the panel can be collapsed or hidden, and the plugin remembers the collapsed state between restarts. Colors come from the OpenCode theme and are desaturated automatically, with the hit rate value going green above 85 percent, orange above 70 percent, and red below 70 percent. Installing is described two ways. The recommended path is to press Ctrl plus P inside OpenCode, search for install plugin, type opencode-visual-cache@latest, and press enter. The manual path is npm install -g opencode-visual-cache@latest, then editing ~/.config/opencode/tui.jsonc to list the plugin. After a restart the sidebar panel appears in any session. The plugin adds four slash commands. /cache-currency switches the displayed currency between USD, CNY, EUR, JPY, GBP, and KRW, with default exchange rates filled in. /cache-rate lets you set a custom exchange rate. /cache-section toggles which subsections and the outer border are visible. /cache-config shows the current configuration. All changes take effect immediately and persist. The README notes a known OpenCode issue that locks the plugin to the version first installed, and gives the commands to clear the OpenCode plugin cache on Windows or on macOS and Linux before reinstalling. Language can be forced to English by setting the CACHE_TUI_LANG environment variable to en. The plugin is described as model agnostic and works with any AI model OpenCode supports, since token and pricing data come through the standard OpenCode SDK interface. License is MIT.

Copy-paste prompts

Prompt 1
Install opencode-visual-cache and explain what each panel section in the sidebar means
Prompt 2
Set CACHE_TUI_LANG to en and switch the displayed currency to EUR with a custom exchange rate
Prompt 3
Fork opencode-visual-cache and add a CSV export of the per session token and cost breakdown
Prompt 4
Diagnose why the opencode-visual-cache panel is stuck on an old version and reset the OpenCode plugin cache on macOS

Frequently asked questions

What is opencode-visual-cache?

Sidebar plugin for the OpenCode terminal coding tool that shows real time prompt cache hit rate, token breakdown, session cost, and money saved.

What language is opencode-visual-cache written in?

Mainly TypeScript. The stack also includes TypeScript, OpenCode, npm.

What license does opencode-visual-cache use?

MIT license: free to use, modify, and redistribute with attribution and no warranty.

How hard is opencode-visual-cache to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is opencode-visual-cache for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.