Flux Kontext Pro API Integration
Flux Kontext Pro کو Rivya Public API v1 کے ذریعے model id flux-kontext-pro، supported inputs، parameters، Files API rules، credits اور response examples کے ساتھ استعمال کریں۔
flux-kontext-pro
text, file
Reference modes کے لیے required
4
Image
FIXED
کوئی documented prompt limit نہیں
Request contract
model id کو top level پر بھیجیں۔ Model-specific controls params میں رہتے ہیں۔
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
| model | string | Yes | flux-kontext-pro | flux-kontext-pro API model id استعمال کریں۔ |
| prompt | string | Yes | - | Text input support کرنے والے models کے لیے prompt text۔ |
| params | object | No | - | Model-specific parameter object۔ allowed keys کے لیے نیچے والی rows استعمال کریں۔ |
| client_request_id | string | No | - | آپ کے system میں requests trace کرنے کے لیے optional client-side id۔ |
Model parameters
| Key | Type | Required | Default | Range | Options | Description |
|---|---|---|---|---|---|---|
| aspectRatio | select | No | 16:9 | - | 21:9, 16:9, 4:3, 1:1, 3:4, 9:16 | پہلو کا تناسب |
| outputFormat | select | No | jpeg | - | jpeg, png | JPEG چھوٹا ہوتا ہے، جبکہ PNG transparency یا cleaner lossless edges کے لیے بہتر ہے۔ |
| enableTranslation | select | No | true | - | true, false | Prompt auto-translate کریں |
| promptUpsampling | select | No | false | - | false, true | فعال ہونے پر Rivya generation سے پہلے model کو آپ کا prompt expand اور polish کرنے دیتا ہے۔ یہ اکثر detail quality میں مدد کرتا ہے، مگر result کو raw prompt سے زیادہ interpretive بھی بنا سکتا ہے۔ |
| safetyTolerance | number | No | 2 | min 0 / max 6 | - | یہ control کرتا ہے کہ content moderation کتنی strict ہو۔ Generation عموماً editing سے wider range allow کرتی ہے؛ lower values زیادہ strict اور higher values زیادہ permissive ہوتے ہیں۔ |
| watermark | text | No | - | - | - | واٹرمارک |
Upload policy
Reference files پہلے upload کریں، پھر returned URL اور duration token کو params.referenceMediaItems کے اندر رکھیں۔
حوالہ تصویر: Image editing projects کے لیے 1 image file تک upload کریں۔
1
image
duration verification required ہو تو video اور audio references کو /api/v1/files سے durationToken ساتھ رکھنا چاہیے۔
| kind | Max size | MIME types |
|---|---|---|
| image | 10 MB | image/jpeg, image/png, image/webp |
Minimal request
{
"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": "اختیاری واٹرمارک متن"
}
}Reference-file request
{
"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": "اختیاری واٹرمارک متن",
"referenceMediaItems": [
{
"url": "https://cdn.example.com/reference-image.png",
"kind": "image",
"name": "reference-image.png",
"mimeType": "image/png"
}
]
}
}Create response
create endpoint ایک public task id واپس کرتا ہے۔ task succeeded یا failed ہونے تک status endpoint poll کریں۔
{
"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
}Common errors
validation_failed, insufficient_credits, idempotency_conflict, rate_limited, not_found
کچھ modes کو Files API reference uploads درکار ہوتے ہیں۔