All models
Black Forest Labs
Image
Available
FLUX.1 Kontext Image
This is the new version of the API documentation; for the old version of the API, please see https://docs.kie.ai/old-model/flux-kontext-api/generate-or-edit-image. Create a new image generation or editing task using the Flux Kontext AI model.
Image Editing
From 60 credits (≈ ₹60.00) per request.
Parameters
| Parameter | Type | Description |
|---|---|---|
promptRequired |
string | Text prompt describing the desired image or edit. Required for both generation and editing modes. - Should be detailed and specific - For image editing, describe the desired changes - For image generation, describe the complete scene - IMPORTANT: Only English language is supported |
enable_translation |
boolean | Whether to enable automatic translation feature. - Since prompt only supports English, when this parameter is true, the system will automatically translate non-English prompts to English - If your prompt is already in English, you can set this to false - Default value: true |
upload_cn |
boolean | (Optional) Specifies the server region for image upload. Set to true to use servers in China, false to use non-China servers. Choose based on your geographical location for optimal upload speeds. |
input_image |
string | URL of the input image for editing mode. Required when editing an existing image. - Must be a valid image URL - Image must be accessible to the API server format: uri |
aspect_ratio |
string | Output image aspect ratio. You Applicable in both text-to-image generation and image editing modes. For **text-to-image generation** , the output image will follow the specified aspect ratio. For **image editing** , if aspect_ratio is provided, the edited image will follow that ratio. If not provided, the image will retain its original aspect ratio. Supported Aspect Ratios: | Ratio | Format Type | Common Use Cases | |-------|-------------|-----------------| | 21:9 | Ultra-wide | Cinematic displa one of: "21:9", "16:9", "4:3", "1:1", "3:4", "9:16" |
output_format |
string | Output image format. one of: "jpeg", "png" · default "jpeg" |
prompt_upsampling |
boolean | - If true, performs upsampling on the prompt - May increase processing time default false |
safety_tolerance |
integer | **For Image Generation Mode:** Moderation level for inputs and outputs. Value ranges from 0 (most strict) to 6 (more permissive). **For Image Editing Mode:** Moderation level for inputs and outputs. Value ranges from 0 (most strict) to 2 (balanced). Default: 2 one of: 0, 1, 2, 3, 4, 5, 6 · default 2 |
watermark |
string | Watermark identifier to add to the generated image. - Optional - If provided, a watermark will be added to the output image |
What you get back
Files arrive in output.files[] as private links that expire, with their type and size.
Use it from your code
# 1. Create the task
curl https://nexus.promptscenes.in/api/v1/tasks \
-H "Authorization: Bearer $NEXUS_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "flux.1-kontext-image",
"input": {
"prompt": "A cinematic shot of a lighthouse at dawn",
"aspect_ratio": "21:9",
"output_format": "jpeg",
"prompt_upsampling": false,
"safety_tolerance": 2
},
"callback_url": "https://your-app.com/webhooks/nexus"
}'
# 2. Poll for the result
curl https://nexus.promptscenes.in/api/v1/tasks/TASK_ID \
-H "Authorization: Bearer $NEXUS_API_KEY"
import os, time, uuid, requests
API = "https://nexus.promptscenes.in/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['NEXUS_API_KEY']}"}
task = requests.post(
f"{API}/tasks",
headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())},
json={
"model": "flux.1-kontext-image",
"input": {
"prompt": "A cinematic shot of a lighthouse at dawn",
"aspect_ratio": "21:9",
"output_format": "jpeg",
"prompt_upsampling": False,
"safety_tolerance": 2,
},
"callback_url": "https://your-app.com/webhooks/nexus",
},
).json()
while task["status"] not in ("succeeded", "failed", "cancelled"):
time.sleep(3)
task = requests.get(f"{API}/tasks/{task['id']}", headers=HEADERS).json()
print(task["status"], task.get("output"))
const API = "https://nexus.promptscenes.in/api/v1";
const headers = {
Authorization: `Bearer ${process.env.NEXUS_API_KEY}`,
"Content-Type": "application/json",
};
let task = await fetch(`${API}/tasks`, {
method: "POST",
headers: { ...headers, "Idempotency-Key": crypto.randomUUID() },
body: JSON.stringify({
"model": "flux.1-kontext-image",
"input": {
"prompt": "A cinematic shot of a lighthouse at dawn",
"aspect_ratio": "21:9",
"output_format": "jpeg",
"prompt_upsampling": false,
"safety_tolerance": 2
},
"callback_url": "https://your-app.com/webhooks/nexus"
}),
}).then((r) => r.json());
while (!["succeeded", "failed", "cancelled"].includes(task.status)) {
await new Promise((r) => setTimeout(r, 3000));
task = await fetch(`${API}/tasks/${task.id}`, { headers }).then((r) => r.json());
}
console.log(task.status, task.output);
Request
{
"model": "flux.1-kontext-image",
"input": {
"prompt": "A cinematic shot of a lighthouse at dawn",
"aspect_ratio": "21:9",
"output_format": "jpeg",
"prompt_upsampling": false,
"safety_tolerance": 2
}
}
Response
{
"id": "6f1c…",
"object": "task",
"model": "flux.1-kontext-image",
"status": "succeeded",
"output": {
"files": [
{
"url": "https://…signed…",
"mime": "…",
"size": 0
}
]
},
"estimated_cost": "…",
"charged": "…"
}