Responses API
Cancel Response
Stop an in-progress response — a background run, or a stream in flight.
POST
Headers
Path Parameters
What can be cancelled
The id is cancellable from the moment the run starts — including the id in the
response.created frame, the first thing a stream sends.
409
What the streaming client sees
The stream ends within one chunk of the cancel — the client keeps every byte the model had already produced — and the last frame it receives is:response.incomplete because OpenAI’s stream-event union has no
response.cancelled member; the response object it carries says cancelled, which is what a
later GET /v1/responses/{id} reports too — so the stream and the stored response never
disagree about how the run ended.
A cancel that arrives after the stream has already sent its terminal frame changes nothing
about the answer: no second terminal frame is emitted, and the output that was delivered stays
on the stored response.
Cancel works across replicas. A cancel served by a different pod than the one driving the
stream is picked up from the stored response’s status within about two seconds, so the caller
does not need to reach a particular instance.
What is kept
A cancelled run keeps what it had produced: the partial output that was streamed to the client is stored on the response rather than being discarded, soGET /v1/responses/{id} returns
status: "cancelled" alongside the tokens that were actually delivered.