亮色模式
Create batch
POST
https://api.openai.com/v1/batchesCreates and executes a batch from an uploaded file of requests
Request
Header 参数
Authorization
string
必需
示例值:
Bearer $OPENAI_API_KEY
Content-Type
string
必需
示例值:
application/json
Body 参数application/json
input_file_id
string
必需
The ID of an uploaded file that contains requests for the new batch.
See upload file for how to upload a file.
Your input file must be formatted as a JSONL file, and must be uploaded with the purpose batch
. The file can contain up to 50,000 requests, and can be up to 200 MB in size.
endpoint
string
必需
The endpoint to be used for all requests in the batch. Currently /v1/chat/completions
, /v1/embeddings
, and /v1/completions
are supported. Note that /v1/embeddings
batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch.
completion_window
string
必需
The time frame within which the batch should be processed. Currently only 24h
is supported.
示例
{
"input_file_id": "file-abc123",
"endpoint": "/v1/chat/completions",
"completion_window": "24h"
}
Request samples
返回响应
Success(200)
HTTP Code: 200
Content Type : JSONapplication/json
数据结构
id
string
必需
object
string
必需
endpoint
string
必需
errors
null
必需
input_file_id
string
必需
completion_window
string
必需
status
string
必需
output_file_id
null
必需
error_file_id
null
必需
created_at
integer
必需
in_progress_at
null
必需
expires_at
null
必需
finalizing_at
null
必需
completed_at
null
必需
failed_at
null
必需
expired_at
null
必需
cancelling_at
null
必需
cancelled_at
null
必需
request_counts
object
必需
total
integer
必需
completed
integer
必需
failed
integer
必需
metadata
object
必需
customer_id
string
必需
batch_description
string
必需
示例
{
"id": "batch_abc123",
"object": "batch",
"endpoint": "/v1/chat/completions",
"errors": null,
"input_file_id": "file-abc123",
"completion_window": "24h",
"status": "validating",
"output_file_id": null,
"error_file_id": null,
"created_at": 1711471533,
"in_progress_at": null,
"expires_at": null,
"finalizing_at": null,
"completed_at": null,
"failed_at": null,
"expired_at": null,
"cancelling_at": null,
"cancelled_at": null,
"request_counts": {
"total": 0,
"completed": 0,
"failed": 0
},
"metadata": {
"customer_id": "user_123456789",
"batch_description": "Nightly eval job",
}
}
最后修改时间: 9 天前