Skip to content

AI

Authentication

参考接入 BytePower

AI Info

接口功能: 获取用户的使用情况

Method & Path

  • GET {domain}/bp/ai
  • GET {domain}/bp/server/user/{user_id}/ai

Request

ParametersTypeRequiredDesc
strategystringtruestrategy
typestringfalse默认为 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

ParametersTypeRequiredDesc
idstringtrue任务 id
platformstringfalse平台
statusstringfalse任务状态

?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\":\"\"}}",
      "created_time": "2024-09-10T02:55:07.591005Z",
      "updated_time": "2024-09-10T02:55:35.098683Z"
    }
  ]
}

京ICP备19011570号-2