Replicate
Maak een Replicate prediction
POST /replicate/v1/models//predictions maakt FLUX-afbeeldingen via Replicate-indeling op CometAPI, met beeldverhouding, kwaliteit, uitvoerformaat en input-afstemming.
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"
}
}Gebruik deze route om een prediction in Replicate-stijl op CometAPI te starten en een prediction-id terug te krijgen om later te pollen.
Checklist voor het eerste verzoek
- Plaats elke modelparameter in het
input-object - Begin met
black-forest-labs/flux-schnellvoor het snelste eerste verzoek - Houd het eerste verzoek alleen tekst, tenzij je specifiek
input_imageofinput_imagesnodig hebt - Sla de geretourneerde prediction-
idop voor statuscontroles
Taakverloop
1
Maak de prediction
Dien de path model ID en het
input-object in via dit endpoint.2
Sla de prediction-id op
Sla de geretourneerde
id op, omdat je die nodig hebt om later te pollen.3
Poll de prediction
Ga verder met Haal een Replicate prediction op totdat
output is gevuld of er een fout verschijnt.Padparameters
Body
application/json
Laatst gewijzigd op 23 juni 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"
}
}