跳转到主要内容
POST
/
replicate
/
v1
/
models
/
{models}
/
predictions
Create a Replicate prediction
curl --request POST \
  --url https://api.cometapi.com/replicate/v1/models/{models}/predictions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "input": {
    "prompt": "A paper boat floating on calm water at sunrise.",
    "aspect_ratio": "1:1",
    "output_format": "webp",
    "output_quality": 80
  }
}
'
{
  "id": "q4chw5rey9rmt0cww76t4h3ma4",
  "model": "black-forest-labs/flux-schnell",
  "version": "hidden",
  "input": {
    "aspect_ratio": "1:1",
    "output_format": "webp",
    "output_quality": 80,
    "prompt": "A paper boat floating on calm water at sunrise."
  },
  "logs": "",
  "output": null,
  "data_removed": false,
  "error": null,
  "source": "api",
  "status": "starting",
  "created_at": "2026-03-12T11:27:18.258Z",
  "urls": {
    "cancel": "https://api.replicate.com/v1/predictions/q4chw5rey9rmt0cww76t4h3ma4/cancel",
    "get": "https://api.replicate.com/v1/predictions/q4chw5rey9rmt0cww76t4h3ma4",
    "stream": "https://stream.replicate.com/v1/files/example",
    "web": "https://replicate.com/p/q4chw5rey9rmt0cww76t4h3ma4"
  }
}
使用此路由可在 CometAPI 上启动一个 Replicate 风格的 prediction,并返回一个 prediction id 以供后续轮询。

首次请求检查清单

  • 将所有模型参数都放在 input 对象内
  • 使用 black-forest-labs/flux-schnell 作为最轻量的冒烟测试起点
  • 除非你明确需要 input_imageinput_images,否则首次请求请仅使用文本
  • 保存返回的 prediction id,用于状态检查

任务流程

1

创建 prediction

通过此端点提交路径模型 id 和 input 对象。
2

存储 prediction id

保存返回的 id,因为后续轮询需要用到它。
3

轮询 prediction

继续参考 Replicate 查询状态,直到 output 被填充或出现错误。
2026-03-12 的实时验证确认,black-forest-labs/flux-schnell 接受了纯文本请求,并返回了一个状态为 starting 的 prediction id。

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

路径参数

models
string
必填

Replicate model id, for example black-forest-labs/flux-schnell or black-forest-labs/flux-kontext-pro.

请求体

application/json
input
object
必填

Provider-specific model input. Keep all parameters inside this object.

响应

200 - application/json

Prediction accepted.

id
string
必填
model
string
必填
input
object
必填
output
string[] | null
必填
error
string | null
必填
status
string
必填
created_at
string
必填
urls
object
必填
version
string
logs
string
data_removed
boolean
source
string