Skip to content

AIChatCancelRun

POST ai/chat/run/cancel

Stops a generation. The request to the model is aborted and the conversation keeps a mark that the answer was cancelled, so the question does not stay on screen without a reaction.

Cancelling makes sense only while the run is queued or running. A finished run is returned as it is, with cancelled: false — this is a normal outcome of a race between the user and the model, not an error.

Access Control

Allowed: client, manager, admin. Only runs started by the current session.

Request

POST request
POST https://{broker_domain}/ai/chat/run/cancel
Authorization: <JWT_TOKEN>
Content-Type: application/json

{ "runId": "run_55b…" }
{
  "command": "AIChatCancelRun",
  "extID": "1",
  "data": { "runId": "run_55b…" }
}
await platform.AIChatCancelRun({ runId });

Parameters

Parameter Type Description
runId string Run to stop
accountLogin int Account context. Required for a client session of an account owner

Response Data

{ "runId": "run_55b…", "state": "cancelled", "cancelled": true }

The run also emits ai.run.cancelled through the event channel, so other open tabs of the same session stop their indicators.

Errors

Code Error Description
403 AI_ACCESS_DENIED The session may not use the assistant
404 AI_RUN_NOT_FOUND Unknown run, or a run of another session