Integrasi API Flux Kontext Pro
Gunakan Flux Kontext Pro melalui Rivya Public API v1 dengan id model flux-kontext-pro, input yang didukung, parameter, aturan Files API, kredit, dan contoh response.
flux-kontext-pro
text, file
Diperlukan untuk mode referensi
4
Gambar
FIXED
Tidak ada batas prompt terdokumentasi
Kontrak request
Kirim id model di level atas. Kontrol khusus model berada di params.
| Key | Tipe | Wajib | Default | Deskripsi |
|---|---|---|---|---|
| model | string | Ya | flux-kontext-pro | Gunakan flux-kontext-pro sebagai id model API. |
| prompt | string | Ya | - | Teks prompt untuk model yang mendukung input teks. |
| params | object | Tidak | - | Objek parameter khusus model. Gunakan baris di bawah untuk key yang diizinkan. |
| client_request_id | string | Tidak | - | ID sisi klien opsional untuk melacak request di sistem Anda. |
Parameter model
| Key | Tipe | Wajib | Default | Rentang | Opsi | Deskripsi |
|---|---|---|---|---|---|---|
| aspectRatio | select | Tidak | 16:9 | - | 21:9, 16:9, 4:3, 1:1, 3:4, 9:16 | Rasio aspek |
| outputFormat | select | Tidak | jpeg | - | jpeg, png | JPEG lebih kecil, sedangkan PNG lebih baik untuk transparansi atau tepi lossless yang lebih bersih. |
| enableTranslation | select | Tidak | true | - | true, false | Terjemahkan prompt otomatis |
| promptUpsampling | select | Tidak | false | - | false, true | Saat aktif, Rivya membiarkan model memperluas dan memoles prompt Anda sebelum pembuatan. Ini sering membantu kualitas detail, tetapi juga dapat membuat hasil lebih interpretif daripada prompt mentah Anda. |
| safetyTolerance | number | Tidak | 2 | min 0 / max 6 | - | Mengontrol seberapa ketat moderasi konten. Pembuatan biasanya memungkinkan rentang yang lebih luas daripada pengeditan; nilai lebih rendah lebih ketat dan nilai lebih tinggi lebih permisif. |
| watermark | text | Tidak | - | - | - | Tanda air |
Kebijakan unggahan
Unggah file referensi terlebih dahulu, lalu tempatkan URL dan duration token yang dikembalikan ke dalam params.referenceMediaItems.
Gambar referensi: Unggah hingga 1 file gambar untuk proyek pengeditan gambar.
1
image
Referensi video dan audio harus membawa durationToken dari /api/v1/files saat verifikasi durasi diperlukan.
| kind | Ukuran maksimum | Tipe MIME |
|---|---|---|
| image | 10 MB | image/jpeg, image/png, image/webp |
Request minimal
{
"model": "flux-kontext-pro",
"prompt": "A clean editorial product image on a soft studio background",
"params": {
"aspectRatio": "16:9",
"outputFormat": "jpeg",
"enableTranslation": "true",
"promptUpsampling": "false",
"safetyTolerance": 2,
"watermark": "Teks tanda air opsional"
}
}Request file referensi
{
"model": "flux-kontext-pro",
"prompt": "A clean editorial product image on a soft studio background",
"params": {
"aspectRatio": "16:9",
"outputFormat": "jpeg",
"enableTranslation": "true",
"promptUpsampling": "false",
"safetyTolerance": 2,
"watermark": "Teks tanda air opsional",
"referenceMediaItems": [
{
"url": "https://cdn.example.com/reference-image.png",
"kind": "image",
"name": "reference-image.png",
"mimeType": "image/png"
}
]
}
}Response create
Endpoint create mengembalikan public task id. Poll endpoint status sampai tugas berhasil atau gagal.
{
"id": "task_flux_kontext_pro_example",
"status": "queued",
"model": "flux-kontext-pro",
"reserved_credits": 4,
"final_credits": 0,
"created_at": "2026-05-11T00:00:00.000Z",
"updated_at": "2026-05-11T00:00:00.000Z",
"result": null,
"error": null
}Error umum
validation_failed, insufficient_credits, idempotency_conflict, rate_limited, not_found
Beberapa mode membutuhkan unggahan referensi Files API.