Retry and cost multipliers
What it looks like
Token use doubles or triples with no rise in traffic. Latency spikes. Logs show the same request sent again and again. Sometimes a user sees one answer, but you paid for five.
Why it happens
A model API does not remember your last request. A retry sends the whole prompt again, and you are billed for those input tokens again. If the first attempt produced some output before it failed, you may pay for that too.
The bigger problem is stacking. Your HTTP client retries. The SDK retries. Your agent framework retries a failed step. Your own code wraps it all in another retry loop. If each layer tries three times, one call can become many. Add "repair" loops, where you re-ask the model to fix bad JSON with the broken output attached, and each attempt gets longer than the last.
Not every error should be retried. A timeout or a rate-limit response may pass if you wait. A request that is too long, or a prompt that keeps producing bad output, will fail the same way every time.
How to spot it
- More API calls than user actions in your logs.
- Several calls with the same prompt within seconds.
- Rate-limit errors that get worse after you add retries.
- Cost per successful task rising while cost per call stays flat.
Fix checklist
- Retry in one layer only. Turn off or set to zero the retries in the others.
- Use exponential backoff with jitter and a hard cap on attempts.
- Only retry errors that can pass: timeouts, rate limits, server errors. Never retry a too-long request unchanged.
- Use idempotency keys or your own request IDs so repeats do not repeat side effects.
- Log attempt count per request and alert on spikes.
Lasting fix
- Set per-key spend caps in TokenCenter Keys & Quotas , so a retry loop hits a limit instead of your budget.
Related on Solaro sites
- TokenCenter cost calculator : see what your monthly token use costs.
- DailyScar : read the story “The Double Launcher” (duplicate runs, on the DailyScar front page).
Next
Cap retries and budget them has copy-paste backoff code in Python and JavaScript.