Replicate
Create a Replicate prediction
POST /replicate/v1/models//predictions creates FLUX images via Replicate format on CometAPI, with aspect ratio, quality, output format, and input tuning.
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"
}
}Use this route to start a Replicate-style prediction on CometAPI and get back a prediction id for later polling.
First request checklist
- Put every model parameter inside the
inputobject - Start with
black-forest-labs/flux-schnellfor the quickest first request - Keep the first request text-only unless you specifically need
input_imageorinput_images - Save the returned prediction
idfor status checks
Task flow
1
Create the prediction
Submit the path model id and the
input object through this endpoint.2
Store the prediction id
Save the returned
id, because you need it for later polling.3
Poll the prediction
Continue with Get a Replicate prediction until
output is populated or an error appears.Authorizations
Bearer token authentication. Use your CometAPI key.
Path Parameters
Replicate model id, for example black-forest-labs/flux-schnell or black-forest-labs/flux-kontext-pro.
Body
application/json
Provider-specific model input. Keep all parameters inside this object.
Show child attributes
Show child attributes
Response
200 - application/json
Prediction accepted.
Last modified on June 23, 2026
⌘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"
}
}