Files and Batch reference
The OpenAI-compatible batch surface, in beta.
Base URL and authentication
Base URL: https://api.reka.ai/v1. Use the same API key as Chat Completions: Authorization: Bearer $REKA_API_KEY. Files and batches belong to your account or organization.
Operations
| Method | Path | Request and result |
|---|---|---|
POST | /v1/files | Upload a .jsonl file with purpose=batch. |
GET | /v1/files | List files. Filters: purpose, limit (1–10,000), order, after. |
GET | /v1/files/{file_id} | File metadata. |
GET | /v1/files/{file_id}/content | Download the file (JSONL). |
DELETE | /v1/files/{file_id} | Delete a file. |
POST | /v1/batches | Create a batch. Optional Idempotency-Key header. |
GET | /v1/batches | List batches, newest first. limit (1–100, default 20), after. |
GET | /v1/batches/{batch_id} | Status, counts, usage and result file IDs. |
POST | /v1/batches/{batch_id}/cancel | Cancel a batch. |
With an SDK, set the base URL to https://api.reka.ai/v1; the SDK adds the rest of each path.
OpenAI compatibility
The OpenAI Python and TypeScript SDKs work unchanged with the base URL above. Use a Reka model ID in each request.
| Surface | Reka beta |
|---|---|
| Endpoint and models | /v1/chat/completions, qwen3.8-27b or glm5.3-flash |
| Submission | Upload a JSONL file, then create with input_file_id |
| Window and limits | 24h, 50,000 requests, 100,000,000 bytes |
| Notifications | Poll for status; no webhooks |
| Cancellation | Supported; finished rows are kept |
| Other endpoints | Responses, Messages and Embeddings batches are not supported |
Upload, inspect, list and delete files
Upload with multipart fields file and purpose=batch. Uploading does not start a batch.
curl -s https://api.reka.ai/v1/files \
-H "Authorization: Bearer $REKA_API_KEY" \
-F purpose=batch \
-F file=@requests.jsonl{
"id": "file-example",
"object": "file",
"bytes": 500,
"created_at": 1800000000,
"filename": "requests.jsonl",
"purpose": "batch",
"status": "processed",
"status_details": null,
"expires_at": 1802678400
}expires_at is when the file is deleted, 31 days after upload. Result files have purpose batch_output.
FILE_ID="file-example" # your file ID
# Metadata
curl -s https://api.reka.ai/v1/files/$FILE_ID \
-H "Authorization: Bearer $REKA_API_KEY"
# Content
curl -s https://api.reka.ai/v1/files/$FILE_ID/content \
-H "Authorization: Bearer $REKA_API_KEY" \
-o downloaded.jsonlFilter with purpose=batch for your inputs; leave it out to include result files.
curl -s "https://api.reka.ai/v1/files?purpose=batch&limit=20&order=desc" \
-H "Authorization: Bearer $REKA_API_KEY"{
"object": "list",
"data": [
{
"id": "file-example",
"object": "file",
"bytes": 500,
"created_at": 1800000000,
"filename": "requests.jsonl",
"purpose": "batch",
"status": "processed",
"status_details": null,
"expires_at": 1802678400
}
],
"first_id": "file-example",
"last_id": "file-example",
"has_more": false
}To page through a list, pass the previous page's last_id as after while has_more is true.
curl -s -X DELETE https://api.reka.ai/v1/files/$FILE_ID \
-H "Authorization: Bearer $REKA_API_KEY"{
"id": "file-example",
"object": "file",
"deleted": true
}Deleting the input of an unfinished batch returns HTTP 409. Deleting a file never cancels a batch.
Create request
{
"input_file_id": "file-example",
"endpoint": "/v1/chat/completions",
"completion_window": "24h",
"metadata": {
"description": "nightly ticket classification"
}
}input_file_id: required, a file uploaded withpurpose=batch.endpoint: required,/v1/chat/completions.completion_window: required,24hfrom creation. Rows not finished by then expire.metadata: optional, up to 16 string pairs (keys 64 characters, values 512).
Optional header Idempotency-Key (1–255 characters): a repeat create with the same key and body returns the original batch; a different body returns HTTP 409. See timeouts.
Input and feature limits
- Up to 50,000 requests and 100 MB per file.
- UTF-8 JSONL, one request per line, one model per file.
custom_id: unique in the file, up to 512 characters.- Each row:
method: POST,urlset to the batch endpoint, and a Chat Completionsbody. - Tools and structured outputs work as in Chat Completions.
stream: trueis rejected.
Problems with the file fail the batch and appear in errors.data with line numbers (first 100). Problems with one row go to the error file.
Statuses and result fields
| Status | Meaning |
|---|---|
validating | Checking the input file. |
in_progress | Running rows. |
finalizing | Writing the result files. |
cancelling | Cancel requested; rows already running finish. |
completed | Done. Some rows may have failed: check request_counts. |
failed | The input file was invalid; see errors. |
expired | The 24-hour window ended. Finished rows are in the result files. |
cancelled | Cancelled. Finished rows are in the result files. |
request_counts has total, completed and failed rows. usage sums the tokens of successful rows. Timestamps are Unix seconds.
Each result line has a custom_id and either a response (status_code, request_id, body) or an error (code, message). Rows that never ran have code batch_cancelled or batch_expired. See reading results.
Retrieve, list and cancel batches
Create returns a Batch object in validating; retrieve returns the same object with its current state.
{
"id": "batch_example",
"object": "batch",
"endpoint": "/v1/chat/completions",
"model": "qwen3.8-27b",
"input_file_id": "file-example",
"completion_window": "24h",
"status": "completed",
"errors": null,
"output_file_id": "file-output",
"error_file_id": null,
"created_at": 1800000000,
"in_progress_at": 1800000001,
"expires_at": 1800086400,
"finalizing_at": 1800000010,
"completed_at": 1800000011,
"failed_at": null,
"expired_at": null,
"cancelling_at": null,
"cancelled_at": null,
"request_counts": {
"total": 2,
"completed": 2,
"failed": 0
},
"usage": {
"input_tokens": 40,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 4,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 44
},
"metadata": null
}output_file_id and error_file_id are null when there is no file of that kind.
BATCH_ID="batch_example" # your batch ID
# One batch
curl -s https://api.reka.ai/v1/batches/$BATCH_ID \
-H "Authorization: Bearer $REKA_API_KEY"
# Newest 20 batches
curl -s "https://api.reka.ai/v1/batches?limit=20" \
-H "Authorization: Bearer $REKA_API_KEY"curl -s "https://api.reka.ai/v1/batches?limit=20&after=batch_example" \
-H "Authorization: Bearer $REKA_API_KEY"curl -s -X POST https://api.reka.ai/v1/batches/$BATCH_ID/cancel \
-H "Authorization: Bearer $REKA_API_KEY"The batch moves to cancelling; rows already running finish. Cancelling a finished batch returns it unchanged.
Errors and retry behavior
{
"error": {
"message": "No such File object: file-example",
"type": "validation_error",
"code": null,
"param": "input_file_id"
}
}API calls return errors in this shape. Problems found later are in batch.errors (the file) or the error file (one row).
| HTTP response | Action |
|---|---|
400 / 422 | Fix the request. |
401 / 403 | 401: check the API key. 403: the account has no credit left, or the key cannot use batch. |
404 | The ID is wrong, deleted or owned by another account. |
409 | Create: the idempotency key was used with a different body. Delete: the file is the input of an unfinished batch. |
429 batch_queue_full | The queue is full. Wait for Retry-After (currently 300 s), then create again. |
Timeout / 5xx | Retry. For create, reuse the same idempotency key. |
Billing and file lifecycle
Batch costs 50% of the model's standard rates. See pricing.
| Case | What to expect |
|---|---|
| Input and output tokens | 50% of the model's rates |
| Cached input | 50% of the cache-read rate |
| Reasoning tokens | Billed as output tokens |
| Refusals and cut-off answers | Billed like any answer |
| Cancelled or expired batch | Finished rows are billed; rows that never ran are free |
| Price change while a batch runs | Each row is billed at the batch rate when it runs |
| Invalid input or no access | Free: nothing ran |
Example: qwen3.8-27b lists $0.20 input and $2.50 output per million tokens. One million of each costs $1.35 in a batch, against $2.70 live.
If your credit runs out, rows not yet started fail with HTTP 403. Files are deleted 31 days after upload.