Async Messages
Cancel Async Chat Stream
Cancel an active asynchronous chat stream.
This endpoint gracefully cancels an ongoing chat completion stream by:
- Setting the cancellation token to stop the event generation loop
- Cancelling the underlying asyncio task
- 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
Example response
{
"message": "Stream cancelled successfully",
"message_id": "msg_async_12345"
}