Skip to content

Read a gpt-load pool's balance for Anthropic channels - #7

Merged
Gyarados4157 merged 1 commit into
mainfrom
feat/gpt-load-channel-balance
Oct 22, 2026
Merged

Gyarados4157 merged 1 commit into
mainfrom
feat/gpt-load-channel-balance

Conversation

@Gyarados4157

Copy link
Copy Markdown
Collaborator

Problem

gpt-load-claude is an Anthropic channel (type 14). updateStandardChannelBalance had no branch for type 14, so the balance always showed $0 / "Never".

Change

  • Type 14 now calls GET {base_url}/v1/pool/balance with the channel key as Bearer and stores balance. That value is the engine's estimate of the subscription pool's weekly remainder, in reference USD.
  • A channel whose base URL is the official Anthropic host keeps "Not implemented yet".
  • Nothing is stored for a non-200 response, an inactive key, or a missing/non-finite/negative balance. A failed estimate therefore never becomes a zero balance that auto-disables the only channel.

Depends on the engine endpoint in alphafoxai/corecode-engine. Merge after the engine deploy. Until then the button reports "upstream does not report a pool balance" and stores nothing.

Verification

  • channel_billing_anthropic_pool_test.go covers:
    • path, Bearer key, trailing-slash base URL, and storing the balance;
    • storing nothing for 503, 404, an inactive key, a missing balance, and a negative balance;
    • skipping the official host.
  • The Sub2API balance tests and go vet ./controller/ pass.

Merging deploys to production (the production environment has no protection rules).

🤖 Generated with Claude Code

Anthropic channels had no balance branch, so the gpt-load channel always
showed $0 and "Never". Type 14 now reads GET {base_url}/v1/pool/balance with
the channel key and stores the weekly remainder; the official Anthropic host
keeps the unsupported answer. Errors, an inactive key, or a missing or
negative balance store nothing, so a failed estimate cannot become a zero
balance that auto-disables the channel.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Gyarados4157
Gyarados4157 merged commit 0bd899a into main Oct 22, 2026
@Gyarados4157
Gyarados4157 deleted the feat/gpt-load-channel-balance branch October 22, 2026 13:40
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