Hotakus/opencode-visual-cache

OpenCode TUI 插件 · 实时 Token 缓存命中率 · 侧边栏可视化 / Real-time Token Cache Hit Rate Sidebar Plugin for OpenCode TUI

What it solves

OpenCode Visual Cache is a TUI (Terminal User Interface) plugin for OpenCode that provides real-time visibility into LLM token caching. It helps users monitor cache hit rates, token usage details, and the associated costs and savings generated by prompt caching, which are typically hidden from the end-user in standard terminal interfaces.

How it works

The plugin integrates with the OpenCode SDK to pull real-time token data and pricing information from AI providers. It calculates the cache hit rate using industry-standard formulas and displays this data in a collapsible sidebar panel and an optional bottom status bar. It also estimates token distribution across different roles (system, user, sub-agents, tools) based on character counts to provide a breakdown of how tokens are being consumed.

Who it’s for

Developers and power users of OpenCode who want to track their API costs, optimize prompt caching efficiency, and monitor the token footprint of their sessions and sub-agents in real-time.

Highlights

  • Real-time Cache Monitoring: Displays cache hit rates with color-coded progress bars (Green for $\ge 85%$, Orange for $\ge 70%$, Red for $< 70%$).
  • Cost Tracking: Calculates session cumulative costs and the money saved via caching, supporting multiple currencies and custom exchange rates.
  • Detailed Token Breakdown: Tracks cache reads, cache writes, misses, and output tokens, with estimated distributions by role.
  • ** uma Balance Integration**: Queries account balances from multiple AI providers (e.g., DeepSeek, SiliconFlow, OpenRouter, Moonshot) with automatic provider switching.
  • Sub-agent Support: Allows users to switch views to monitor the cache statistics of specific sub-agents within a session.
  • Customizable UI: Features collapsible panels, multi-language support (Chinese, English, Japanese, Korean), and a configurable bottom status bar.

Related

  • Project
  • Project
  • Project
  • Project