Flux Kontext API
Flux Kontext API with VezAPI. Explore model capabilities, credit pricing, request parameters, and integration examples.
Flux Kontext API documentation
Integrate Flux Kontext with your VezAPI key. The operations below share the same authentication and account balance.
https://api.vezapi.comSend Authorization: Bearer YOUR_VEZAPI_KEY. Use a unique Idempotency-Key for each submission; reuse it only when checking the same request.
Generate or Edit Image
/api/v1/jobs/createTaskModel IDs: flux1-kontext
| Parameter | Type | Description & constraints |
|---|---|---|
modelrequired | string | Model version to use for generation. Values: Default: |
callBackUrloptional | string | The URL to receive image generation or editing task completion updates. Optional but recommended for production use. - System will POST task status and results to this URL when image generation or editing completes - Callback includes generated image URLs and task information for both text-to-image and image editing operations - Your callback endpoint should accept POST requests with JSON payload containing image results - For detailed callback format and implementation guide, see [Image Generation/Editing Callbacks]([see VezAPI documentation]) - Alternatively, use [Get Task Details](/market/common/get-task-detail) to poll task status - To ensure callback security, see [Webhook Verification Guide](/common-api/webhook-verification) for signature verification implementation |
inputrequired | object | |
input.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 |
input.modeloptional | string | Model tier: flux-kontext-pro (default) or flux-kontext-max (higher quality, higher price). Values: Default: |
input.enable_translationoptional | 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 |
input.upload_cnoptional | 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.input_imageoptional | 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 |
input.aspect_ratiooptional | 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 displays, panoramic views | | 16:9 | Widescreen | HD video, desktop wallpapers | | 4:3 | Standard | Traditional displays, presentations | | 1:1 | Square | Social media posts, profile pictures | | 3:4 | Portrait | Magazine layouts, portrait photos | | 9:16 | Mobile Portrait | Smartphone wallpapers, stories | Set this field explicitly to get a specific ratio. Values: |
input.output_formatoptional | string | Output image format. Values: Default: |
input.prompt_upsamplingoptional | boolean | - If true, performs upsampling on the prompt - May increase processing time Default: |
input.safety_toleranceoptional | 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 Values: Default: |
input.watermarkoptional | string | Watermark identifier to add to the generated image. - Optional - If provided, a watermark will be added to the output image |
Request example
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
-H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
-H 'Idempotency-Key: your-unique-request-id' \
-H 'Content-Type: application/json' \
-d '{
"callBackUrl": "https://example.com/input.png",
"input": {
"aspect_ratio": "16:9",
"enable_translation": true,
"output_format": "jpeg",
"prompt": "A serene mountain landscape at sunset with a lake reflecting the orange sky",
"prompt_upsampling": false
},
"model": "flux1-kontext"
}'Responses and errors
HTTP 200
Request successful
| Parameter | Type | Description & constraints |
|---|---|---|
codeoptional | integer | Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). Values: |
msgoptional | string | Error message when code != 200 |
dataoptional | object | |
data.taskIdoptional | string | Task ID, can be used with [Get Task Details](/market/common/get-task-detail) to query task status |
HTTP 500
Server error.
| Parameter | Type | Description & constraints |
|---|---|---|
coderequired | integer | Response status code - **200**: Success - Request has been processed successfully - **401**: Unauthorized - Authentication credentials are missing or invalid - **402**: Insufficient Credits - Account does not have enough credits to perform the operation - **404**: Not Found - The requested resource or endpoint does not exist - **408**: Timeout - No result has been returned for over 10 minutes. - **422**: Validation Error - The request parameters failed validation checks - **429**: Rate Limited - Request limit has been exceeded for this resource - **455**: Service Unavailable - System is currently undergoing maintenance - **500**: Server Error - An unexpected error occurred while processing the request - **501**: Generation Failed - Content generation task failed - **505**: Feature Disabled - The requested feature is currently disabled |
msgrequired | string | Response message, error description when failed |
datarequired | object |
Task status and callbacks
For asynchronous tasks, keep the returned taskId. Query GET /api/v1/jobs/recordInfo?taskId=... or provide callBackUrl when creating the task. Only the account that created a task can access it or derive new resources from it.
A timeout can mean the submission was accepted. Inspect the existing request in your dashboard; do not create another task automatically. Callback delivery is retried and may arrive more than once. Deduplicate with X-VezAPI-Event-Id.
Files, logs and billing
Generated media normally follows a 14-day provider lifetime; uploaded files expire after 24 hours. Save the files you need before expiration. VezAPI streams registered files without keeping a permanent media library. Request logs are retained for two calendar months.
Credits are reserved before submission. Final deductions match actual discounted consumption one for one. Unknown usage pauses new paid requests. If available funds cannot cover final usage while protecting other reservations, settlement stays pending until funded; model usage cannot make the wallet negative. Time-based inputs require server-side metadata reads; a failed read prevents submission.
Send a request using your VezAPI key. Successful generations use your account credits.
/api/v1/jobs/createTaskYour response will appear here.
Flux Kontext API pricing
Rates below are reference estimates; final deductions equal actual discounted consumption, one for one. At the standard pack rate, 1,000 credits ≈ $10. Larger packs reduce the effective credit price.
| Specification | Credits | Unit | USD reference |
|---|---|---|---|
| Black Forest Labs flux1-kontext, text-to-image, Pro | 5.0 | per image | $0.05 |
| Black Forest Labs flux1-kontext, text-to-image, Max | 10.0 | per image | $0.1 |