Skip to content

feat(tui): persistent token usage display in session footer #18968

Closed

Description

@andrewdunndev

I'd like to see token usage in the session footer as a persistent display rather than relying on toast notifications from plugins. The footer already shows directory, LSP count, MCP count, and permissions. Token usage fits naturally here.

What I'm imagining:

~/project                                    142 tok/s · 4.5M in · 19K out · • 2 LSP · ⊙ 1 MCP

Three data points:

  • tok/s -- live tokens-per-second during streaming (fades or shows last value when idle)
  • in -- cumulative input tokens for the session (compact: K/M suffix)
  • out -- cumulative output tokens for the session

The data is already available in the message store (message.data.tokens has input, output, reasoning, cache breakdowns). The footer component (packages/opencode/src/cli/cmd/tui/routes/session/footer.tsx) would subscribe to message events and accumulate the totals.

For the tok/s calculation: track output tokens and elapsed time during the streaming phase of each assistant turn. Display the rate while streaming, show the final rate for a few seconds after completion, then hide or show "idle".

This is useful for understanding context consumption during long sessions and for comparing model performance across providers.

Happy to submit a PR.

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Mar 24, 2026
  2. github-actions commented on Mar 24, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • Feature requests must use the **[FEATURE]: ** prefix in the title (e.g. [FEATURE]: persistent token usage display in session footer)
    • The issue should use the Feature Request template, which includes a verification checkbox confirming you searched for existing issues

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


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

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. andrewdunndev commented on Mar 24, 2026

    @andrewdunndev
    Author

    Closing as duplicate of #17449 (real-time token display in footer) and #13003 (token usage in TUI). I'll comment on those with an implementation offer.

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

Metadata

Metadata

Assignees

Labels

needs:complianceThis means the issue will auto-close after 2 hours.opentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions