Skip to main content
GET
https://api.cerebras.ai
/
v1
/
batches
/
{batch_id}
/
results
from cerebras.cloud.sdk import Cerebras
import os

client = Cerebras(
    api_key=os.environ.get("CEREBRAS_API_KEY"),
)

results = client.batches.retrieve_results("batch_123")

print(results)
{"custom_id":"req-001","status":"succeeded","response":{"id":"cmpl_1","object":"chat.completion","created":1699999999,"model":"llama-3.3-70b","choices":[{"index":0,"message":{"role":"assistant","content":"..."},"finish_reason":"stop"}],"usage":{"prompt_tokens":120,"completion_tokens":80,"total_tokens":200}}}
{"custom_id":"req-002","status":"failed","error":{"code":"invalid_request","message":"Prompt length exceeds model limit."}}
{"custom_id":"req-003","status":"expired","error":{"code":"timeout","message":"Batch expired before this request completed."}}
Downloads the output JSONL file containing results for all requests in the batch. This endpoint is only available once the batch job is complete or the 24-hour processing window has elapsed.

Path Parameters

batch_id
string
required
The ID of the batch job whose results to retrieve.

Response

The response is a JSONL file where each line contains the result for a single request. Each line includes:
custom_id
string
The unique identifier from the input request.
status
string
The status of the individual request. Possible values: succeeded, failed, expired.
response
object
The completion response object (only present for successful requests).
error
object
Error information (only present for failed or expired requests).
Results are only available once the batch job is complete or the 24-hour processing window has elapsed. Results are retained for 7 days (configurable for enterprise customers).
from cerebras.cloud.sdk import Cerebras
import os

client = Cerebras(
    api_key=os.environ.get("CEREBRAS_API_KEY"),
)

results = client.batches.retrieve_results("batch_123")

print(results)
{"custom_id":"req-001","status":"succeeded","response":{"id":"cmpl_1","object":"chat.completion","created":1699999999,"model":"llama-3.3-70b","choices":[{"index":0,"message":{"role":"assistant","content":"..."},"finish_reason":"stop"}],"usage":{"prompt_tokens":120,"completion_tokens":80,"total_tokens":200}}}
{"custom_id":"req-002","status":"failed","error":{"code":"invalid_request","message":"Prompt length exceeds model limit."}}
{"custom_id":"req-003","status":"expired","error":{"code":"timeout","message":"Batch expired before this request completed."}}