Skip to navigation

Cancel Async Chat Stream

Cancel an active asynchronous chat stream.

This endpoint gracefully cancels an ongoing chat completion stream by:

  1. Setting the cancellation token to stop the event generation loop
  2. Cancelling the underlying asyncio task
  3. Updating the stream status to ‘cancelled’

Notes:

  • Cancellation is irreversible - stream cannot be resumed
  • Any active SSE connections will receive a final event and close
  • Stream status will be updated to reflect cancellation
  • Use DELETE endpoint to remove cancelled streams from storage

Path parameters

message_idstringRequired
Message ID of the asynchronous chat stream to cancel.

Request

Empty request body for stream cancellation. No additional parameters are required to cancel a stream.

Response

Stream cancelled successfully
messagestring
Confirmation message for successful stream cancellation
message_idstring
Unique identifier of the cancelled stream

Errors

401
Unauthorized Error
404
Not Found Error
422
Unprocessable Entity Error