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.

17 of 28 common metered APIs let you read your balance or remaining quota with the same key you use for calls: OpenRouter, DeepSeek, Firecrawl, Tavily, Hunter and others below. OpenAI, Anthropic, Gemini and Perplexity don't; their balance is only in the console.

Balance endpoints

ProviderCallAuthRead
OpenRouterGET openrouter.ai/api/v1/creditsBearertotal_credits − total_usage (USD)
DeepSeekGET api.deepseek.com/user/balanceBearerbalance_infos[].total_balance
FirecrawlGET api.firecrawl.dev/v2/team/credit-usageBearerdata.remainingCredits
TavilyGET api.tavily.com/usageBeareraccount.plan_limit − plan_usage
Bright DataGET api.brightdata.com/customer/balanceBearerbalance (USD)
ApifyGET api.apify.com/v2/users/me/limitsBearermaxMonthlyUsageUsd − monthlyUsageUsd
Apollo.ioPOST api.apollo.io/api/v1/usage_stats/credit_usage_statsX-Api-Keylead_credit.left_over
Hunter.ioGET api.hunter.io/v2/account?api_key=credits.available − credits.used
ProspeoPOST api.prospeo.io/account-informationX-KEYresponse.remaining_credits
LeadMagicGET api.leadmagic.io/v1/creditsX-API-Keycredits
People Data LabsHEAD api.peopledatalabs.com/v5/person/enrichX-Api-KeyX-TotalLimit-Remaining header
CrustdataGET api.crustdata.com/account/creditsBearer + x-api-versionaccount.credits
CoresignalPOST …/company_multi_source/search/es_dslapikeyx-credits-remaining header
InstantlyGET api.instantly.ai/api/v2/workspace-billing/plan-detailsBearersubscriptions.credits.available_credits
MillionVerifierGET api.millionverifier.com/api/v3/credits?api=credits
SecurityTrailsGET api.securitytrails.com/v1/account/usageAPIKEYallowed_monthly_usage − current_monthly_usage
WhoisXML APIGET 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

Let your coding agent watch the meter.

Connect a provider key, point Claude Code or Cursor at the Argus MCP server, and ask what the last run cost.