Check API credit balance programmatically
The balance endpoint, auth header and response field for every major metered API, and the ones that only show a balance in the console.
Balance endpoints
| Provider | Call | Auth | Read |
|---|---|---|---|
| OpenRouter | GET openrouter.ai/api/v1/credits | Bearer | total_credits − total_usage (USD) |
| DeepSeek | GET api.deepseek.com/user/balance | Bearer | balance_infos[].total_balance |
| Firecrawl | GET api.firecrawl.dev/v2/team/credit-usage | Bearer | data.remainingCredits |
| Tavily | GET api.tavily.com/usage | Bearer | account.plan_limit − plan_usage |
| Bright Data | GET api.brightdata.com/customer/balance | Bearer | balance (USD) |
| Apify | GET api.apify.com/v2/users/me/limits | Bearer | maxMonthlyUsageUsd − monthlyUsageUsd |
| Apollo.io | POST api.apollo.io/api/v1/usage_stats/credit_usage_stats | X-Api-Key | lead_credit.left_over |
| Hunter.io | GET api.hunter.io/v2/account | ?api_key= | credits.available − credits.used |
| Prospeo | POST api.prospeo.io/account-information | X-KEY | response.remaining_credits |
| LeadMagic | GET api.leadmagic.io/v1/credits | X-API-Key | credits |
| People Data Labs | HEAD api.peopledatalabs.com/v5/person/enrich | X-Api-Key | X-TotalLimit-Remaining header |
| Crustdata | GET api.crustdata.com/account/credits | Bearer + x-api-version | account.credits |
| Coresignal | POST …/company_multi_source/search/es_dsl | apikey | x-credits-remaining header |
| Instantly | GET api.instantly.ai/api/v2/workspace-billing/plan-details | Bearer | subscriptions.credits.available_credits |
| MillionVerifier | GET api.millionverifier.com/api/v3/credits | ?api= | credits |
| SecurityTrails | GET api.securitytrails.com/v1/account/usage | APIKEY | allowed_monthly_usage − current_monthly_usage |
| WhoisXML API | GET user.whoisxmlapi.com/user-service/account-balance | ?apiKey= | data[].credits |
Each provider page has the full curl, the response shape and the gotchas. Two that catch people: Hunter's available is the allowance, not what's left, and Tavily reports what you've used, not what remains.
Three balances in one script
#!/usr/bin/env bash set -euo pipefail or=$(curl -sf https://openrouter.ai/api/v1/credits -H "Authorization: Bearer $OPENROUTER_API_KEY" \ | jq '.data.total_credits - .data.total_usage') ds=$(curl -sf https://api.deepseek.com/user/balance -H "Authorization: Bearer $DEEPSEEK_API_KEY" \ | jq -r '(.balance_infos[] | select(.currency == "USD") | .total_balance) // .balance_infos[0].total_balance') fc=$(curl -sf https://api.firecrawl.dev/v2/team/credit-usage -H "Authorization: Bearer $FIRECRAWL_API_KEY" \ | jq '.data.remainingCredits') printf "openrouter $%s\ndeepseek $%s\nfirecrawl %s credits\n" "$or" "$ds" "$fc"
Credits and dollars don't add up: Firecrawl credits are pages, Hunter credits are email lookups. Keep the unit with the number.
No balance API
- Anthropic: daily spend via the admin API, no balance.
- Crunchbase: nothing to read; count and price calls from your side.
- Exa: cost is on every response; sum it yourself.
- Google Gemini: nothing to read; count and price calls from your side.
- Google Places: nothing to read; count and price calls from your side.
- HubSpot Breeze: nothing to read; count and price calls from your side.
- OpenAI: daily spend via the admin API, no balance.
- Parallel: nothing to read; count and price calls from your side.
- Perplexity: cost is on every response; sum it yourself.
- Postmark: nothing to read; count and price calls from your side.
- SendGrid: nothing to read; count and price calls from your side.
Past one script
A balance on its own tells you where you are, not how long you have. For that you need the series and a burn rate: estimating runway. Argus polls every endpoint above hourly and gives the result to your coding agent over MCP.
Questions
- Is there an API to check my OpenAI credit balance?
- No. OpenAI's admin API exposes costs and usage, not the prepaid balance. The balance is only on the billing page in the dashboard.
- Is there an API to check my Anthropic credit balance?
- No. The Admin API has usage and cost reports; the credit balance is only shown on the Claude Console billing page.
- Do balance checks cost credits?
- Not for the endpoints listed here. Apollo's credit stats, Hunter's account call, LeadMagic's credits call, PDL's HEAD request and WhoisXML's balance call are documented as free; Coresignal's search probe doesn't spend collect credits.
Related
Days to zero is balance over burn rate. The hard part is the burn rate: top-ups, daily buckets and credits that aren't dollars.
What each provider actually exposes over its API, how to put balances, daily spend and plan quotas on one ledger, and where you'll have to estimate.
Connect a provider key, point Claude Code or Cursor at the Argus MCP server, and ask what the last run cost.