Summary
Claude Enterprise accounts fail to display usage in CodexBar with:
Could not parse Claude usage: missing session data
Enterprise plans don't have session-based rate limit windows (five_hour, seven_day, etc.) — they use a single monthly spend limit (e.g., $600/month). The OAuth usage endpoint returns spend data in extra_usage instead of the session window fields, so CodexBar's fallback chain in mapOAuthUsage exhausts and throws.
This is distinct from the previously-fixed five-hour-window omission in #726 / v0.24 — that fix added fallback through seven_day variants, but Enterprise responses have none of those windows.
What the dashboard shows
For reference, the Claude account dashboard renders this Enterprise data correctly:
Your usage limits — Enterprise
$434.43 of $600.00 spent · Spend limit · Resets Jun 1 · 72% used
CodexBar should be able to render the same.
Likely response shape (Enterprise)
{
"extra_usage": {
"is_enabled": true,
"monthly_limit": 600,
"used_credits": 434.43,
"utilization": 72,
"currency": "USD"
}
// no five_hour, no seven_day, no seven_day_opus, etc.
}
Root Cause
In ClaudeUsageFetcher.swift:mapOAuthUsage(_:credentials:), the v0.24 fallback chain is:
guard let primary = makeWindow(usage.fiveHour, windowMinutes: 5 * 60)
?? makeWindow(usage.sevenDay, windowMinutes: 7 * 24 * 60)
?? makeWindow(usage.sevenDayOAuthApps, windowMinutes: 7 * 24 * 60)
?? makeWindow(usage.sevenDaySonnet, windowMinutes: 7 * 24 * 60)
?? makeWindow(usage.sevenDayOpus, windowMinutes: 7 * 24 * 60)
else {
throw ClaudeUsageError.parseFailed("missing session data")
}
None of those fields are present for Enterprise responses, so the guard always fails.
Suggested Fix
- Detect Enterprise plans (via
subscriptionType and/or the presence of extra_usage.monthly_limit without any session windows) and render a spend-limit card instead of a session window — mirroring the dashboard's "$X of $Y spent · N% used · Resets ..." display.
- As a minimum, when no session windows are present but
extra_usage is valid, return successfully with the spend data populated rather than throwing missing session data.
Reproduction
- Use a Claude Enterprise account (long-lived OAuth token via
claude setup-token)
- Set CodexBar Claude Usage source = OAuth API
- Provider shows "last fetch failed: Could not parse Claude usage: missing session data" despite the API returning valid Enterprise spend data
Environment
- CodexBar 0.25.1 (May 11)
- Claude Code 2.1.128
- Account type: Claude Enterprise with monthly spend limit
Summary
Claude Enterprise accounts fail to display usage in CodexBar with:
Enterprise plans don't have session-based rate limit windows (
five_hour,seven_day, etc.) — they use a single monthly spend limit (e.g., $600/month). The OAuth usage endpoint returns spend data inextra_usageinstead of the session window fields, so CodexBar's fallback chain inmapOAuthUsageexhausts and throws.This is distinct from the previously-fixed five-hour-window omission in #726 / v0.24 — that fix added fallback through
seven_dayvariants, but Enterprise responses have none of those windows.What the dashboard shows
For reference, the Claude account dashboard renders this Enterprise data correctly:
CodexBar should be able to render the same.
Likely response shape (Enterprise)
{ "extra_usage": { "is_enabled": true, "monthly_limit": 600, "used_credits": 434.43, "utilization": 72, "currency": "USD" } // no five_hour, no seven_day, no seven_day_opus, etc. }Root Cause
In
ClaudeUsageFetcher.swift:mapOAuthUsage(_:credentials:), the v0.24 fallback chain is:None of those fields are present for Enterprise responses, so the guard always fails.
Suggested Fix
subscriptionTypeand/or the presence ofextra_usage.monthly_limitwithout any session windows) and render a spend-limit card instead of a session window — mirroring the dashboard's "$X of $Y spent · N% used · Resets ..." display.extra_usageis valid, return successfully with the spend data populated rather than throwingmissing session data.Reproduction
claude setup-token)Environment