Skip to content

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

Closed

Description

@dmoliveira

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

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Jan 24, 2026
  2. github-actions commented on Jan 24, 2026

    @github-actions
    Contributor

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

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

  3. dmoliveira commented on Jan 24, 2026

    @dmoliveira
    Author

    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.

  4. github-actions commented on Mar 27, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 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

discussionUsed for feature requests, proposals, ideas, etc. Open discussionzenRelates to Zen

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions