AI 
Authentication 
Device Info 
AI 相关接口都支持以下方式传递设备信息,ai_cost 事件会使用请求中的 device_info。
Header 
header key: X-BytePower-DeviceInfo
header content: base64 编码之后的 device_info json string附录: device_info 结构 
json
{
    "appsflyer_id": string,
    "app_instance_id": string,
    "cuid": string,
    "user_id": string,
    "idfa": string,
    "idfv": string,
    "gaid": string,
    "uuid": string,
    "oaid": string,
    "imei": string
}AI Info 
接口功能: 获取用户的使用情况
Method & Path 
-  
GET {domain}/bp/ai -  
GET {domain}/bp/server/user/{user_id}/ai 
Request 
| Parameters | Type | Required | Desc | 
|---|---|---|---|
| strategy | string | true | strategy | 
| type | string | false | 默认为 chat | 
?strategy=openai&type=chat
type 支持 chat, image
Response 
json
{
  "asset": [
    {
      "last_recovery_time": "2024-09-10T00:00:00Z",
      "name": "ai_credit",
      "quantity": 50,
      "recoverable": true,
      "recovery_period": 1,
      "recovery_quantity": 50,
      "type": "consumable",
      "valid_seconds": 0
    }
  ],
  "asset_item": {
    "is_auto_renewable": false,
    "is_trial_period": false,
    "name": "",
    "quantity": 0,
    "total_quantity": 0,
    "duration": 0,
    "type": "",
    "sub_canceled": false,
    "sub_canceled_time": "0001-01-01T00:00:00Z",
    "is_consumable": false,
    "platform": "",
    "product_id": ""
  },
  "current_count": 0,
  "current_total_count": 80,
  "day_limit_count": 10,
  "life_limit_count": 100,
  "pre_prompt_limit": 1000,
  "user_life_surplus_count": 20,
  "user_surplus_count": 10
}AI Fetch 
接口功能:获取异步任务情况
Method & Path 
-  
GET {domain}/bp/ai/fetch -  
GET {domain}/bp/server/user/{user_id}/ai/fetch 
Request 
| Parameters | Type | Required | Desc | 
|---|---|---|---|
| id | string | true | 任务 id | 
| platform | string | false | 平台 | 
| status | string | false | 任务状态 | 
?id=683869973286653952
Response 
json
{
  "asset": [],
  "data": [
    {
      "request_id": "683869973286653952",
      "platform_id": "c72a5d0a-2e9e-43cc-b6be-43b74d4d477e",
      "platform": "goapi",
      "module": "flux",
      "status": "succeeded",
      "response": "{\"task_id\":\"c72a5d0a-2e9e-43cc-b6be-43b74d4d477e\",\"model\":\"Qubico/flux1-schnell\",\"task_type\":\"txt2img\",\"status\":\"completed\",\"input\":{\"image\":\"\",\"negative_prompt\":\"\",\"prompt\":\"white cloud\",\"steps\":0},\"output\":{\"image_url\":\"https://6snd6lgebz.static.bytepower.app/ai/image_resp/2024-09-10/764158083114.png\"},\"meta\":{\"completed_at\":\"2024-09-10T02:55:22.316302Z\",\"created_at\":\"2024-09-10T02:55:07.531810Z\",\"started_at\":\"2024-09-10T02:55:07.532037Z\"},\"logs\":[],\"error\":{\"code\":0,\"message\":\"\"}}",
      "custom_response": {},
      "unit_price": {
        "input_per_price": 0.005,
        "output_per_price": 0.04,
        "output_token": 544,
        "input_token": 16
      },
      "created_time": "2024-09-10T02:55:07.591005Z",
      "updated_time": "2024-09-10T02:55:35.098683Z"
    }
  ]
}