Billing for Interrupted Connections
Updated: Nov 26, 2026
Synchronous HTTP chat requests can take a long time to complete, and may be affected by network interruptions or client disconnects. The table below describes how each case is handled and billed.
| HTTP Status | Scenario | What the Client Receives | Input Billing | Output Billing |
|---|---|---|---|---|
| Normal | The model returns a complete response that includes usage | Complete response | Usage returned by the model | Usage returned by the model |
| Normal | The model returns a complete response that does not include usage | Complete response | Estimated | Estimated from the returned content; not billed if there is no output |
| Client interrupted | The client disconnects or times out before the request is sent to the model | Connection closed; 408 on timeout | Not billed | Not billed |
| Client interrupted | The client disconnects or times out after the request is sent but before any response is received | Connection closed; 408 on timeout | Estimated | Not billed |
| Client interrupted | Non-streaming request; the client disconnects or times out while receiving the response | Connection closed; 408 on timeout; no partial content is returned | Estimated | Not billed |
| Client interrupted | Non-streaming request; the client disconnects or times out after the model has returned the full response but before the platform finishes processing it (rare) | Connection closed; 408 on timeout | Usage reported in the response; estimated if unavailable | Usage reported in the response; estimated from the content if unavailable |
| Client interrupted | Streaming request; the client disconnects or times out during output | Partial content already received | Usage returned by the model if any, otherwise estimated | Usage returned by the model if any, otherwise estimated from the content already returned |
| Client interrupted | The client disconnects after receiving the complete response | Complete response | Same as normal | Same as normal |
| Model response error | Non-streaming request; the model response is cut off midway while the client is still waiting | 500 error, no content returned | Not billed | Not billed |
| Model response error | Non-streaming request; the platform cannot process the model response | 500 error, no content returned | Not billed | Not billed |
| Model response error | Non-streaming request; the model returns a success status but the content is malformed | The model's content, unchanged | Not billed | Not billed |
| Model response error | Streaming request; the model output is cut off midway, or the last chunk is incomplete | Partial content already received, possibly including an incomplete last chunk | Usage returned by the model if any, otherwise estimated | Usage returned by the model if any, otherwise estimated from the fully received content; the incomplete last chunk is not billed |
| Model response error | The model explicitly returns an error, such as rate limiting, service error, or invalid parameters | The model's error message | Not billed, unless the model explicitly returns usage in the error | Not billed, unless the model explicitly returns usage in the error |
Estimated token usage is calculated as follows:
| Content Type | Estimation Method |
|---|---|
| Text (prompts, answers, tool arguments, code, etc.) | Counted with the o200k_base tokenizer; empty content counts as 0 |
| Image | 520 tokens per image |
| Audio | 256 tokens per clip |
| Video | 8192 tokens per clip |
| File / document (not plain text) | 4096 tokens per file |
