停止批量预测任务
本接口用于停止批量预测任务。
权限说明
调用本文API,需使用API Key鉴权方式。使用API Key鉴权调用API流程,具体调用流程,请查看认证鉴权。
请求参数
要取消的批量推理任务的ID。
POST /v2/batches/infer-abc123/cancel HTTP/1.1
Host: qianfan.baidubce.com
Authorization: Bearer <API Key>
Content-Type: application/json
示例代码
curl https://qianfan.baidubce.com/v2/batches/infer-abc123/cancel \
-H "Authorization: Bearer <API Key>" \
-H "Content-Type: application/json" \
-X POST
返回响应
批量推理任务的 id。
对象类型,返回batch。
批量任务中所有请求使用的接口。例:/v2/chat/completions。需要与输入文件中的url字段保持一致
用于处理批量预测的模型ID。如 ernie-x1-turbo-32k,千帆提供各种具有不同功能、性能特征和价格点的模型。请参考批量推理-支持模型列表,浏览和比较可用的模型。
批量推理任务错误码。
任务正常时为null。
显示子属性
隐藏子属性
标识错误类型的错误代码。
有关错误的详细原因。
批量推理任务文件的 id 。
处理批量推理任务的时间范围。
批量推理任务的当前状态。
- Running: 运行中
- Done: 运行完成
- Stopped: 运行中止
- Failed: 运行失败
- Expired: 运行超时
成功处理后的文件 id。
错误请求的文件 id。
创建批量推理任务时的Unix时间戳
批量推理任务开始处理的Unix时间戳。
批量推理任务将会到期的Unix时间戳。
批量推理任务到期时间的Unix时间戳。
批量推理任务处理失败时的Unix时间戳。
批量推理任务开始完成的Unix时间戳。
批量推理任务完成时间的Unix时间戳。
批量推理任务开始取消的Unix时间戳。
批量推理任务取消完成的Unix时间戳
批量推理任务中不同状态下的请求数量。
显示子属性
隐藏子属性
批量推理任务中的请求总数。
已成功完成的请求数量。
失败的请求数量。
表示 token 使用详情,包括输入 tokens、输出 tokens、输出 tokens 的明细以及使用的总 tokens 数。
显示子属性
隐藏子属性
输入 Tokens 的数量。
输入 Tokens 的详细信息。
显示子属性
隐藏子属性
命中缓存 Tokens 的数量。
输出 Tokens 的数量。
输出 Tokens 的数量。
显示子属性
隐藏子属性
深度思考Tokens数量
总Tokens数量
一组可以附加到对象的16个键值对。
显示子属性
隐藏子属性
暂无参数
{
"id": "infer-abc123",
"object": "batch",
"endpoint": "/v2/chat/completions",
"model": "ernie-x1-turbo-32k",
"errors": null,
"input_file_id": "file-abc123",
"completion_window": "48h",
"status": "Stopping",
"output_file_id": null,
"error_file_id": null,
"created_at": 1764923211,
"in_progress_at": null,
"expires_at": 1765096011,
"finalizing_at": null,
"completed_at": null,
"failed_at": null,
"expired_at": null,
"cancelled_at": null,
"cancelling_at": 1764923223,
"request_counts": {
"total": 0,
"completed": 0,
"failed": 0
},
"usage": {
"input_tokens": 0,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 0,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 0
},
"metadata": {
"messages": [
{
"content": "Tell me a joke about programming.",
"role": "user"
}
],
"model": "llama-3-8b",
"temperature": 1
}
}
{
"requestId": "0cd04e37-****-d97fe7e05d1d",
"code": "InferStatusError",
"message": "The batch task current status not support this operation"
}
