Skip to content

Replicate

Authentication

参考接入 BytePower

共同返回错误

  • HTTP 状态码:4xx
json
{
  "error": {
    "error_type": "invalid_parameter",
    "message": "xxxxx"
  }
}

error_type:

  • item_not_found(找不到条目)
  • config_invalid (console 配置问题)

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: "multipart/form-data"
ParametersTypeRequiredDesc
strategystringtruestrategy
versionstringtrue底模版本
inputjsonfalse底层模型训练的参数,具体查看官方

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"
}

京ICP备19011570号-2