Replicate 
Authentication 
共同返回错误 
- HTTP 状态码:4xx
 
json
{
  "error": {
    "error_type": "invalid_parameter",
    "message": "xxxxx"
  }
}error_type:
- item_not_found(找不到条目)
 - config_invalid (console 配置问题)
 
Replicate Async 
Method & Path 
-  
POST {domain}/bp/ai/async/replicate -  
POST {domain}/bp/server/user/{user_id}/ai/async/replicate 
Request 
- content-type: 
application/json 
| Parameters | Type | Required | Desc | 
|---|---|---|---|
| strategy | string | true | strategy | 
| module | enum | true | 可选值见下方 | 
| model | string | false | 如果 module 为 model 则需要填写 | 
| data | json | true | 官方的参数 | 
module 可选值:
- model
 - prediction
 
说明:
目前 replicate 有两种模式:
POST https://api.replicate.com/v1/predictions
POST https://api.replicate.com/v1/models/modelOwner/modelName/predictions
第一种 module 填写 prediction 就行,body 就参照 replicate 官方写;
第二种 module 需要为 model ,并且 request 里面需要有一项: "model": "modelOwner/modelName"Response 
- HTTP 状态码:200
 
json
{
  "asset": [
    {
      "bp_product_id": "BUY4MF6V5ZJGXXJ3",
      "custom_expire_time": "0001-01-01T00:00:00Z",
      "expire_time": "2024-11-23T06:41:25Z",
      "is_auto_renewable": false,
      "is_consumable": true,
      "is_refund": false,
      "is_trial_period": false,
      "last_recovery_time": "2025-02-22T01:06:34Z",
      "name": "ai_vip_asset",
      "origin": "purchase",
      "platform": "stripe",
      "product_id": "prod_R4lGIYYAij8OBZ",
      "quantity": 5,
      "receipt_id": "sub_1QCbmTDESvfLoR1GbdjJ6F6I",
      "recoverable": true,
      "refund_time": "0001-01-01T00:00:00Z",
      "sub_canceled": false,
      "sub_canceled_time": "0001-01-01T00:00:00Z",
      "sub_canceled_ts": 0,
      "total_quantity": 0,
      "type": "subscription",
      "valid_seconds": 947270
    }
  ],
  "current_count": 2,
  "current_total_count": 26,
  "id": "706770485492490241"
}Rplicate Create Prediction 
接口功能: 创建 Prediction
说明:此接口为同步,需要阻塞此接口,设置超时时间为 5min;图生图需配合 replicate upload 使用
Method & Path 
-  
POST {domain}/bp/ai/prediction -  
POST {domain}/bp/server/user/{user_id}/ai/prediction 
Request 
- content-type: 
application/json 
| Parameters | Type | Required | Desc | 
|---|---|---|---|
| strategy | string | true | strategy | 
| version | string | true | 底模版本 | 
| input | json | false | 底层模型训练的参数,具体查看官方 | 
Response 
- HTTP 状态码:200
 
json
{
  "created": 1698294202,
  "current_count": 2,
  "current_total_count": 2,
  "id": "gm3qorzdhgbfurvjtvhg6dckhu",
  "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
  "input": {
    "text": "Alice"
  },
  "output": ["image_url"],
  "status": "succeeded"
}Rplicate Upload 
接口功能: 上传文件,用于图生图 说明:BytePower 自动生成文件名和判断文件类型。使用 replicate prediction 图生图时先调用此接口上传文件,然后客户端自己设置 input
Method & Path 
-  
PUT {domain}/bp/ai/upload -  
PUT {domain}/bp/server/user/{user_id}/ai/upload 
Request 
- content-type: "application/octet-stream"
 
Response 
- HTTP 状态码:200
 
json
{
  "url": "https://replicate.delivery/pbxt/JxANeQ2se2dXrgIXAtS2yKhGS7gNBxtbRifxCpuNMDBGsLIt/REPSEAYFDGZDIVHO.png"
}