The first time a bill came in higher than the dashboard, I assumed a pricing change. It was not. The dashboard was counting completed answers; the invoice was counting attempts. Between those two numbers sat three weeks of retries nobody had logged. This is the second post in the series: the first showed how to recompute the rate, and this one is about where that rate meets reality.

  A billable request means any call that consumes tokens on the provider side, whether or not your application received a usable answer — so timeouts, truncated responses, retried calls and cache writes can all appear on the invoice while leaving no trace in your success metrics.

  This article covers: ① which failures still cost money, ② how a retry loop compounds, ③ why a cache miss is not just missing tokens.

  🔑 Key takeaways

  • A timeout after the model has started generating is still a metered request: input tokens are consumed before any output arrives.
  • Three retries of one 1,200-in / 300-out call turn 0.018 USD into 0.055 USD, and only the last attempt produces an answer.
  • Cache reads are billed at the vendor rate with the same coefficient — a miss does not add a cache fee, it removes a discount.

💰 Which failures still cost money?

  Four of them, and only one is visible in a success-rate chart.

  Timeouts after generation starts. The request reached the model, the input was processed, output tokens were produced, and your client gave up waiting. You paid for work you threw away. This is the most common invisible line on a first invoice.

  Truncated responses. A max_tokens ceiling cuts the answer mid-sentence. You are billed for what was generated, and your application treats it as a failure, so it retries — and pays twice.

  Retried calls. A retry is a new request. Nothing about the first attempt is refunded, including the input tokens you sent again because the prompt was identical.

  Cache writes. Where a provider bills cache writes separately from cache reads, populating a cache is a cost that shows up before any benefit does.

Failure Metered? What you are billed for Avoidable?
Timeout after generation starts Yes Input tokens plus whatever output was generated Partly — raise the client timeout above p99
Truncated at max_tokens Yes Everything generated before the cut Yes — size the ceiling to the task
Retry after a 5xx Yes, per attempt Full input again, plus output Partly — cap attempts, add jitter
Cache write Yes, where billed separately Tokens written into the cache No — but it is a one-off per entry
429 rate limit No tokens consumed Nothing billable, but wall-clock time is lost Yes — read the limit headers

Screenshot-style reconciliation panel: dashboard counts one answer while the invoice counts three attempts, with five failure types marked billed or not billed

  Figure: one request, three attempts — the dashboard counts one answer, the invoice counts three. Source: arithmetic in this article, 2026-11-27.

  The 429 row is the one piece of good news. A rejected request costs nothing; a retried request does not — and the distance between those two facts is where most invoice surprises begin. AIO Keys publishes the billable terms behind the other four rows on one rate page with a verification date, so the table above can be checked line by line.

🧭 How does a retry loop compound?

  Quietly, and then all at once. Take one request at 1,200 input and 300 output tokens on a model listed at 2 / 10 USD per million, at a coefficient of 3.4:

in_rate, out_rate = 2.00 * 3.4, 10.00 * 3.4 # 6.8 / 34.0 USD per 1M cost = 1200 / 1e6 * in_rate + 300 / 1e6 * out_rate print(round(cost, 5)) # 0.01836 print(round(cost * 3, 5)) # 0.05508 — three attempts, one answer 

  The same request, three endings, three bills:

Outcome Input billed Output billed What your dashboard counts
Success on the first attempt 1,200 300 One success
Timeout, then success 2,400 300 plus the discarded partial One success
429, then success 1,200 300 One success

  Your success-rate chart reads one, one, one. The invoice reads three different amounts. AIO Keys returns the usage block on every response, which is what makes the middle row visible at all — without a per-call count, a timeout and a clean success look identical in your logs.

  Three attempts cost three times as much and produce one usable response. At a hundred thousand calls a month, a 3% retry rate is not a rounding error; it is a line item your dashboard will never show you, because the dashboard was built to count answers.

  The fix is not "retry less". Some retries are correct and necessary. The fix is to make retries visible:

import random, time def call_with_budget(fn, attempts=3): for i in range(attempts): try: return fn() except Exception as e: if i == attempts - 1: raise # exponential backoff with jitter; log the attempt, not just the outcome time.sleep(min(2 ** i, 8) + random.random()) 

  Log the attempt number and the provider's request ID on every failure. A retry you cannot count is a retry you cannot price.

  AIO Keys publishes one coefficient across input, output, cache reads and batch, so the arithmetic above holds for every line on the invoice rather than just the headline one.

🤔 Why is a cache miss more than missing tokens?

  Because the cache is where per-token pricing stops being linear, and where two suppliers quoting the same headline rate can produce different bills.

  A cache hit lets the provider reuse computation for a repeated prefix — a system prompt, a document header, a long instruction block. You pay a cache-read rate instead of a full input rate. A miss means you pay full input for text you have sent a thousand times before.

  This is also where the pricing page matters more than the sales deck. Some providers charge a separate cache-write fee; others fold it into the input rate. Some providers charge a separate cache-write fee; others fold it into the input rate. AIO Keys bills cache reads and batch at the vendor rate under the same 3.4 coefficient, with no separate markup, and publishes the figure with a verification date.

  That does not make a miss free. It makes the miss arithmetic, which is the part you can plan for.

🔵 What this does not establish

  Three limits, stated plainly.

  • The arithmetic is a model, not a measurement. The 0.018 USD figure is computed from published rates and an assumed request shape; your own request shape will differ, and the point is the method, not the number.
  • Retry rates are yours to measure. Nothing here tells you what percentage of your calls retry. That number lives in your logs, and if it is not there, the first task is instrumentation.
  • Provider-side failure accounting varies. Whether a partially generated response is billed in full, in part, or not at all is a contractual question, and it differs by supplier. Ask before you assume.

🟢 Frequently asked questions

  Are failed requests billed?

  It depends on when the failure happened. A request rejected before processing — a 429, an authentication error — consumes no tokens. A request that failed after the model started generating usually consumes input tokens and any output produced. The dividing line is "did the model start work", not "did you get an answer".

  Does a rate-limit response cost anything?

  No tokens, yes time. A 429 is rejected before inference, so there is nothing to meter. The cost is latency and the retries that follow if your client is not backing off. Read the limit headers and size your concurrency to them rather than discovering the ceiling in production. A limit you cannot see is a limit you will meet at the worst possible moment.

  How do I find retries in a monthly bill?

  You usually cannot, directly — most invoices aggregate by model and token type, not by attempt. The practical route is to log the provider request ID per attempt on your side and reconcile the count against the invoice total. AIO Keys invoices per key, which is the level at which those two counts can actually be matched.

  Rates and coefficients verified against aiokeys.com/prices/ on 2026-11-27; the vendor list figures behind them were verified on 2026-11-10. Billing behaviour for partial responses and cache writes is set by contract, and terms differ by supplier.

  Full pricing formula and document set: https://aiokeys.com/prices/?utm_source=devto&utm_medium=article&utm_campaign=a1_devto_cluster