A cancelled OpenAI request costs the full answer
Cancel an OpenAI request partway through and you pay for the whole answer. You don’t pay only for the part you read. The same cancel on an Anthropic or Google model stops the charge where you stopped. That holds when we call Anthropic or Google ourselves. Pin a request to Bedrock or Vertex and we read it to the end, as we do for OpenAI. Cancelling still ends your connection at once, so nothing keeps streaming to your application. The generation at OpenAI is what continues, and you pay for it. OpenAI gives us no way to stop a streaming response and reports no usage for one stopped early, so we have nothing accurate to bill you for instead. We are working on an alternative, and this page changes when it lands. Your logs show a stopped request as Canceled. Its token counts are the ones the provider reported before you stopped. Two things help meanwhile. Setmax_output_tokens so a cancelled request can’t run past a length you accept. Use Anthropic or Google models where stopping matters more than the model choice.