Repository navigation
Description
The workflow
Codex (ChatGPT) and Claude subscriptions now come with usage-limit resets, even on a single account. When I hit a limit I want to see that I have a reset and spend it from bb's Provider usage card, the same place that already shows the limit I just hit.
Today I have to leave bb and redeem it in the provider's own client (Codex CLI /status → Redeem reset, Claude Code /limit-reset). bb never shows that a reset exists, so they can expire unused.
What happens today
- Provider usage shows windows (percent, reset time, plan) only. The usage-source contract (
provider-usage.v1.listResources/getResource) has no field for resets and no action. provider-codexalready fetcheschatgpt.com/backend-api/wham/usage, whose response includesrate_limit_reset_credits: { available_count, applicable_available_count }, but onlyplan_typeandrate_limitare parsed.provider-claude-codealready fetchesapi.anthropic.com/api/oauth/usage, but withoutcedar_ember=1, so the reset grants block is never returned.- Observed on bb 0.46.1 (Linux server host). A read-only check of my own Codex Pro login shows
available_count: 2, and bb shows nothing.
What you would expect
Scoped to the base Provider usage plugin and the two provider plugins, not the Account Pooler (#4157 covers that):
- Contract. An optional
resetCreditson a measurement:{ available, usableNow, nextExpiresAt? }, plus an optionalprovider-usage.v1.consumeReset({ resourceId, requestId })method returningreset | nothing_to_reset | no_credit | already_redeemed. Sources that do not implement it are unchanged. - provider-codex. Read
rate_limit_reset_creditsfrom the existing/wham/usagecall. Spend withPOST /wham/rate-limit-reset-credits/consume { redeem_request_id }, the same endpoint the open-source Codex CLI uses. - provider-claude-code. Add
cedar_ember=1&skip_spend=1to the existing usage request and readgrants[].resets_left,grants[].ends_at,next_grant_id. Spend withPOST /api/organizations/{org}/reset_rate_limits { program: "cedar_ember", grant_id, request_id }, the call Claude Code's/limit-resetmakes. - Usage card. A small "N resets" line on the provider row (with expiry when known) and a Use reset… action, enabled only when
usableNow > 0, behind a confirmation because a spent reset cannot be restored. Afterwards it refreshes that resource.
Each attempt sends a fresh idempotency key. nothing_to_reset keeps the credit.
I'd like to build this myself: the contract change, both provider plugins, and the card UI, with tests. I'll link a prototype branch from my fork here before opening a PR, and open the PR once this is signed off (I'm not in APPROVED_CONTRIBUTORS yet).
Context and alternatives
-
Related: Account Pooler: show and spend Claude and Codex usage-limit resets per account #4157 (the same capability for pooled accounts; its prototype already maps both provider APIs, and it lists Provider usage as a follow-up). This issue is that follow-up, for everyone with one account per provider.
-
Claude user agent. Grants are only returned to Claude Code clients.
provider-claude-coderuns next to the user's own installed Claude Code and already reads its version, so it can sendclaude-cli/<installed version> (external, cli)with that install's own OAuth token, rather than a hard-coded string. If that is not acceptable, Codex could ship alone first. -
Stability. The ChatGPT endpoints are visible in the open-source Codex client. The Claude ones are undocumented and may change, so failures there should just hide the reset line.
-
I searched open and closed issues for the same request.
-
If an agent wrote this, the body ends with
> AGENT GENERATED.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 23, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotApplied the missing classification:
providers,provider-codex,provider-claude-code.No existing classifications needed preservation; all applied values were verified. No reproduction report or pull request: this adds functionality rather than fixing unexpected existing behavior.
lanjak commentedon Oct 23, 2026
Prototype: main...lanjak:bb:provider-usage-reset-credits (one commit on
1e80ca7).What it does:
resetCredits: { available, usableNow, nextExpiresAt } | nullon an ok measurement (defaults to null, so existing sources are unchanged), plus an optionalprovider-usage.v1.consumeReset({ resourceId, requestId })that returnsreset | nothing_to_reset | no_credit | already_redeemed | failed. All five contract copies are updated identically.resetCreditsis optional on the ok usage object. The schemas are already.passthrough(), so older daemons keep working without aHOST_DAEMON_PROTOCOL_VERSIONbump.rate_limit_reset_creditsfrom the existing/wham/usageresponse, and callsGET /wham/rate-limit-reset-creditsfor the expiry only when the count is above 0. It spends a reset withPOST /wham/rate-limit-reset-credits/consumethrough a new host RPC on the machine that holds the login.cedar_ember=1&skip_spend=1to the existing usage request and spends a reset withPOST /api/organizations/{org}/reset_rate_limitsthrough a host RPC. The organization UUID comes from~/.claude.json.consumeResetandusableNow > 0, and the account is refreshed afterwards. AuseResetRPC backs the button and is callable withbb plugin rpc call.On the Claude user agent question: bb currently sends
claude-code/2.1.0, and against a real Max account that gets{"eligible": false, "ineligible_reason": "surface"}. Sendingclaude-cli/<installed version> (external, cli), with the version read from the user's own Claude Code install (cached for 10 minutes), getsineligible_reason: "no_grant"instead: the surface is accepted and that account simply has no grant at the moment.Verified:
canUseReset/useResetflow, and the card's confirm-before-spend step.{ available: 2, usableNow: 0, nextExpiresAt: "2026-10-29T18:45:52.547Z" }, which matches the account. Nothing was spent.Not done yet: a dedicated CLI command (today the only path is
bb plugin rpc call bb--provider-usage useReset), and a live redeem, because my account has no eligible window. Happy to add the CLI command if you want it before a PR.Add bb usage list and bb usage reset commands
lanjak commentedon Oct 23, 2026
Update: I added the CLI command to the prototype branch (
d5ab7d441).bb usage list [--refresh] [--json]prints every account the Provider usage card shows, with its ID, usage windows and reset credits.bb usage reset <id> --yes [--json]spends one reset. It refuses to run without--yes, and exits 1 when the provider rejects the reset.They are documented in
plugins/provider-usage/skills/provider-usage/SKILL.mdand the README.useResetalso relists sources when it does not know an ID yet, so a reset works right after a server restart. Tests cover the--yesrefusal (nothing is spent), thelisttext and JSON output, and a confirmed reset. Happy to rename the command if you would rather it live somewhere else.Show and spend Codex and Claude usage-limit resets in Provider usage
Add bb usage list and bb usage reset commands
lanjak commentedon Oct 30, 2026
Update: I rebased the prototype onto current
main. It is now two commits onabcff9f:c5d2b05d2(Provider usage resets) andd7ee56816(thebb usageCLI). Same link: main...lanjak:bb:provider-usage-reset-credits1e80ca7as the base,d5ab7d441as the tip) are out of date.main(a1bf55b6a).Verified:
lanjak commentedon Nov 4, 2026
#6688 raises a concern that applies here: the prototype reads reset credits from
wham/usageandoauth/usagewith the CLI's token, and sends aclaude-cli/...User-Agent to get past thesurfacecheck on Claude.I checked the supported interfaces instead:
codex app-server(0.163.0) hasaccount/rateLimits/readwithrateLimitResetCreditsandaccount/rateLimitResetCredit/consume(outcomes includenothingToReset). That is the same interface Use regular Claude and Codex interfaces for status and usage, and identify bb as its own client #6688 proposes for Codex usage (X1).get_usagewith usage windows. It has no grants and no reset action, and/limit-resetis interactive only.Proposal: rebuild this on
codex app-serverfor Codex (show and spend), drop the Claude part and the User-Agent change, and keep theresetCredits/consumeResetcontract provider-neutral so Claude can follow when Claude Code supports it.I'm an approved contributor now. Does this direction work for you? If so I'll rework the prototype and open the PR.