POST
/
openai
/
v1
/
batches
/
{batch_id}
/
cancel
取消批处理任务
curl --request POST \
  --url https://api.ppinfra.com/openai/v1/batches/{batch_id}/cancel \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>'
{
  "id": "<string>",
  "object": "<string>",
  "endpoint": "<string>",
  "input_file_id": "<string>",
  "output_file_id": "<string>",
  "error_file_id": "<string>",
  "completion_window": "<string>",
  "in_progress_at": {},
  "expires_at": {},
  "finalizing_at": {},
  "completed_at": {},
  "failed_at": {},
  "expired_at": {},
  "cancelling_at": {},
  "cancelled_at": {},
  "status": "<string>",
  "errors": "<string>",
  "version": 123,
  "created_at": "<string>",
  "updated_at": {},
  "created_by": "<string>",
  "created_by_key_id": "<string>",
  "remark": "<string>",
  "total": 123,
  "completed": 123,
  "failed": 123,
  "metadata": {},
  "request_counts": {
    "total": 123,
    "completed": 123,
    "failed": 123
  }
}

请求头

Content-Type
string
required
枚举值: application/json
Authorization
string
required
Bearer 身份验证格式,例如:Bearer {{API 密钥}}。

路径参数

batch_id
string
required
要取消的批处理任务唯一标识符。

响应

id
string
required
批处理任务的唯一标识符。
object
string
required
对象类型,恒为 batch
endpoint
string
required
批处理任务用于处理请求的 API 端点。
input_file_id
string
required
包含批处理请求的输入文件 ID。
output_file_id
string
required
包含批处理结果的输出文件 ID。在批处理完成之前为空。
error_file_id
string
required
包含批处理过程中发生的错误的错误文件 ID。在出现错误之前为空。
completion_window
string
required
批处理完成的时间窗口。当前固定为 48h
in_progress_at
string | null
批处理开始处理的时间戳。若尚未开始则为 null。
expires_at
string | null
批处理到期的时间戳。若未设置则为 null。
finalizing_at
string | null
批处理开始进入最终化阶段的时间戳。若尚未进入则为 null。
completed_at
string | null
批处理完成的时间戳。若尚未完成则为 null。
failed_at
string | null
批处理失败的时间戳。若未失败则为 null。
expired_at
string | null
批处理过期的时间戳。若未过期则为 null。
cancelling_at
string | null
批处理开始取消的时间戳。若未在取消中则为 null。
cancelled_at
string | null
批处理被取消的时间戳。若未被取消则为 null。
status
string
required
批处理任务的当前状态。可用状态:
  • VALIDATING - 在批处理开始前正在验证输入文件
  • PROGRESS - 批处理进行中
  • COMPLETED - 批处理成功完成
  • FAILED - 批处理失败
  • EXPIRED - 批处理超过截止时间
  • CANCELLING - 正在取消批处理
  • CANCELLED - 批处理已取消
errors
string
批处理过程中发生错误时的错误信息。
version
integer
required
批处理任务的版本号。
created_at
string
required
批处理任务的创建时间戳。
updated_at
string | null
批处理任务最近一次更新的时间戳。若从未更新则为 null。
created_by
string
required
创建该批处理任务的用户唯一标识符。
created_by_key_id
string
required
用于创建该批处理任务的 API Key ID。
remark
string
批处理任务的可选备注信息。
total
integer
required
批处理中的请求总数。
completed
integer
required
批处理中已完成的请求数量。
failed
integer
required
批处理中失败的请求数量。
metadata
object | null
与批处理任务关联的附加元数据。若无则为 null。
request_counts
object
required
请求计数的详细信息。