Skip to content

Cancel a Batch

Stop the execution of a batch that has been submitted but not yet completed.

Endpoint

POST https://llm.siraya.pro/v1/batches/{batch_id}/cancel

Path Parameters

Parameter Type Required Description
batch_id string Yes The unique identifier of the batch to cancel.

Example Request

curl -X POST https://llm.siraya.pro/v1/batches/batch_abc123/cancel \
  -H "Authorization: Bearer <API_KEY>"
import requests

url = "https://llm.siraya.pro/v1/batches/batch_abc123/cancel"
headers = {"Authorization": "Bearer <API_KEY>"}

response = requests.post(url, headers=headers)
print(response.json())

Response

Returns the updated batch object with its status changed to cancelled.

{
  "id": "batch_abc123",
  "status": "cancelled",
  "cancelled_at": 1700000000
}

[!WARNING] Once a batch is cancelled, its processing stops immediately. You will still be billed for any requests that were successfully completed before the cancellation.