Skip to content

fix(proxies): refresh claude usage through the management api - #833

Merged
nixuuu merged 1 commit into
devfrom
fix/cliproxyapi-limit-reading
Nov 15, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/cliproxyapi-limit-reading

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 15, 2026

Copy link
Copy Markdown
Member

Change

Claude quota could show 45% remaining while the provider reported 17%, because Canopy only read passive response headers cached by CLIProxyAPI. Read current Claude OAuth usage through the management API, with the proxy substituting the account token internally. A valid provider response takes precedence; unavailable or invalid active reads retain the passive fallback.

Resolve passive windows from credential and model observations by observation time, keeping each window's percentage, reset and status together. Keep exhausted Opus/Sonnet allowances scoped to their model instead of zeroing the shared weekly balance. Update docs/proxies.md with the behavior and limits.

Verification

  • Targeted check:tmp runs: proxy account usage, existing management integration, observation parsing and capacity projection (25 tests passed across the affected files).
  • Gateway and domain package typechecks; lint and formatting on edited files; test shard coverage check.
  • Live check against the configured CLIProxyAPI: passive weekly balance 45%, current provider response 17%, corrected reader 17%. Management and provider requests returned HTTP 200. No credentials or account identities are included here.
  • Full repository checks and builds are left to CI. No UI text changed.

Fixes: #727

Read current Claude OAuth usage through the proxy so stale passive response headers do not overstate available capacity. Keep per-model limits scoped to their models and use the latest passive window as a fallback.

Fixes: #727
@nixuuu
nixuuu enabled auto-merge (squash) November 15, 2026 13:56
@nixuuu
nixuuu merged commit bd1a17e into dev Nov 15, 2026
11 checks passed
@nixuuu
nixuuu deleted the fix/cliproxyapi-limit-reading branch November 15, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant