> ## Documentation Index
> Fetch the complete documentation index at: https://ppio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建批处理任务

> 了解 PPIO 创建 LLM 批处理任务的接口，查阅批量请求提交与任务组织方式，为集中处理模型推理工作提供参考。

成功 [上传文件](https://ppio.com/docs/models/reference-llm-upload-batch-input-file.md) 后，使用该文件的 ID 来发起一个批处理任务。请注意，完成窗口固定为 48 小时，当前不可修改。

## 请求头

**Content-Type** `string` *required*

枚举值: `application/json`

**Authorization** `string` *required*

Bearer 身份验证格式，例如：Bearer \{\{API 密钥}}。

## 请求体

**input\_file\_id** `string` *required*

已上传的、包含批处理请求的输入文件 ID。

**endpoint** `string` *required*

批处理所使用的端点。可用端点为 `/v1/chat/completions` 和 `/v1/completions`。

> [!WARNING]
>
> 为了兼容 OpenAI API，请将 `endpoint` 参数设置为 `/v1/chat/completions` 或 `/v1/completions`。

**completion\_window** `string`

批处理完成的时间窗口。当前固定为 `48h`，不可调整。

## 响应

**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*

请求计数的详细信息。

**properties**

**total** `integer` *required*

批处理中的请求总数。

**completed** `integer` *required*

成功完成的请求数量。

**failed** `integer` *required*

失败的请求数量。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.