Skip to content

[FEATURE]: Show cached vs fresh token breakdown in context meter #34298

Closed as not planned

Description

@cul-de-trans

Description

Add the ability to display cached vs fresh token breakdown directly in the TUI context meter.

Problem

The context meter currently shows only the total token count, but doesn't distinguish between:

  • Fresh input tokens (standard pricing)
  • Cached input tokens (approximately 90% discount)

This makes it difficult to track actual API costs, since cached tokens are significantly cheaper.

Solution

Display cached vs fresh token breakdown directly on the context meter in the TUI.

Example display options:

  • "2.5K fresh / 5K cached"
  • Separate indicators for each type
  • Cost breakdown if possible

Why

  • Different token types have drastically different pricing
  • Users need visibility to optimize API usage and costs
  • Claude API already provides this information in usage data
  • Better financial awareness for teams

Verification

  • I have searched existing issues and didn't find duplicates
  • This is a feature request for improving OpenCode TUI

Activity

  1. github-actions commented on Jun 28, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please check if one of these covers your request before this one is reviewed.

  2. sharyuke commented on Jul 1, 2026

    @sharyuke

    👋 Related, but slightly broader. Your feature is essentially one specific use case of "plugin-controllable status line items."

    My use case

    I use a MiniMax Coding Plan subscription and want to always see my remaining quota (5h · 66% remaining) right next to the existing context meter (65.1K (7%)) in the bottom status bar.

    What I tried

    1. Wrote a plugin that calls client.tui.showToast on session.idle — works, but:
    2. Looked for a status-line plugin API — doesn't exist. The plugin SDK only exposes tui.toast.show, tui.prompt.append, tui.executeCommand.

    Proposal

    Generalize this issue to: allow plugins to register persistent status-line items alongside the context meter. Something like:

    client.tui.registerStatusItem({
      id: "minimax-quota",
      label: "MiniMax",
      render: () => `[####------] 66% · 1h24m`,
      interval: 60_000, // ms — re-render cadence
    })

    Use cases beyond my own

    • WakaTime coding time
    • Custom CI / build status
    • Plugin authors currently working around this with tui.toast.show (which is the wrong primitive)

    Why bundle with this issue?

    Both touch the same UI surface (the bottom status bar / context meter). A single feature that supports both "show internal sub-breakdowns" and "let plugins add their own items" is cleaner than two separate issues.

  3. manuelfedele commented on Aug 3, 2026

    @manuelfedele

    I have a focused follow-up for the compact web/desktop context tooltip: show cache read/write counts only when the provider reports nonzero values. The full Context view already exposes these counters.

    I have prepared a small UI patch for this scope and can open a PR once maintainers approve it.

  4. github-actions commented on Oct 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions