Skip to content

Per-turn token usage, context occupancy, and cost display #125

Description

@harrryyd

Problem

After each turn completes, the user has no visible breakdown of:

  • Tokens used in that turn
  • Context window occupancy (% of max)
  • Approximate cost of the turn

Proposal

Add a per-turn summary UI that appears after each turn completes, showing:

  • Tokens used: input + output for the turn
  • Context window: percentage bar (usedTokens / maxTokens)
  • Cost estimate: based on model pricing × token counts

This data is already tracked internally:

  • ClaudeAdapter now captures per-request usage from message_start/message_delta stream events
  • thread.token-usage.updated events carry usedTokens, lastUsedTokens, totalProcessedTokens, maxTokens
  • Codex and OpenCode adapters emit similar usage events

Considerations

  • Should this be inline in the message timeline (after each assistant response) or a summary panel?
  • Should cost be shown by default or opt-in?
  • Model pricing table needed (may already exist in provider config?)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions