Unknown spend and client disconnects: how other products behave
Last updated: 2026-11-27T12:02:53-03:00 (UTC-3)
Two questions decided the design of the manual release and of settling a stream after its client disconnects. This page records what ten gateways and four observability products do, from their documentation and source read on 2026-11-27, and what two of the gateways did when run. Each cell says where it comes from: source, docs, measured or inferred. A blank finding is stated as such.
What was run
Section titled “What was run”Two gateways in throwaway containers against a local stand-in provider (an OpenAI-compatible stream of 20 chunks, one every 500 ms, with a final usage of 7 input and 20 output tokens when asked). Each got a control call read to its end and a call the client cut after 2 seconds. One run per case.
| Gateway | Image | Client cut at 2 s: provider connection | Recorded for the cut call |
|---|---|---|---|
| LiteLLM | litellm:v1.106.6, sha256:37e2dafb088a7723beb998590682957386dfc83ffea1848486f8e0e5cfac0b06 |
Closed in the same instant, after chunk 3 of 20 | 11 input and 7 output tokens, its own estimate of the partial text (the control recorded the provider’s 7 and 20); status success, with error_information 499 ClientDisconnected |
| One API | one-api:v0.6.10, sha256:e667221a2e197f005bdf3aba300885ac165fde37a0de9773e478678a9e04b24a |
Kept open; all 20 chunks read, 10 s | The same charge as the control (its own token count); nothing marks the call as cut |
Not measured: a non-zero price on the first, a provider that sends a usage chunk to the second, and the other twelve products.
Spend whose cost is unknown
Section titled “Spend whose cost is unknown”| Product | What it records | A reserved or pre-deducted amount on failure | Manual correction |
|---|---|---|---|
| LiteLLM | A cancelled call settles at its input cost, not zero (source) | Reconciled automatically (source) | Reset of a key’s or the global spend, by an administrator, audited (source) |
| Bifrost | Usage seen before an error is billed; none seen, nothing (source) | No reservation | Budget usage reset on update (docs); audit in the commercial edition only (docs) |
| Busbar | A model without a price is refused at admission (docs) | A per-request fee is refunded on a non-2xx answer (docs) | Group changes audited with a hash chain (docs); no spend reset found |
| Portkey | The open-source gateway keeps no cost (source); hosted, an unpriced model does not count against a budget (docs) | No evidence found | No evidence found |
| GoModel | Unknown cost is null, never zero, and listed as unpriced (docs) | No reservation; a soft limit (docs) | Recalculate recorded costs; reset a budget (docs); no audit found |
| One API | A stream without usage is estimated by a tokenizer (source) | Refunded automatically on a send error or non-200; kept when the usage is missing (source) | An administrator edits quota, logged (source) |
| new-api | A stream without usage is estimated by a tokenizer (source) | Refunded automatically on final failure (source) | Quota adjustment records the operator, before and after (source) |
| Helicone | Settles an escrow at the cost, or zero when there is none (source) | Cancelled on a failed attempt; stale ones cleaned up over time (source) | Credit or debit with a required reason, logged to the console only (source) |
| Kong AI Gateway | Without usage, estimates from characters; without a configured price, zero (source) | No reservation; the cost counts on the next request (docs) | No evidence found |
| Higress | Deducts only at the end of a stream that reported usage; otherwise nothing (source) | No reservation | Quota refresh and delta, by an admin consumer (docs); no audit found |
| Agent Router (Envoy AI Gateway) | Cost is emitted after the answer, not for a failed request (source, docs) | No reservation | No evidence found |
| Langfuse | Cost needs ingested usage or cost; an ingested value wins over an inferred one (docs) | Not applicable | Cost can be ingested; history is not rewritten in bulk (docs) |
| Opik | An unsupported model has no cost; a span’s cost can be set afterwards (docs) | Not applicable | By updating the span (docs) |
| MLflow | Automatic cost can be overridden with token and cost attributes on the span (docs) | Not applicable | By span attributes (docs) |
| Datadog LLM Observability | Cost from tokens, or supplied by the user, tagged by its source (docs) | Not applicable | By supplying it (docs) |
Reading. There is no agreement on what an unmeasured call costs: silent zero in four, a tokenizer estimate in four, an explicit null in three, a refusal in one. Of the four that reserve or pre-deduct, all give the amount back automatically on failure. None has an action that releases one unknown hold; most have a manual spend or quota correction, and three record who made it with the amounts.
What this gateway does. It keeps the stricter rule it already had: an unknown amount is never zero and never an estimate, and nothing gives a hold back automatically. From the references it takes the manual correction as an explicit, permissioned action, and the fullest record found: the operator, the amount, the windows and a written reason, in an audit trail.
A streamed call whose client disconnects
Section titled “A streamed call whose client disconnects”| Product | Provider call when the client leaves | Usage recorded |
|---|---|---|
| LiteLLM | Closed at once (measured, source) | A partial count built from the chunks received (measured, source) |
| Bifrost | Cancelled when a write fails (source) | The usage the provider had already reported; no estimate (source) |
| Busbar | Body dropped (source); provider close (inferred) | The tokens accumulated so far (source) |
| Portkey | The loop ends on the write error (inferred) | None in the open-source gateway (source) |
| GoModel | Classified as a client disconnect (source) | A usage row only if a usage event had arrived (source) |
| One API | Read to its end (measured, source) | The full call (measured) |
| new-api | Closed at once (source) | A partial estimate of the text received (source) |
| Helicone | Cancelled (source) | The partial body, marked as cancelled (source); its cost: no evidence found |
| Kong AI Gateway | Closed by the proxy (inferred) | No final cost: it is computed only when the stream finishes (inferred) |
| Higress | Reset (inferred) | Nothing deducted without the end of the stream (source) |
| Agent Router (Envoy AI Gateway) | Reset (inferred) | Whatever usage a chunk had carried before the reset; otherwise zero (source) |
| Langfuse, Opik, MLflow | Not proxies: their client wrappers close the generation with the chunks received (source) | Usage is missing if the usage chunk did not arrive (source) |
| Datadog LLM Observability | Not a proxy: closes the span when the stream is dropped; asks for usage itself (source) | Estimated when usage reporting is turned off (docs) |
No official statement was found from OpenAI, Anthropic or AWS Bedrock on how a cancelled stream is billed.
Reading. Nine of the ten gateways end the provider call when the client leaves; one reads it to its end. What they record then differs: a partial estimate, the usage that happened to arrive, or nothing.
What this gateway does. Ending the provider call stays the default, as in nine of ten. What it records then is not an estimate: the call is unmeasured and its reservation is held. Reading the provider to its end is offered as an operator flag, stream_settle_on_disconnect, for deployments where abandoned streams leave unknown reservations; it is the only one of the observed behaviours that yields the provider’s own final usage, and it costs the whole generation.