from cerebras.cloud.sdk import Cerebras
import os
client = Cerebras(
api_key=os.environ.get("CEREBRAS_API_KEY"),
)
batch = client.batches.cancel("batch_123")
print(batch)
{
"id": "batch_xxxx",
"object": "batch",
"endpoint": "/v1/chat/completions",
"errors": null,
"input_file_id": "file-xxxx",
"completion_window": "24h",
"status": "calling",
"output_file_id": null,
"error_file_id": null,
"created_at": 1765492780,
"in_progress_at": null,
"expires_at": null,
"finalizing_at": null,
"completed_at": 1765493188,
"failed_at": null,
"expired_at": null,
"cancelling_at": 1765492797,
"cancelled_at":null,
"request_counts": null,
"metadata": null
}
from cerebras.cloud.sdk import Cerebras
import os
client = Cerebras(
api_key=os.environ.get("CEREBRAS_API_KEY"),
)
batch = client.batches.cancel("batch_123")
print(batch)
{
"id": "batch_xxxx",
"object": "batch",
"endpoint": "/v1/chat/completions",
"errors": null,
"input_file_id": "file-xxxx",
"completion_window": "24h",
"status": "calling",
"output_file_id": null,
"error_file_id": null,
"created_at": 1765492780,
"in_progress_at": null,
"expires_at": null,
"finalizing_at": null,
"completed_at": 1765493188,
"failed_at": null,
"expired_at": null,
"cancelling_at": 1765492797,
"cancelled_at":null,
"request_counts": null,
"metadata": null
}
batch.24h.cancelling immediately after calling cancel. Once cancellation is complete (up to 10 minutes), the status changes to cancelled.cancelling status for up to 10 minutes before changing to cancelled, where it will have partial results (if any) available in the output file.from cerebras.cloud.sdk import Cerebras
import os
client = Cerebras(
api_key=os.environ.get("CEREBRAS_API_KEY"),
)
batch = client.batches.cancel("batch_123")
print(batch)
{
"id": "batch_xxxx",
"object": "batch",
"endpoint": "/v1/chat/completions",
"errors": null,
"input_file_id": "file-xxxx",
"completion_window": "24h",
"status": "calling",
"output_file_id": null,
"error_file_id": null,
"created_at": 1765492780,
"in_progress_at": null,
"expires_at": null,
"finalizing_at": null,
"completed_at": 1765493188,
"failed_at": null,
"expired_at": null,
"cancelling_at": 1765492797,
"cancelled_at":null,
"request_counts": null,
"metadata": null
}
Was this page helpful?