t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Hub-routed Claude accounts never show limit reset credits (usage call lacks cedar_ember=1 and uses an old Claude Code UA)

Open murmaider227 opened this issue 2 weeks ago • 1 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Run CLIProxyAPI (tested on v8.0.66, the latest release) with several Claude OAuth accounts that have free limit resets (claude.ai → Settings → Usage shows "Limit resets: 2 available" — a Full reset and a Fable reset).
  2. In T3 Code add the hub as a usage-limit source (Settings → Providers → Add hub, management key).
  3. Open Usage → Limits (or the composer usage popover).

Expected behavior

Hub-routed Claude accounts show their reset credits, the same way directly connected Claude instances and hub-routed Codex accounts do.

Actual behavior

No reset credits are shown for any hub-routed Claude account. Session/weekly windows render normally.

Cause (main @ 40c36825, same code in 0.1.9-nightly.20261111.4501):

  • apps/server/src/usage/cliproxyApi.ts:306-312 — the claude entry of HUB_PROVIDERS calls https://api.anthropic.com/api/oauth/usage without ?cedar_ember=1 and with User-Agent: claude-code/2.1.273. The ClaudeUsage schema has no cedar_ember, and the returned usageLimits never sets resetCredits (only the Codex entry builds them, lines ~275-287).
  • The direct path, apps/server/src/provider/claudeResetCredits.ts:204-221, does it correctly: cedar_ember=1&skip_spend=1 + user-agent: claude-cli/${version} (external, cli), then claudeResetCreditsToContract(body.cedar_ember, …).

Verified through the hub's POST /v0/management/api-call (which forwards url, query and headers unchanged) for 5 Claude accounts:

Request cedar_ember
/api/oauth/usage (what T3 sends now) null
/api/oauth/usage?cedar_ember=1 + UA claude-code/2.1.273 eligible: false, no grants
/api/oauth/usage?cedar_ember=1 + UA claude-cli/2.1.321 (external, cli) eligible: true, 2 grants per account

So both the missing query param and the old UA have to change. The web side already renders hub resetCredits generically (packages/shared/src/usageLimits.ts builds resetCreditInput from resetCredits.nextCreditId), so this is server-only.

Related gap: consume in cliproxyApi.ts (~line 513) only handles codex accounts, so redeeming a Claude reset through the hub would fail even once credits are shown.

Suggested minimal fix: send ?cedar_ember=1 with a current claude-cli/<version> (external, cli) UA in the hub Claude reader, add cedar_ember to ClaudeUsage, and merge claudeResetCreditsToContract(usage.cedar_ember, now) into usageLimits (without skip_spend, since this call also reads spend).

Impact

Minor bug or occasional failure

Version or commit

0.1.9-nightly.20261111.4501 (c90b67859a6d); main @ 40c36825

Environment

Windows 11, T3 Code Nightly desktop, CLIProxyAPI v8.0.66, Claude Code 2.1.321, Claude Team accounts

Logs or stack traces

No error is logged; the reset block is simply never requested.

Workaround

None through the hub. Accounts connected directly as Claude instances (own claude.ai login) show resets.

murmaider227 avatar Nov 11 '26 07:11 murmaider227

Still reproduces on 0.1.10 (macOS, desktop) with CLIProxyAPI routing two Claude Max OAuth accounts.

Re-checked through the hub's api-call today with Claude Code's current UA:

Request cedar_ember
/api/oauth/usage + UA claude-code/2.1.273 (what T3 sends) null
/api/oauth/usage?cedar_ember=1&skip_spend=1 + UA claude-code/2.1.273 eligible: false, ineligible_reason: "surface", no grants
same + UA claude-cli/2.1.326 (external, cli) eligible: true, grant full-reset-2611 (resets_left: 1, usable_now: true)

claude.ai → Settings → Usage shows the same "Full reset" as available, but the hub-routed account in Usage → Limits shows no reset badge, unlike the hub-routed Codex account right beside it.

cranberrylettuce avatar Nov 17 '26 08:11 cranberrylettuce