Expose organization API credit balance to statusLine scripts (and via Admin API)

Resolved 💬 5 comments Opened Apr 13, 2026 by flannk Closed May 31, 2026

Summary

Pay-as-you-go API users have no programmatic way to see their remaining credit balance. The statusLine stdin payload includes model and rate_limits.{five_hour,seven_day}.used_percentage, but nothing about the actual money left in the account.

Why this matters

  • The 5h / 7d rate-limit bars measure throughput, not money. They tell me nothing about whether my next call will fail with credit balance is too low.
  • The console at console.anthropic.com shows the balance, but there is no public API endpoint for it. GET /v1/organizations/balance returns 404.
  • For people topping up credits manually (no auto-recharge), this means jobs can die mid-run with no warning. A statusLine bar would have warned me hours earlier.
  • I built a local approximation by parsing ~/.claude/projects/**/*.jsonl usage fields and applying per-token pricing — but that only covers Claude Code traffic, ignores SDK / MCP / direct API traffic, and drifts from reality. The org itself knows the real number.

Proposed solutions (either works)

Option A — statusLine stdin enrichment
Add an optional field to the JSON Claude Code pipes to statusLine commands:

{
  \"model\": { ... },
  \"rate_limits\": { ... },
  \"organization\": {
    \"credit_balance_usd\": 27.43,
    \"auto_recharge_enabled\": false
  }
}

This is the minimum-friction fix — every existing statusLine script can opt in.

Option B — Public Admin API endpoint
Expose GET /v1/organizations/me/balance (or similar) returning current credit balance + auto-recharge state. Then anyone (statusLine, dashboards, CI cost gates) can query it directly with their Admin API key.

Option A is enough for most users; Option B is the more general fix.

Acceptance

  • Some way for a script to read \"USD remaining in this account, right now\" without scraping the console.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗