跳轉到主要內容
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。

首次請求檢查清單

  • 將所有 model 參數放入 input 物件中
  • 先使用 black-forest-labs/flux-schnell 進行最輕量的冒煙測試
  • 除非你明確需要 input_imageinput_images,否則第一個請求請保持為純文字
  • 保存回傳的 prediction id,以便檢查狀態

任務流程

1

建立 prediction

透過此端點提交路徑中的 model id 與 input 物件。
2

儲存 prediction id

保存回傳的 id,因為你之後輪詢時會需要它。
3

輪詢 prediction

繼續參考 Replicate Query Status,直到 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