v10

latestOpenAPI 3.1.0raw.githubusercontent.com2026-07-0643140398.0 KB
Async Messages

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
post/v1/messages/async/{message_id}/cancel

Path parameters

message_idstring required

Message ID of the asynchronous chat stream to cancel.

Example:custom_msg_12345

Message ID of the asynchronous chat stream to cancel.

Request body

object required

Response

Stream cancelled successfully

messagestring required

Confirmation message for successful stream cancellation

message_idstring required

Unique identifier of the cancelled stream

Example response

{
  "message": "Stream cancelled successfully",
  "message_id": "msg_async_12345"
}