[PR #10520] feat(app): add provider usage breakdown to session context #13469

Open
opened 2026-02-16 18:18:19 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10520

State: open
Merged: No


Summary

Add per-provider token usage breakdown to the session context usage tooltip, making it easier for users to understand their token consumption across different AI providers.

Changes

  • Enhanced SessionContextUsage component with provider breakdown:

    • Shows per-provider token counts with emoji indicators (🟣 Anthropic, 🔵 Google, 🟢 OpenAI, etc.)
    • Displays percentage breakdown for each provider
    • Formats token counts (e.g., 1.2M, 500K)
    • Separates provider usage from context window stats
  • Added SessionContextUsage to session header for better visibility

Screenshot

When hovering the usage indicator:

┌─────────────────────────────────┐
│ Provider Usage                   │
│ ─────────────────────────────── │
│ 🟣 Anthropic     1.2M      62%  │
│ 🔵 Google        500K      25%  │  
│ 🟢 OpenAI        250K      13%  │
│ ─────────────────────────────── │
│ Total            2.0M           │
├─────────────────────────────────┤
│ Context Tokens: 150,000         │
│ Window Usage: 45%               │
│ Total Cost: $2.50               │
└─────────────────────────────────┘

Why

Multi-model users often want to know which providers they're consuming the most tokens from. This helps with:

  • Cost optimization (knowing which provider is being used most)
  • Usage monitoring across different AI providers
  • Better transparency in multi-agent workflows (e.g., oh-my-opencode)
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10520 **State:** open **Merged:** No --- ## Summary Add per-provider token usage breakdown to the session context usage tooltip, making it easier for users to understand their token consumption across different AI providers. ## Changes - **Enhanced `SessionContextUsage` component** with provider breakdown: - Shows per-provider token counts with emoji indicators (🟣 Anthropic, 🔵 Google, 🟢 OpenAI, etc.) - Displays percentage breakdown for each provider - Formats token counts (e.g., 1.2M, 500K) - Separates provider usage from context window stats - **Added `SessionContextUsage` to session header** for better visibility ## Screenshot When hovering the usage indicator: ``` ┌─────────────────────────────────┐ │ Provider Usage │ │ ─────────────────────────────── │ │ 🟣 Anthropic 1.2M 62% │ │ 🔵 Google 500K 25% │ │ 🟢 OpenAI 250K 13% │ │ ─────────────────────────────── │ │ Total 2.0M │ ├─────────────────────────────────┤ │ Context Tokens: 150,000 │ │ Window Usage: 45% │ │ Total Cost: $2.50 │ └─────────────────────────────────┘ ``` ## Why Multi-model users often want to know which providers they're consuming the most tokens from. This helps with: - Cost optimization (knowing which provider is being used most) - Usage monitoring across different AI providers - Better transparency in multi-agent workflows (e.g., oh-my-opencode)
yindo added the pull-request label 2026-02-16 18:18:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13469