Why AI API bills spike, and how to catch it within a day

AI API spend is the fastest-growing and least predictable line on most small teams' bills. One prompt change can multiply it overnight. Here's what usually causes spikes and how to see them early.

Updated October 2026

Common causes

  • Loops and retries: an agent or job that calls the model again on every error.
  • Growing context: conversation history or retrieved documents added to every request, so each call gets more expensive.
  • A model switch: moving a feature to a larger model multiplies cost per token.
  • Traffic: a launch, a bot, or a scraper hitting an endpoint that calls an AI API.
  • A leaked key: keys found in public code get used quickly, and the bill is yours (example).
  • Experiments: a teammate's batch job or a weekend prototype on the production key.

Detecting a spike

Look at each model separately, every day. Total spend can hide a spike: if one model triples while another drops, the total barely moves.

A rule that works without tuning: compare each day with the median of the previous 14 days. Flag days above 2.5× the median, and treat 5× as critical. Ignore tiny amounts (under $1) so new or rarely used models don't cry wolf. Burnstack applies exactly this rule, per vendor and per model, from your billed cost.

Burnstack alerts sorted by severity, showing AI spend spikes with the dollars over usual and a View on Dashboard button

Limiting the damage

  • Set spend limits per project (OpenAI) or workspace (Anthropic).
  • Use one project or workspace per app and environment, so you can see, and cut off, exactly what spiked.
  • Set max_tokens and cap retries in code.
  • Use prompt caching for long, repeated context.
  • Keep secret keys on the server; never in a mobile app or front end.

When it happens

  1. Find the model and project or workspace that spiked.
  2. If it isn't explained by real traffic, rotate the key first and investigate second.
  3. Check logs for loops, retries or unexpected callers.
  4. If it was abuse, contact the vendor's support; some have waived charges from leaked keys.

Track both AI vendors with Burnstack: OpenAI and Anthropic.

Start watching back.

Five minutes to connect your first vendor. Free for Mac, forever, and every byte stays yours.