Skip to content

Chat context popover: show Anthropic plan usage (5h/weekly/credits) instead of meaningless cost on subscription billing #102771

Description

@steipete

What happened

The Control UI chat composer's context popover shows token counts and dollar cost tiles for every session, but never shows subscription plan usage. For Anthropic subscription users (Claude Pro/Max via the claude-cli backend or anthropic OAuth), the interesting cost-control facts are the plan windows — 5-hour limit, weekly all-models, weekly model-scoped (e.g. Fable), and usage credits — the same data the Codex path already feeds through ProviderUsageSnapshot.

Two concrete gaps:

  1. claude-cli setups get no usage at all. The external CLI sync stores the Claude Code keychain login under provider claude-cli, but resolveUsageProviderId("claude-cli") does not map to anthropic, so usage loading ends in Unsupported provider and models.authStatus carries no windows. The popover in the screenshot shows only context window + $0.00 cost tiles and Est. cost $0.020 — meaningless numbers for a flat-rate subscription.
  2. The popover renders cost, not cost control. Even when windows exist (codex OAuth), the chat surface reduces them to a single "Usage Remaining 28%" pill. There is no per-window breakdown, no reset times, no usage credits, and no plan label.

Expected

  • Subscription-billed sessions (provider has plan usage windows): the popover shows plan usage bars — 5-hour limit, weekly all models, weekly model-scoped, usage credits ($X of $Y) — with reset times and a plan label (e.g. "Max (20x)"), like CodexBar does.
  • API-billed sessions: keep the current per-token dollar estimates (Est. cost + cost by type).
  • Works for claude-cli-only setups (Claude Code keychain login), anthropic OAuth, and codex OAuth alike.

Environment

  • OpenClaw web Control UI, chat composer context popover
  • Anthropic Max (20x) subscription via claude-cli backend

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.app: web-uiApp: web-uiclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maintainerMaintainer-authored PR

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions