Your LLM traffic needs a retry budget, not a retry count

Every HTTP client library has a retry knob, and for most APIs the default (three attempts with exponential backoff) is fine, because most API calls are cheap and idempotent. LLM calls are neither. A retried request re-sends the full prompt at full input price, re-generates output you may already have paid for once, and lands on a provider at the exact moment it is least able to serve it. The right mental model is not "how many times should I retry" but "how much am I willing to spend on requests that have already failed once": a budget, not a count.

Why retry counts go wrong for model traffic

Three properties of LLM requests break the standard advice:

Sort errors before you spend on them

A budget is only spent on failures that a retry can actually fix. That sorting is the most valuable part of the whole exercise:

What a budget looks like in practice

Two limits, one global and one local:

The global limit is the one almost nobody implements, because it needs a place where all LLM traffic is visible at once. Per-service retry configuration cannot see that the fleet collectively tripled its offered load; a shared choke point can. That is the operational argument for routing model traffic through one layer — whether that is a gateway or something you built — and giving that layer, not each client, the retry policy.

The accounting question

However you implement it, make retries visible in cost attribution. A request that succeeded on attempt three should carry the cost of all three attempts, including the partial output of any stream that died: otherwise your per-feature cost numbers silently exclude exactly the traffic that is most expensive per successful answer. When an incident review asks "what did that outage cost us", the difference between billed tokens and tokens-per-successful-request is the answer, and you can only compute it if the ledger kept attempts distinct from successes.

None of this is exotic to build, but all of it has to live in one place to work: the timeout chain, the error sorting, the failover targets and the budget are one policy seen from four angles. Splitting them across client libraries is how each piece ends up locally correct and the system ends up retrying a content refusal four times during a rate-limit storm — at full price.