FLUX 3 Image Klein: Text to Image
Generate one image from a text prompt with FLUX 3 Image Klein, no input files needed; an optional layout node adds bounding-box control.
Inside the workflow
A read-only preview of the source template. Open it in Cloud to explore the nodes and make changes.
Loading the graph
Open full-size workflow preview- Output
- Image
- Author
- Author unavailable
Call this model from your code
The request below uses the same prepared graph and settings as the Playground. Each submission can start a paid run; do not automatically retry a submission whose outcome is unknown.
What you need
- Runs on
- Comfy Cloud
- Key
- COMFY_API_KEY
Needs a paid Cloud plan and credits.
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"9": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "image_flux3_klein_base_t2i",
"images": [
"18:8",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"19": {
"class_type": "ResolutionSelector",
"inputs": {
"aspect_ratio": "16:9 (Widescreen)",
"megapixels": 1,
"multiple": 16
},
"_meta": {
"title": "Resolution Selector"
}
},
"25": {
"class_type": "CreateBoundingBoxes",
"inputs": {
"editor_state": {
"__value__": []
},
"height": 1024,
"last_incoming": {
"__value__": []
},
"width": 1024
},
"_meta": {
"title": "Create Bounding Boxes"
}
},
"26": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"27",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"27": {
"class_type": "Flux3LayoutPrompt",
"inputs": {
"element": [
"25",
2
],
"prompt": ""
},
"_meta": {
"title": "FLUX 3 Image Layout Prompt"
}
},
"18:1": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux3-image-klein-base-int8-convrot.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"18:11": {
"class_type": "TextGenerate",
"inputs": {
"clip": [
"18:12",
0
],
"max_length": 3584,
"mtp": "off",
"prompt": [
"18:17",
0
],
"sampling_mode": "on",
"sampling_mode.min_p": 0,
"sampling_mode.presence_penalty": 1.5,
"sampling_mode.repetition_penalty": 1,
"sampling_mode.seed": 0,
"sampling_mode.temperature": 1,
"sampling_mode.top_k": 1,
"sampling_mode.top_p": 0.95,
"system_prompt": [
"18:14",
0
],
"thinking": False,
"use_default_template": True
},
"_meta": {
"title": "Generate Text"
}
},
"18:12": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3.5_9b_flux3_prompt_upsampler_w4a8.safetensors",
"device": "default",
"type": "flux3"
},
"_meta": {
"title": "Load CLIP"
}
},
"18:13": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"18:16",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"18:14": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "You are the prompt upsampler of a text-to-image model. Expand the user's short request into ONE detailed, self-contained caption: the exact text the image model receives. Output only the caption, with no greetings, explanations, refusals, questions, Markdown, headings, JSON, coordinates, ids or angle-bracket tokens, and no quotes around it. If the input is not clearly an image request, caption a visualization of its concept. The request may begin with a \"TARGET CANVAS: W:H\" line: compose for that canvas (wide spreads content sideways, tall stacks it) and never mention the ratio or the canvas.\n\nFidelity and planning: keep every explicit subject, attribute, count, spatial constraint, style cue and piece of wording; never contradict, substitute, drop or narrow the request, and keep an abstract concept abstract. Decide everything left open as ONE concrete, consistent plan; never offer alternatives or hedge. Never re-express a stated constraint through another mechanism; add camera optics (depth of field, bokeh, blur) only when asked for or implied. Without a stated style, plan an actual photograph and open with the medium convention (\"Full-color outdoor photograph, ...\", \"Full-color indoor photograph, ...\", \"Studio photograph, ...\", \"Close-up photograph, ...\"); keep \"Photorealistic\" for renders, and turn \"photorealistic\" or \"realistic\" requests for photos into the photograph convention. Give a photograph a few ordinary, non-ideal specifics drawn from the scene's own objects instead of the stock-photo ideal. Do not invent names, brands, logos or celebrities; keep user-named ones. A long request keeps its content but not its wording: drop appraisal and sales vocabulary, turn moods into observable physical facts, and add only new concrete content with positions. Time of day is lighting, not rendered text.\n\nCaption format: one continuous prose block in the generative voice, never \"this image shows\", \"we can see\" or \"is visible\". Lead with medium and style, then scene, lighting and camera, then the subjects with concrete colors, materials and state. Every person in focus gets an observable profile: ethnicity, gender, age range, skin tone (\"fair skin\", \"brown skin\"), hair and clothing. Make the layout reconstructable from words: frame-relative positions (frame-left, frame-right, upper, lower, foreground, midground, background), sentence-initial anchors (\"On the left, ...\", \"In the background, ...\"), relations (holds, faces, behind) and a consistent order; describe up to about ten instances one by one, beyond that give the exact count and arrangement. Out-of-focus or distant planes are shapes, colors and silhouettes, never identities or readable text, and the background takes about a sixth of the caption. Be definite: no hedging adverbs, no quality or emotion judgments, no closing sentence about mood; state negations as what is present. Rendered text: transcribe every wording verbatim inside double quotes in its original language and script, keep the line breaks of multi-line text, and give its typography, color and placement; author concrete, domain-correct wording when the request needs text it does not supply, and name canonical structures (calendar, keyboard, periodic table) exactly with their full layout. All prose is English; only quoted text keeps its language. Typical length is 100 to 350 words, more for complex scenes.\n\nOutput only the caption.\n"
},
"_meta": {
"title": "Text (System prompt)"
}
},
"18:16": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"18:17",
0
],
"on_true": [
"18:11",
0
],
"switch": True
},
"_meta": {
"title": "If/Else Switch"
}
},
"18:17": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "A weathered fisherman in his sixties kneels on a granite harbour wall at first light, mending a torn trawl net, the dark mesh spread across his knees. Coiled rope and a rusted bucket sit beside him, gulls wheeling low over a flat grey sea behind. Cold blue light comes from the left, catching the salt crust on his waterproofs and the coarse weave of the net while his face falls into shadow under a flat cap. A distant trawler blurs into sea mist. Documentary photography, muted coastal palette, fine texture in rope and oilskin, natural grain, no retouching."
},
"_meta": {
"title": "Text (Multiline)"
}
},
"18:2": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3vl_4b_int8_convrot.safetensors",
"device": "default",
"type": "flux3"
},
"_meta": {
"title": "Load CLIP"
}
},
"18:3": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "flux2-vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"18:4": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"18:2",
0
],
"text": [
"18:13",
0
]
},
"_meta": {
"title": "Positive Prompt"
}
},
"18:5": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"18:2",
0
],
"text": ""
},
"_meta": {
"title": "Negative Prompt (empty = reference default)"
}
},
"18:6": {
"class_type": "EmptyFlux2LatentImage",
"inputs": {
"batch_size": 1,
"height": [
"19",
1
],
"width": [
"19",
0
]
},
"_meta": {
"title": "Empty Flux 2 Latent"
}
},
"18:7": {
"class_type": "KSampler",
"inputs": {
"cfg": 3.5,
"denoise": 1,
"latent_image": [
"18:6",
0
],
"model": [
"18:1",
0
],
"negative": [
"18:5",
0
],
"positive": [
"18:4",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 758781618552631,
"steps": 50
},
"_meta": {
"title": "KSampler"
}
},
"18:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"18:7",
0
],
"vae": [
"18:3",
0
]
},
"_meta": {
"title": "VAE Decode"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("9"):
output.to_file(output.name)Try an example
About this workflow
Text-only FLUX 3 Image Klein template. The FLUX 3 Image Klein SD subgraph takes the prompt and a ResolutionSelector size and SaveImage writes one PNG. A Flux3LayoutPrompt + CreateBoundingBoxes pair sits beside it for bbox-guided placement: plug the STRING output into the subgraph prompt input when you want it. Models come from black-forest-labs/flux-3-image-klein-comfy with a qwen3.5 9B prompt upsampler as the text encoder.