Replicate
Bir Replicate prediction alın
Görsel oluşturma iş akışlarında görev ID’sine göre Replicate prediction ayrıntılarını ve gerçek zamanlı ilerlemeyi almak için GET /replicate/v1/predictions/ sorgusunu kullanın.
GET
/
replicate
/
v1
/
predictions
/
{id}
cURL
curl "https://api.cometapi.com/replicate/v1/predictions/<prediction_id>" \
-H "Authorization: Bearer $COMETAPI_KEY"import os
import time
import requests
prediction_id = "<prediction_id>"
headers = {"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]}
while True:
prediction = requests.get(
f"https://api.cometapi.com/replicate/v1/predictions/{prediction_id}",
headers=headers,
).json()
print(prediction["status"])
if prediction["status"] in ("succeeded", "failed", "canceled"):
break
time.sleep(3)
if prediction["status"] == "succeeded":
print(prediction["output"])
const predictionId = "<prediction_id>";
const headers = { Authorization: `Bearer ${process.env.COMETAPI_KEY}` };
let prediction;
while (true) {
prediction = await (await fetch(
`https://api.cometapi.com/replicate/v1/predictions/${predictionId}`, { headers }
)).json();
console.log(prediction.status);
if (["succeeded", "failed", "canceled"].includes(prediction.status)) break;
await new Promise((resolve) => setTimeout(resolve, 3000));
}
if (prediction.status === "succeeded") console.log(prediction.output);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/replicate/v1/predictions/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/replicate/v1/predictions/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cometapi.com/replicate/v1/predictions/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/replicate/v1/predictions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<prediction_id>",
"model": "black-forest-labs/flux-schnell",
"status": "succeeded",
"output": [
"https://replicate.delivery/xezq/.../out-0.webp"
],
"error": null
}Bu endpoint’i, zaten bir Replicate prediction ID’niz olduktan sonra kullanın. Geçerli görev durumunu bildirir ve prediction tamamlandığında çıktı URL’lerini döndürür.
Önce şu alanları kontrol edin
- prediction’ın hâlâ çalışıp çalışmadığını veya zaten tamamlanıp tamamlanmadığını görmek için
status - oluşturulan varlık URL’leri için
output - sağlayıcı tarafındaki hatalar için
error - yürütme zamanlaması veya görsel sayısı ayrıntılarına ihtiyaç duyduğunuzda
metrics
Polling düzeni
1
Önce prediction oluşturun
Create a Replicate prediction ile başlayın.
2
prediction ID’sine göre sorgulayın
status terminal duruma gelene ve output ya dolana ya da bir sağlayıcı hatası dönene kadar sorgulamaya devam edin.3
Tamamlanan varlıkları kalıcı olarak saklayın
Döndürülen varlık URL’lerini teslim URL’leri olarak değerlendirin ve uzun süreli saklama gerekiyorsa bunları kendi depolamanıza taşıyın.
Yanıt
200 - application/json
Current prediction state.
Son değiştirilme tarihi 23 Haziran 2026
⌘I
cURL
curl "https://api.cometapi.com/replicate/v1/predictions/<prediction_id>" \
-H "Authorization: Bearer $COMETAPI_KEY"import os
import time
import requests
prediction_id = "<prediction_id>"
headers = {"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]}
while True:
prediction = requests.get(
f"https://api.cometapi.com/replicate/v1/predictions/{prediction_id}",
headers=headers,
).json()
print(prediction["status"])
if prediction["status"] in ("succeeded", "failed", "canceled"):
break
time.sleep(3)
if prediction["status"] == "succeeded":
print(prediction["output"])
const predictionId = "<prediction_id>";
const headers = { Authorization: `Bearer ${process.env.COMETAPI_KEY}` };
let prediction;
while (true) {
prediction = await (await fetch(
`https://api.cometapi.com/replicate/v1/predictions/${predictionId}`, { headers }
)).json();
console.log(prediction.status);
if (["succeeded", "failed", "canceled"].includes(prediction.status)) break;
await new Promise((resolve) => setTimeout(resolve, 3000));
}
if (prediction.status === "succeeded") console.log(prediction.output);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/replicate/v1/predictions/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/replicate/v1/predictions/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cometapi.com/replicate/v1/predictions/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/replicate/v1/predictions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<prediction_id>",
"model": "black-forest-labs/flux-schnell",
"status": "succeeded",
"output": [
"https://replicate.delivery/xezq/.../out-0.webp"
],
"error": null
}