Estimate runway on prepaid API credits

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.

Runway is balance divided by burn per day. Take burn from the last 7 days: from the daily spend series where the provider has one, otherwise from balance readings, summing only the drops so top-ups don't cancel out spend. A $96.72 balance burning $7.09 a day has 13.6 days left.

The code

This is the calculation Argus runs, minus the database:

type Sample = { at: Date; balance: number };
const DAY = 86_400_000;

/** Burn per day from a balance series. Only drops count, so top-ups don't cancel spend. */
function burnPerDay(samples: Sample[]): number {
  const s = [...samples].sort((a, b) => +a.at - +b.at);
  if (s.length < 2) return 0;
  let spent = 0;
  for (let i = 1; i < s.length; i++) {
    const drop = s[i - 1].balance - s[i].balance;
    if (drop > 0) spent += drop;
  }
  const days = (+s[s.length - 1].at - +s[0].at) / DAY;
  return days > 0 ? spent / days : 0;
}

/** null means no runway concern: no burn, or no known balance. */
function daysToZero(balance: number | null, burn: number): number | null {
  if (balance == null || burn <= 0) return null;
  return balance <= 0 ? 0 : balance / burn;
}

Where burn rates go wrong

  • Top-ups. Diff the first and last reading and a $100 top-up looks like $100 of negative spend. Count only decreases.
  • Too short a window. A one-hour eval run extrapolated to a day says you have hours left. Seven days smooths it; alert thresholds absorb the rest.
  • Spend that settles late. OpenRouter's balance can dip slightly below zero after async settlement, and Bright Data deducts usage daily, so its balance moves in steps.
  • Credits that aren't dollars. Firecrawl, Hunter and Apollo burn credits. Days to zero works in any unit; dollar totals need a price per credit.

Which number applies to which provider

Billing shapeExampleWhat to watch
Prepaid USDOpenRouter, DeepSeek, Bright DataDays to zero
Prepaid creditsMillionVerifier, WhoisXML, LeadMagicDays to zero, in credits
Monthly allowanceFirecrawl, Tavily, Hunter, ProspeoAllowance used vs days to reset
Monthly USD budgetApifyBudget used vs days to cycle end
Prepaid, no balance APIOpenAI, Anthropic, PerplexityProjected month-end vs your cap

For allowances, zero isn't the end: the allowance resets. Compare days to zero with days to reset. If the allowance lasts past the reset you're fine; if not, you'll hit the provider's overage or hard stop first.

Alert on it

Seven days of runway is a reminder; three is urgent. Argus raises credits_low at seven days and credits_critical at three, and you can set a days-to-zero email alert at any threshold. See low-balance alerts for what each console offers natively.

Questions

How do I calculate how many days of API credits I have left?
Divide the current balance by your average daily burn. Measure burn from balance drops over the last 7 days, counting only decreases so top-ups don't hide spend.
Can I estimate runway for OpenAI or Anthropic credits?
Not from their APIs alone: neither exposes the prepaid balance. You have the daily spend series, so you can project month-end spend against your monthly cap, or record the balance yourself after each top-up.

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.