Skip to content

AI Request

Authentication

参考接入 BytePower

查询历史记录

Method & Path

  • GET {domain}/bp/ai/ai_request/history/query
  • GET {domain}/bp/server/user/{user_id}/ai/ai_request/history/query

Request

  • 参数通过 Query String 传递
ParametersTypeRequiredDesc
pageinttrue页码,范围 1~100
page_sizeinttrue每页条数,范围 1~1000
start_timeint64false下界(不含),毫秒时间戳
end_timeint64false上界(不含),毫秒时间戳
statusstringfalse状态过滤,多个值逗号分隔

status 可选值

说明
succeeded已成功
failed已失败
processing处理中
pending等待中
queueing排队中

Request 示例

GET /ai_request/history/query?page=1&page_size=20

GET /ai_request/history/query?page=1&page_size=20&start_time=1709300000000&end_time=1709400000000

GET /ai_request/history/query?page=1&page_size=10&status=succeeded,processing

GET /ai_request/history/query?page=1&page_size=20&from_appserver=true

Response

  • HTTP 状态码:200
json
{
  "data": [
    {
      "request_id": "767212140985061376",
      "platform_id": "767212180373770240",
      "platform": "openai",
      "module": "image",
      "strategy": "dell-3",
      "status": "succeeded",
      "response": "{...}",
      "error": "",
      "unit_price": {
        "input_per_price": 0,
        "output_per_price": 0,
        "output_token": 1,
        "input_token": 0
      },
      "custom_response": {
        "image_urls": []
      },
      "created_time": "2025-04-28T02:27:08.523175Z",
      "updated_time": "2025-07-11T10:05:42.66216Z"
    }
  ],
  "has_more": true
}

Response 字段说明

字段类型说明
dataarray记录列表
request_idstring请求 ID(雪花 ID)
platform_idstring平台侧 ID
platformstring平台名称
modulestring模块(chat/image/video 等)
strategystring策略名称
statusstring状态
responsestringAI 平台原始响应(JSON 字符串)
errorstring错误信息
unit_priceobject价格信息
custom_responseobject/null根据 strategy 配置解析的自定义响应
created_timestring创建时间(ISO 8601)
updated_timestring更新时间(ISO 8601)
has_morebool是否还有更多数据

批量删除记录

Method & Path

  • POST {domain}/bp/ai/ai_request/history/delete
  • POST {domain}/bp/server/user/{user_id}/ai/ai_request/history/delete

Request

  • content-type: application/json
ParametersTypeRequiredDesc
request_ids[]stringtrue要删除的请求 ID 列表

Request 示例

json
{
  "request_ids": ["1893947283746816000", "1893947283746816001"]
}

Response

  • HTTP 状态码:200
  • 无响应体

重复删除、不存在的 ID 均幂等返回 200。request_ids 为空返回 400。

京ICP备19011570号-2