{ "model_id": "black-forest-labs/flux-2-max", "provider_id": "black-forest-labs", "name": "FLUX.2 [max]", "description": "FLUX.2 [max] is Black Forest Labs' highest-quality image model \u2014 top editing consistency, strongest prompt following, and grounding search for visualizations of real-time information.", "task": "Text-to-Image", "tags": [ "Image Generation", "Image Editing", "High Quality", "Grounding Search" ], "context_length": null, "max_output_tokens": null, "schema_version": "1.0.0", "pricing": { "First output megapixel": 0.07, "Per additional output megapixel": 0.03, "Per input megapixel": 0.03 }, "examples": [ { "name": "High Resolution Scene", "description": "Text-to-image generation at near-4MP resolution using FLUX.2's highest-quality endpoint", "input": { "prompt": "A cat on its back legs running like a human is holding a big silver fish with its arms. The cat is running away from the shop owner and has a panicked look on his face. The scene is situated in a crowded market.", "height": 2048, "width": 1440 }, "output": { "image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-max/high-resolution-scene.jpeg" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-max/high-resolution-scene.jpeg" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'black-forest-labs/flux-2-max',\n {\n prompt:\n 'A cat on its back legs running like a human is holding a big silver fish with its arms. The cat is running away from the shop owner and has a panicked look on his face. The scene is situated in a crowded market.',\n height: 2048,\n width: 1440,\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"black-forest-labs/flux-2-max\",\n \"input\": {\n \"prompt\": \"A cat on its back legs running like a human is holding a big silver fish with its arms. The cat is running away from the shop owner and has a panicked look on his face. The scene is situated in a crowded market.\",\n \"height\": 2048,\n \"width\": 1440\n }\n}'" } ] }, { "name": "Hex Color Control", "description": "Exact color control via hex codes \u2014 useful for brand-consistent imagery", "input": { "prompt": "A vase on a table in living room, the color of the vase is a gradient of color, starting with color #02eb3c and finishing with color #edfa3c. The flowers inside the vase have the color #ff0088" }, "output": { "image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-max/hex-color-control.jpeg" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-max/hex-color-control.jpeg" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'black-forest-labs/flux-2-max',\n {\n prompt:\n 'A vase on a table in living room, the color of the vase is a gradient of color, starting with color #02eb3c and finishing with color #edfa3c. The flowers inside the vase have the color #ff0088',\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"black-forest-labs/flux-2-max\",\n \"input\": {\n \"prompt\": \"A vase on a table in living room, the color of the vase is a gradient of color, starting with color #02eb3c and finishing with color #edfa3c. The flowers inside the vase have the color #ff0088\"\n }\n}'" } ] }, { "name": "Image Editing", "description": "Single-reference image editing \u2014 relight or restage a product photo", "input": { "prompt": "Place this product onto a minimalist marble countertop with soft window light", "input_images": [ "https://replicate.delivery/xezq/jCypj4MeXYUiRyq7nfgm8z1OvFZF81wh4FznutDsZOuJz0YWA/tmp1iukn307.jpg" ] }, "output": { "image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-max/image-editing.jpeg" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-2-max/image-editing.jpeg" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'black-forest-labs/flux-2-max',\n {\n prompt: 'Place this product onto a minimalist marble countertop with soft window light',\n input_images: [\n 'https://replicate.delivery/xezq/jCypj4MeXYUiRyq7nfgm8z1OvFZF81wh4FznutDsZOuJz0YWA/tmp1iukn307.jpg',\n ],\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"black-forest-labs/flux-2-max\",\n \"input\": {\n \"prompt\": \"Place this product onto a minimalist marble countertop with soft window light\",\n \"input_images\": [\n \"https://replicate.delivery/xezq/jCypj4MeXYUiRyq7nfgm8z1OvFZF81wh4FznutDsZOuJz0YWA/tmp1iukn307.jpg\"\n ]\n }\n}'" } ] } ], "default_example": null, "code_snippets": [], "supports_async": false, "zdr": false, "zdr_comment": null, "external_info": "https://blackforestlabs.ai/", "terms": "https://blackforestlabs.ai/terms-of-service/", "cover_image_url": null, "metadata": { "Architecture": "Flow matching transformer", "Grounding Search": "Yes", "Max Reference Images": "8", "Max Resolution": "4MP" }, "request_formats": null, "providers": null, "provider_details": [ { "id": "black-forest-labs", "pricing": { "first_output_megapixel": 0.07, "subsequent_output_megapixel": 0.03, "input_megapixel": 0.03 } } ], "banner": null, "created_at": "2026-05-27 23:12:31", "schema": { "input": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string", "description": "Text prompt for image generation or editing." }, "seed": { "description": "Optional seed for reproducible generation.", "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "width": { "description": "Width of the generated image in pixels (minimum 64). Omit to let BFL pick.", "type": "integer", "minimum": 64, "maximum": 9007199254740991 }, "height": { "description": "Height of the generated image in pixels (minimum 64). Omit to let BFL pick.", "type": "integer", "minimum": 64, "maximum": 9007199254740991 }, "safety_tolerance": { "description": "Tolerance for input/output moderation. 0 is the strictest, 5 the most permissive. Defaults to 2.", "type": "integer", "minimum": 0, "maximum": 5 }, "output_format": { "description": "Output image format. Defaults to jpeg.", "type": "string", "enum": [ "jpeg", "png", "webp" ] }, "input_images": { "description": "Up to 8 reference images for editing or multi-image composition. Each entry is an HTTPS URL or a data:image/...;base64,... URI.", "maxItems": 8, "type": "array", "items": { "type": "string" } } }, "required": [ "prompt" ], "additionalProperties": false }, "output": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "image": { "type": "string", "format": "uri", "description": "URL to the generated image" } }, "required": [ "image" ], "additionalProperties": false } } }