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 yêu cầu đầu tiên

  • Đặt mọi tham số model bên trong object input
  • Bắt đầu với black-forest-labs/flux-schnell cho bài kiểm tra nhanh nhẹ nhất
  • Giữ yêu cầu đầu tiên chỉ ở dạng 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à object 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 này.
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.

Ủ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