Chuyển đến nội dung chính
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"
  }
}
Sử dụng route này để khởi chạy một prediction theo kiểu Replicate trên CometAPI và nhận về prediction id để polling sau đó.

Danh sách kiểm tra cho request đầu tiên

  • Đặt mọi tham số model bên trong đối tượng input
  • Bắt đầu với black-forest-labs/flux-schnell để thực hiện smoke test nhẹ nhất
  • Giữ request đầu tiên chỉ gồm văn bản trừ khi bạn thực sự cần input_image hoặc input_images
  • Lưu id prediction được trả về để kiểm tra trạng thái

Luồng tác vụ

1

Tạo prediction

Gửi model id trong path và đối tượng input qua endpoint này.
2

Lưu prediction id

Lưu id được trả về, vì bạn sẽ cần nó để polling sau đó.
3

Polling prediction

Tiếp tục với Replicate Query Status cho đến khi output được điền hoặc xuất hiện lỗi.
Việc xác thực trực tiếp vào ngày 2026-03-12 đã xác nhận rằng black-forest-labs/flux-schnell chấp nhận request chỉ gồm văn bản và trả về prediction id với trạng thái starting.

Ủy quyền

Authorization
string
header
bắt buộc

Bearer token authentication. Use your CometAPI key.

Tham số đường dẫn

models
string
bắt buộc

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

Nội dung

application/json
input
object
bắt buộc

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

Phản hồi

200 - application/json

Prediction accepted.

id
string
bắt buộc
model
string
bắt buộc
input
object
bắt buộc
output
string[] | null
bắt buộc
error
string | null
bắt buộc
status
string
bắt buộc
created_at
string
bắt buộc
urls
object
bắt buộc
version
string
logs
string
data_removed
boolean
source
string