AI Request
Authentication
查询历史记录
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 传递
| Parameters | Type | Required | Desc |
|---|---|---|---|
| page | int | true | 页码,范围 1~100 |
| page_size | int | true | 每页条数,范围 1~1000 |
| start_time | int64 | false | 下界(不含),毫秒时间戳 |
| end_time | int64 | false | 上界(不含),毫秒时间戳 |
| status | string | false | 状态过滤,多个值逗号分隔 |
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=trueResponse
- 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 字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| data | array | 记录列表 |
| request_id | string | 请求 ID(雪花 ID) |
| platform_id | string | 平台侧 ID |
| platform | string | 平台名称 |
| module | string | 模块(chat/image/video 等) |
| strategy | string | 策略名称 |
| status | string | 状态 |
| response | string | AI 平台原始响应(JSON 字符串) |
| error | string | 错误信息 |
| unit_price | object | 价格信息 |
| custom_response | object/null | 根据 strategy 配置解析的自定义响应 |
| created_time | string | 创建时间(ISO 8601) |
| updated_time | string | 更新时间(ISO 8601) |
| has_more | bool | 是否还有更多数据 |
批量删除记录
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
| Parameters | Type | Required | Desc |
|---|---|---|---|
| request_ids | []string | true | 要删除的请求 ID 列表 |
Request 示例
json
{
"request_ids": ["1893947283746816000", "1893947283746816001"]
}Response
- HTTP 状态码:200
- 无响应体
重复删除、不存在的 ID 均幂等返回 200。request_ids 为空返回 400。
