[FEATURE]: Near-Real-Time Token and Cost Visibility #7420

Open
opened 2026-02-16 18:07:06 -05:00 by yindo · 2 comments
Owner

Originally created by @dmoliveira on GitHub (Jan 24, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Overview

Introduce a near-real-time usage and cost visibility panel in OpenCode that surfaces token consumption and spend while users work. The goal is to prevent unexpected limit hits, reduce frustration, and help users actively manage cost and performance, especially when using expensive reasoning or thinking models.

Problem

Users often discover they have hit daily or weekly limits only after the fact. This breaks flow, interrupts work, and discourages experimentation. The problem becomes more severe with long-running tasks, agents, or high-cost models, where usage can spike quickly without clear feedback.

Proposed Feature

Add a lightweight, always-visible usage indicator that updates near-real-time during task execution.

The feature should provide:

  • Token usage for the current task, split by input and output (input optional)
  • Usage and cost status aligned with the user’s billing model
  • Clear visibility of reset timing for limits
Image

Key Capabilities

1. Live Token Consumption

  • Show incremental token usage while a task is running
  • Split by:
    • Input tokens (optional)
    • Output tokens
  • Display both:
    • Current task usage
    • Session-level totals

2. Plan-Aware Usage Display

  • API key based usage
    • Show estimated cost in USD
    • Currency configurable via settings
  • Subscription or plan based usage
    • Show daily and weekly usage as percentages
    • Clearly indicate remaining allowance
    • Display next reset time for daily and weekly limits

3. Early Warning Signals

  • Soft warnings when usage crosses configurable thresholds (for example 70 percent or 90 percent)
  • Clear visual cues when approaching limits, before hard failures occur

Functional Requirements

  • Usage updates within seconds of token generation
  • Accurate token accounting aligned with provider billing
  • Works consistently across:
    • Single prompts
    • Agents
    • Multi-step workflows
  • Minimal UI footprint, such as a status bar indicator or collapsible panel

Non-Functional Requirements

  • Low overhead with no noticeable latency impact
  • Graceful degradation to last known usage if real-time updates fail
  • Extensible to support new plans, limits, and pricing schemes
  • Clear and consistent visual language

Example UI Behaviour

  • While a task runs, the status bar updates live with token usage
  • API key users see:
    Task cost: USD 0.42 | Session: USD 1.87
  • Plan users see:
    Daily usage: 62% | Weekly usage: 41% | Reset in 3h 12m
  • When nearing limits, the indicator turns amber with a short warning tooltip

Impact

  • Fewer unexpected limit hits
  • Better cost awareness and control
  • Higher confidence when using advanced or expensive models
  • Improved developer experience and trust in OpenCode as a professional-grade AI coding assistant
Originally created by @dmoliveira on GitHub (Jan 24, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request ## Overview Introduce a near-real-time usage and cost visibility panel in OpenCode that surfaces token consumption and spend while users work. The goal is to prevent unexpected limit hits, reduce frustration, and help users actively manage cost and performance, especially when using expensive reasoning or thinking models. ## Problem Users often discover they have hit daily or weekly limits only after the fact. This breaks flow, interrupts work, and discourages experimentation. The problem becomes more severe with long-running tasks, agents, or high-cost models, where usage can spike quickly without clear feedback. ## Proposed Feature Add a lightweight, always-visible usage indicator that updates near-real-time during task execution. The feature should provide: - Token usage for the current task, split by input and output (input optional) - Usage and cost status aligned with the user’s billing model - Clear visibility of reset timing for limits <img width="1024" height="559" alt="Image" src="https://github.com/user-attachments/assets/20238b12-3cce-4c4e-890a-3ac9708b7f88" /> ## Key Capabilities ### 1. Live Token Consumption - Show incremental token usage while a task is running - Split by: - Input tokens (optional) - Output tokens - Display both: - Current task usage - Session-level totals ### 2. Plan-Aware Usage Display - **API key based usage** - Show estimated cost in USD - Currency configurable via settings - **Subscription or plan based usage** - Show daily and weekly usage as percentages - Clearly indicate remaining allowance - Display next reset time for daily and weekly limits ### 3. Early Warning Signals - Soft warnings when usage crosses configurable thresholds (for example 70 percent or 90 percent) - Clear visual cues when approaching limits, before hard failures occur ## Functional Requirements - Usage updates within seconds of token generation - Accurate token accounting aligned with provider billing - Works consistently across: - Single prompts - Agents - Multi-step workflows - Minimal UI footprint, such as a status bar indicator or collapsible panel ## Non-Functional Requirements - Low overhead with no noticeable latency impact - Graceful degradation to last known usage if real-time updates fail - Extensible to support new plans, limits, and pricing schemes - Clear and consistent visual language ## Example UI Behaviour - While a task runs, the status bar updates live with token usage - API key users see: `Task cost: USD 0.42 | Session: USD 1.87` - Plan users see: `Daily usage: 62% | Weekly usage: 41% | Reset in 3h 12m` - When nearing limits, the indicator turns amber with a short warning tooltip ## Impact - Fewer unexpected limit hits - Better cost awareness and control - Higher confidence when using advanced or expensive models - Improved developer experience and trust in OpenCode as a professional-grade AI coding assistant
yindo added the discussionzen labels 2026-02-16 18:07:06 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 24, 2026):

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

  • #4925: Display total cost for session - Requests visibility of combined session costs and sub-agent costs
  • #5555: Session-specific stats command and exit summary - Proposes showing detailed usage statistics including token breakdown and costs
  • #4559: Add configurable spending limit / "Kill Switch" per session - Related to cost awareness and preventing unexpected spending

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 24, 2026): This issue might be a duplicate of existing issues. Please check: - #4925: Display total cost for session - Requests visibility of combined session costs and sub-agent costs - #5555: Session-specific stats command and exit summary - Proposes showing detailed usage statistics including token breakdown and costs - #4559: Add configurable spending limit / "Kill Switch" per session - Related to cost awareness and preventing unexpected spending Feel free to ignore if none of these address your specific case.
Author
Owner

@dmoliveira commented on GitHub (Jan 24, 2026):

I see this request as only partially covered by the existing issues. The ones linked focus mainly on post-hoc visibility (session summaries, exit stats) or hard controls (spending limits / kill switches).

What this proposal is trying to address is a slightly different problem: near real-time, in-flow visibility while work is actively happening. The intent is to prevent surprises before limits are hit, especially for long-running tasks, agents, or high-cost models, rather than just reporting usage after the fact.

In that sense, I see this as complementary and potentially unifying those ideas, shifting cost awareness from reactive to proactive, with a lightweight, always-visible indicator that helps users manage trade-offs as they work.

@dmoliveira commented on GitHub (Jan 24, 2026): I see this request as only *partially* covered by the existing issues. The ones linked focus mainly on post-hoc visibility (session summaries, exit stats) or hard controls (spending limits / kill switches). What this proposal is trying to address is a slightly different problem: **near real-time, in-flow visibility** while work is actively happening. The intent is to prevent surprises before limits are hit, especially for long-running tasks, agents, or high-cost models, rather than just reporting usage after the fact. In that sense, I see this as complementary and potentially unifying those ideas, shifting cost awareness from reactive to proactive, with a lightweight, always-visible indicator that helps users manage trade-offs as they work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7420