Overview
This API is an OpenAI compatible batches API. It is used to create a batch task from an uploaded JSONL file. Currently, this API is supported only by Alibaba Cloud's Qwen series of models.
API details
Constraints
- You must have an API Key. For more information, see Manage AI API Keys.
Request path
POST {BASE_URL}/api/v1/batches
Request header
Name |
Required |
Example value |
Description |
|---|---|---|---|
| Authorization | Yes | Bearer {token} | Authentication information |
| Content-Type | No | application/json | Request body format |
Request parameters
Path
None
Query
None
Body
Name |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| input_file_id | string | Yes | file-abc123 | ID of the uploaded JSONL file |
| endpoint | string | Yes | /v1/chat/completions | Target API endpoint for the batch task |
| completion_window | string | Yes | 24h | Completion time window for the batch task |
| metadata | object | No | {"description": "nightly eval job"} | Optional metadata objects |
Response
Response parameters
Name |
Type |
Description |
|---|---|---|
| success | boolean | Whether the request was successful |
| code | string | Response code |
| message | string | Response information |
| data | object | Business response data |
data
Name |
Type |
Description |
|---|---|---|
| id | string | Unique ID of the batch task |
| object | string | Object type, for example, batch. |
| endpoint | string | Target API endpoint for batch tasks |
| input_file_id | string | ID of the uploaded JSONL file |
| completion_window | string | Completion time window for the batch task |
| status | string | Batch task status |
| created_at | integer | Creation time |
Request example
curl --request POST '{BASE_URL}/api/v1/batches' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"input_file_id": "file-abc123",
"endpoint": "/v1/chat/completions",
"completion_window": "24h",
"metadata": {
"description": "nightly eval job"
}
}'
Response example
{
"success": true,
"code": "200",
"message": "successful",
"data": {
"id": "batch_abc123",
"object": "batch",
"endpoint": "/v1/chat/completions",
"input_file_id": "file-abc123",
"completion_window": "24h",
"status": "validating",
"created_at": 1711234567
}
}
