Ketchup API (Google Nano Banana 2) Geliştirici Rehberi
Ketchup API görsel iş akışları için tasarlanmış adım adım kılavuzlar, örnek veri paketleri ve en iyi uygulamalarla hızlı geliştirin.
Ketchup API Genel Bakış
Ketchup API, öngörülebilir render kalitesiyle ürün çekimleri, kullanıcı arayüzü arka planları ve sosyal grafikler oluşturur. REST tasarımı entegrasyonları basit tutar. Platform, bireysel geliştiricilerden kurumsal lansmanlar.
Ketchup API Yetenekleri
- Ketchup API modelleriyle üretim sahneleri için optimize edilmiş metinden görsele dönüştürme.
- Tek Ketchup API isteğinde beş görsele kadar referans destekli düzenleme.
- Ketchup API render işlemi sırasında uygulamanızın yanıt verebilir kalması için asenkron iş kuyruğu.
- Ketchup API'nin durum değişikliklerini gerçek zamanlı gönderdiği webhook geri çağırmaları.
- Ketchup API yanıtlarını parse etmeyi kolaylaştıran tutarlı JSON şemaları.
- Ketchup API panelinde yönetilen Bearer token güvenliği.
overview.base_url
https://api.defapi.orgoverview.api_version
v1.0.0Ketchup API ile Başlangıç
- Ketchup API çalışma alanı açın ve erişim token'ı oluşturun.
- Her çağrıda Authorization başlığına Ketchup API Bearer token'ını ekleyin.
- Prompt'lar, mod ve referanslarla Ketchup API görsel oluşturma endpoint'ine POST gönderin.
- Dönen iş ID'sini saklayın ve durum endpoint'ini kontrol edin veya webhook'lara abone olun.
- Ketchup API işi başarılı olarak işaretlediğinde final dosyaları indirin.
Kimlik Doğrulama
Her Ketchup API isteği geçerli bir Bearer token gerektirir. Çevre başına anahtarları döndürün ve kullanımı sık sık denetleyin.
Bearer Token Yöntemi
Ketchup API token'ınızı aşağıda gösterildiği gibi Authorization başlığına ekleyin:
Authorization: Bearer <your-api-key>Token Format Örneği
Authorization: Bearer dk-1234567890abcdefÖrnek İstek
curl -X POST "https://api.defapi.org/api/image/gen" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-here" \
-d '{
"model": "google/gempix2",
"prompt": "A beautiful landscape"
}'Geçerli Token Kontrol Listesi
- ✅ Token aktif ve süresi dolmamış.
- ✅ Çalışma alanı Ketchup API erişimi etkinleştirilmiş.
- ✅ Hesap kalan kota veya krediye sahip.
Yaygın Sorunlar
- ❌ Authorization başlığı eksik.
- ❌ Hatalı Bearer token değeri.
- ❌ Askıya alınmış çalışma alanı veya iptal edilmiş token.
Ketchup API Görüntü Oluşturma
Ketchup API oluşturma uç noktasıyla yeni renderlar oluşturun, mevcut varlıkları revize edin veya mood board'ları harmanlayın.
Uç Nokta
POST /api/image/genİstek Parametreleri
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model identifier (e.g., "google/gempix2") |
| prompt | string | Yes | Text prompt describing the image |
| images | array | No | Reference image URLs (max 4) |
| callback_url | string | No | Webhook URL for completion notifications |
Kod Örnekleri
Temel Ketchup API Prompt'u
{
"model": "google/gempix2",
"prompt": "A beautiful girl dancing in a garden"
}Referanslarla Ketchup API Remix
{
"model": "google/gempix2",
"prompt": "Put them in a basket",
"images": [
"https://cdn.openai.com/API/docs/images/body-lotion.png",
"https://cdn.openai.com/API/docs/images/soap.png"
],
"callback_url": "https://example.com/webhook/image-callback"
}Yanıt Şeması
{
"code": 0,
"message": "ok",
"data": {
"task_id": "ta12345678-1234-1234-1234-123456789abc"
}
}Hata Yönetimi
400 - Bad Request
{"code": 1, "message": "failed", "detail": "prompt is required"}401 - Unauthorized
{"code": 1, "message": "Invalid API key"}Ketchup API İş Durumu
Durum uç noktasını kullanarak render ilerlemesini izleyin ve teslimat URL'lerini getirin.
Uç Nokta
GET /api/task/query?task_id=<task_id>Sorgu Parametreleri
| Parameter | Type | Required | Description |
|---|---|---|---|
| task_id | string | Yes | Unique task identifier returned from generation endpoint |
Örnek İstek
curl -X GET "https://api.defapi.org/api/task/query?task_id=ta823dfb-eaac-44fd-aec2-3e2c7ba8e071" \ -H "Authorization: Bearer your-api-key-here"
Durum Kodları
pending - Ketchup API isteği kabul etti ve işi sıraya aldı.submitted - Ketchup API işi işleme için planladı.in_progress - Ketchup API şu anda varlıkları render ediyor.success - Ketchup API render işlemini tamamladı ve varlıklar indirmeye hazır.failed - Ketchup API bir hata nedeniyle işi render edemedi.Hata Kodları
404 - Task Not Found
{"code": 1, "message": "task not found"}401 - Unauthorized
{"code": 401, "message": "Invalid API key"}Ketchup API Veri Modelleri
Ketchup API entegrasyonlarında kullanılan istek yükleri, iş yanıtları ve webhook gövdeleri için detaylı şemalar.
ImageGenResult
Represents a generated image result.
{
"image": "https://google.datas.systems/fileSystem/response_images/287/2025/08/29/1756432513771985292_2989.png"
}| Field | Type | Description |
|---|---|---|
| image | string | Image URL or base64 data URI |
CallbackPayload
Payload sent to the callback_url when task status changes to final states.
{
"result": [
{
"image": "https://google.datas.systems/fileSystem/response_images/287/2025/08/29/1756432513771985292_2989.png"
}
],
"status": "success",
"task_id": "ta5c9705-b8ae-4cb9-aa6f-97c4fee88c8d",
"consumed": "0.500000",
"status_reason": {
"message": null
}
}| Field | Type | Description |
|---|---|---|
| result | array | Array of ImageGenResult objects (null if failed) |
| status | string | Final task status (success/failed) |
| task_id | string | Unique task identifier |
| consumed | string | Credits consumed by the task |
| status_reason | object | Status details including error message if failed |
Model Şemaları
google/gempix2Nano Banana image generation modelgoogle/gemini-2.5-flash-imageGemini 2.5 Flash image modelSorun Giderme
Ketchup API hata formatlarını, yeniden deneme kurallarını ve desteğe ne zaman başvurulacağını anlayın.
HTTP Durum Kodları
OK
Request was successful
Bad Request
Invalid request parameters or malformed JSON
Unauthorized
Invalid, missing, or expired API key
Not Found
Task not found or endpoint doesn't exist
Internal Server Error
Server-side error occurred
En İyi Uygulamalar
- Yükü ayrıştırmadan önce HTTP durum kodunu kontrol edin.
- 500 hatalarından sonra Ketchup API işlerini yeniden denerken üstel geri çekilme kullanın.
- Ketchup API destek ekibinin sorunları izleyebilmesi için istek ID'sini kaydedin.
- 400 yanıtlarından kaçınmak için prompt'ları ve resim URL'lerini yerel olarak doğrulayın.
- Kimlik doğrulama başarısız olmaya başlarsa Ketchup API token'larını yenileyin.
- Hız limitlerini saygı göstermek için iş durumunu saniyede birden fazla sorgulamayın.
- Yüksek hacimli çalıştırmalar için webhook'ları tercih edin, böylece Ketchup API güncellemeleri gönderebilir.
Örnek Hata İşleme (JavaScript)
async function generateImage(prompt, apiKey) {
try {
const response = await fetch('https://api.defapi.org/api/image/gen', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
},
body: JSON.stringify({
model: 'google/gempix2',
prompt: prompt
})
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(`API Error ${response.status}: ${errorData.message}`);
}
const data = await response.json();
return data.data.task_id;
} catch (error) {
console.error('Image generation failed:', error.message);
throw error;
}
}