Create a batch task. You need to first upload a JSONL file with purpose=βbatchβ via the Files API, then use the returned file_id to create the task.
| Limit | Description |
|---|---|
| File format | Must have .jsonl extension |
| File size | Must be non-empty, max 100MB |
| Organization quota | Up to 1000 batch-purpose files per organization |
| Model consistency | All requests in a batch must use the same model |
custom_id | Must be unique within the file |
| Model access | The specified model must exist and the user must have access |
The Authorization header expects a Bearer token. Use an MOONSHOT_API_KEY as the token. This is a server-side secret key. Generate one on the API keys page in your dashboard.
ID of the input file, must be a .jsonl file uploaded with purpose="batch"
Request endpoint, currently only /v1/chat/completions is supported
/v1/chat/completions Time window for task processing, supports formats like 12h, 1d, 3d, minimum 12h, maximum 7d
Custom metadata, up to 16 key-value pairs, key max 64 chars, value max 512 chars
The created batch task
Unique identifier for the batch task
Object type, always batch
"batch"
Request endpoint
Input file ID
Processing time window
Current status: validating, failed, in_progress, finalizing, completed, expired, cancelling, cancelled
validating, failed, in_progress, finalizing, completed, expired, cancelling, cancelled Creation timestamp (Unix)
Output file ID for successful results
Error file ID for failed results
Execution start timestamp (Unix)
Expiration timestamp (Unix)
Result preparation start timestamp (Unix)
Completion timestamp (Unix)
Validation failure timestamp (Unix)
Cancellation request timestamp (Unix)
Cancellation completion timestamp (Unix)
Custom metadata