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

Documentation Index

Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt

Use this file to discover all available pages before exploring further.

使用這個路由可在 CometAPI 上啟動一個 Replicate 風格的 prediction,並取得一個 prediction id 以供後續輪詢。

首次請求檢查清單

  • 將所有模型參數放在 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 被填入或出現錯誤。

授權

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