## Basic model info - Model name: black-forest-labs/black-forest-labs flux-kontext-max - Model description: FLUX.1 Kontext [max] is a model with greatly improved prompt adherence and typography generation meet premium consistency for editing without compromise on speed. - Endpoint name: text-to-image ## Model schema The model schema is defined in the OpenAPI schema: [OpenAPI Schema](https://oapi.sunra.ai/main/black-forest-labs/flux-kontext-max/latest.json) ### Model input schema The model input schema is: ```json { "description": "Input model for text-to-image generation.", "properties": { "prompt": { "description": "Text prompt for image generation.", "title": "Prompt", "type": "string", "x-sr-order": 200 }, "aspect_ratio": { "default": "16:9", "description": "Aspect ratio of the generated image.", "enum": [ "21:9", "16:9", "4:3", "3:2", "1:1", "2:3", "3:4", "9:16", "9:21" ], "title": "Aspect Ratio", "type": "string", "x-sr-order": 401 }, "guidance_scale": { "default": 3.5, "description": "The CFG (Classifier Free Guidance) scale. Higher values make the model follow the prompt more closely.", "maximum": 20, "minimum": 1, "multipleOf": 0.1, "title": "Guidance Scale", "type": "number", "x-sr-order": 402 }, "seed": { "description": "Seed for reproducibility.", "maximum": 2147483647, "minimum": 0, "title": "Seed", "type": "integer", "x-sr-order": 202 }, "enhance_prompt": { "default": false, "description": "Whether to enhance the prompt for better results. When enabled, the model will automatically refine the prompt for more creative generation.", "title": "Enhance Prompt", "type": "boolean", "x-sr-order": 201 }, "output_format": { "default": "jpeg", "description": "Output format for the generated image.", "enum": [ "jpeg", "jpg", "png" ], "title": "Output Format", "type": "string", "x-sr-order": 404 } }, "required": [ "prompt" ], "title": "TextToImageInput", "type": "object" } ``` ### Model output schema The model output schema is: ```json { "properties": { "images": { "items": { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" }, "title": "Images", "type": "array" } }, "required": [ "images" ], "title": "ImagesOutput", "type": "object" } ``` ## Example inputs and outputs Use the following example inputs and outputs to understand the model. ### Input example ```json { "prompt": "", "aspect_ratio": "16:9", "guidance_scale": 3.5, "seed": null, "enhance_prompt": false, "output_format": "jpeg" } ``` ### Output example ```json { } ``` ## Model code examples ### JavaScript ```javascript import { sunra } from "@sunra/client"; const result = await sunra.subscribe("black-forest-labs/flux-kontext-max/text-to-image", { input: { prompt: '', enhance_prompt: false, seed: null, guidance_scale: 3.5, output_format: 'jpeg', aspect_ratio: '16:9' }, logs: true, onQueueUpdate: (update) => { console.log(`Status Update: ${update.status}, Request ID: ${update.request_id}`); }, }); console.log(result.data); console.log(result.requestId); ``` ### Python ```python import sunra_client result = sunra_client.subscribe( "black-forest-labs/flux-kontext-max/text-to-image", arguments={ "prompt": "", "enhance_prompt": False, "seed": None, "guidance_scale": 3.5, "output_format": "jpeg", "aspect_ratio": "16:9" }, with_logs=True, on_enqueue=print, on_queue_update=print, ) print(result) ``` ### Java ```java import ai.sunra.client.*; import java.util.Map; import com.google.gson.JsonObject; var client = SunraClient.withEnvCredentials(); var response = client.subscribe( "black-forest-labs/flux-kontext-max/text-to-image", SubscribeOptions.builder() .input(Map.of( "prompt", "", "enhance_prompt", false, "seed", null, "guidance_scale", 3.5, "output_format", "jpeg", "aspect_ratio", "16:9")) .resultType(JsonObject.class) .onQueueUpdate(update -> System.out.printf( "\nStatus Update: %s, Request ID: %s%n", update.getStatus(), update.getRequestId() )) .logs(true) .build() ); System.out.println("Completed!"); System.out.println(response.getData()); ``` ### Kotlin ```kotlin import ai.sunra.client.kt.* import com.google.gson.JsonObject val client = createSunraClient() val response = client.subscribe( endpointId = "black-forest-labs/flux-kontext-max/text-to-image", input = mapOf( "prompt" to "", "enhance_prompt" to false, "seed" to null, "guidance_scale" to 3.5, "output_format" to "jpeg", "aspect_ratio" to "16:9"), options = ai.sunra.client.kt.SubscribeOptions(logs = true), onUpdate = { update -> println("\nStatus Update: ${update.status}, Request ID: ${update.requestId}") } ) println("Completed!") println(response.data) ``` ### Curl ```bash curl --request POST \ --url https://api.sunra.ai/v1/queue/black-forest-labs/flux-kontext-max/text-to-image \ --header "Authorization: Key $SUNRA_KEY" \ --header "Content-Type: application/json" \ --data '{"prompt":"","enhance_prompt":false,"seed":null,"guidance_scale":3.5,"output_format":"jpeg","aspect_ratio":"16:9"}' ``` ## Model readme undefined