Replicate
Replicate prediction 생성
POST /replicate/v1/models//predictions는 CometAPI에서 Replicate 형식으로 FLUX 이미지를 생성하며, 종횡비, 품질, 출력 형식, 입력 튜닝을 지원합니다.
POST
/
replicate
/
v1
/
models
/
{models}
/
predictions
cURL
curl https://api.cometapi.com/replicate/v1/models/black-forest-labs/flux-schnell/predictions \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"prompt": "A paper boat floating on calm water at sunrise.",
"aspect_ratio": "1:1",
"output_format": "webp"
}
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/replicate/v1/models/black-forest-labs/flux-schnell/predictions",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"input": {
"prompt": "A paper boat floating on calm water at sunrise.",
"aspect_ratio": "1:1",
"output_format": "webp",
}
},
)
prediction = response.json()
print(prediction["id"], prediction["status"]) # poll GET /replicate/v1/predictions/{id}const response = await fetch(
"https://api.cometapi.com/replicate/v1/models/black-forest-labs/flux-schnell/predictions",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
input: {
prompt: "A paper boat floating on calm water at sunrise.",
aspect_ratio: "1:1",
output_format: "webp",
},
}),
}
);
const prediction = await response.json();
console.log(prediction.id, prediction.status); // poll GET /replicate/v1/predictions/{id}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/replicate/v1/models/{models}/predictions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'input' => [
'prompt' => 'A paper boat floating on calm water at sunrise.',
'aspect_ratio' => '1:1',
'output_format' => 'webp',
'output_quality' => 80
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/replicate/v1/models/{models}/predictions"
payload := strings.NewReader("{\n \"input\": {\n \"prompt\": \"A paper boat floating on calm water at sunrise.\",\n \"aspect_ratio\": \"1:1\",\n \"output_format\": \"webp\",\n \"output_quality\": 80\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/replicate/v1/models/{models}/predictions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": {\n \"prompt\": \"A paper boat floating on calm water at sunrise.\",\n \"aspect_ratio\": \"1:1\",\n \"output_format\": \"webp\",\n \"output_quality\": 80\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/replicate/v1/models/{models}/predictions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": {\n \"prompt\": \"A paper boat floating on calm water at sunrise.\",\n \"aspect_ratio\": \"1:1\",\n \"output_format\": \"webp\",\n \"output_quality\": 80\n }\n}"
response = http.request(request)
puts response.read_body{
"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_image또는input_images가 필요하지 않다면 첫 요청은 텍스트 전용으로 유지하세요 - 상태 확인을 위해 반환된 prediction
id를 저장하세요
작업 흐름
1
prediction 생성
이 엔드포인트를 통해 경로 model id와
input 객체를 제출하세요.2
prediction id 저장
이후 폴링에 필요하므로 반환된
id를 저장하세요.3
prediction 폴링
output이 채워지거나 오류가 나타날 때까지 Replicate prediction 가져오기를 계속 진행하세요.인증
Bearer token authentication. Use your CometAPI key.
경로 매개변수
Replicate model id, for example black-forest-labs/flux-schnell or black-forest-labs/flux-kontext-pro.
본문
application/json
Provider-specific model input. Keep all parameters inside this object.
Show child attributes
Show child attributes
⌘I
cURL
curl https://api.cometapi.com/replicate/v1/models/black-forest-labs/flux-schnell/predictions \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"prompt": "A paper boat floating on calm water at sunrise.",
"aspect_ratio": "1:1",
"output_format": "webp"
}
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/replicate/v1/models/black-forest-labs/flux-schnell/predictions",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"input": {
"prompt": "A paper boat floating on calm water at sunrise.",
"aspect_ratio": "1:1",
"output_format": "webp",
}
},
)
prediction = response.json()
print(prediction["id"], prediction["status"]) # poll GET /replicate/v1/predictions/{id}const response = await fetch(
"https://api.cometapi.com/replicate/v1/models/black-forest-labs/flux-schnell/predictions",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
input: {
prompt: "A paper boat floating on calm water at sunrise.",
aspect_ratio: "1:1",
output_format: "webp",
},
}),
}
);
const prediction = await response.json();
console.log(prediction.id, prediction.status); // poll GET /replicate/v1/predictions/{id}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/replicate/v1/models/{models}/predictions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'input' => [
'prompt' => 'A paper boat floating on calm water at sunrise.',
'aspect_ratio' => '1:1',
'output_format' => 'webp',
'output_quality' => 80
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/replicate/v1/models/{models}/predictions"
payload := strings.NewReader("{\n \"input\": {\n \"prompt\": \"A paper boat floating on calm water at sunrise.\",\n \"aspect_ratio\": \"1:1\",\n \"output_format\": \"webp\",\n \"output_quality\": 80\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/replicate/v1/models/{models}/predictions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": {\n \"prompt\": \"A paper boat floating on calm water at sunrise.\",\n \"aspect_ratio\": \"1:1\",\n \"output_format\": \"webp\",\n \"output_quality\": 80\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/replicate/v1/models/{models}/predictions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": {\n \"prompt\": \"A paper boat floating on calm water at sunrise.\",\n \"aspect_ratio\": \"1:1\",\n \"output_format\": \"webp\",\n \"output_quality\": 80\n }\n}"
response = http.request(request)
puts response.read_body{
"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"
}
}