Skip to content

feat(shell): show claude-bridge subscription usage (5h/7d windows) in the bar and /gentle:usage panel #1399

Description

@QuBiit0

Before submitting

  • I searched open and closed issues and did not find a request for this feature.
  • I reviewed this request and removed credentials, tokens, private paths, hostnames, and other sensitive data.

Problem or opportunity

With Pi on the claude-bridge provider (Claude Code through the Agent SDK, the way a Claude Max/Pro subscription is used from Gentle Shell), the bar shows $0.000 and /gentle:usage (alt+u) reports:

✿ claude-bridge · no subscription usage for this provider

The 5-hour and 7-day plan windows that Claude Code shows with /usage are invisible in Pi, so the user only learns about the window when the bridge returns a five_hour rejection.

The numbers are already delivered to the bridge on every turn. From one morning of bridge log (156 events):

consumeQuery: rate_limit_event {"status":"allowed","rateLimitType":"five_hour","unifiedWindows":{"five_hour":{"utilization":0.63,"resetsAt":1790245200},"seven_day":{"utilization":...}}}

What is missing is the connection:

  • Gentle Shell has adapters for openai-codex, anthropic (anthropic-ratelimit-unified-* headers) and nan (feat(shell): show NaN Cloud (nan) per-model usage in the bar and /gentle:usage panel #1177 / feat(shell): show NaN Cloud per-model usage in the bar and /gentle:usage panel #1180), plus the generic gentle-pi:usage-source/v1 hook in lib/shell-usage.ts. Neither pi-claude-bridge nor the @schuettc/pi-claude-bridge fork emits that hook.
  • The @schuettc/pi-claude-bridge fork (the build that carries the unreleased upstream fixes, including Opus 5.5 at 1M) already normalizes the SDK events into a process-wide bus: globalThis[Symbol.for("pi.provider-usage.bus.v1")] exposing register / adapters / subscribe / publish, with windows five_hour, seven_day, seven_day_opus, seven_day_sonnet, seven_day_oauth_apps, each carrying usedPercent and resetsAt (src/usage-bus.ts). Gentle Shell does not read it.

Proposed outcome

Show claude-bridge subscription usage in the bar and in /gentle:usage, following the NaN precedent (#1180):

  1. When the active model's provider is claude-bridge, resolve globalThis[Symbol.for("pi.provider-usage.bus.v1")]; if present, subscribe and map the latest claude snapshot to ProviderUsage: five_hour and seven_day as the main limits, seven_day_opus / seven_day_sonnet / seven_day_oauth_apps as additional limits, each with used percent and reset time.
  2. Render it where Codex shows its percentage in the bar, and as a provider block in the panel.
  3. When the bus is absent (upstream pi-claude-bridge without the fork), replace the generic unsupported note with a pending note that says the bridge build does not publish usage, so the user knows why.

I can contribute the implementation once this is approved.

Alternatives considered

  • Asking upstream pi-claude-bridge to emit gentle-pi:usage-source/v1: upstream is provider-agnostic and should not learn Gentle Shell's event name; consuming the neutral bus symbol keeps that boundary.
  • Reading Claude Code's on-disk usage cache: brittle and undocumented; the SDK already streams the values per turn.
  • Leaving $0.000: correct for a subscription but hides that the real budget is the plan window.

Additional context

Windows 11, pi 0.87.1, gentle-pi 3.7.0, gentle-ai 3.7.0, @schuettc/pi-claude-bridge 0.8.0-schuettc.5, Claude Max, model claude-opus-5-5. Originally filed in the wrong repository as Gentleman-Programming/gentle-ai#4945; that one will be closed in favour of this issue. Sibling requests for other providers: #1047, #872, #800, #687, #1261.

No activity

Activity on this issue will appear here.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions