Text-to-Image
Generate images from text prompts with vLLM-Omni, SGLang, or TensorRT-LLM
Choose a backend for text-to-image generation. See the Diffusion Overview for installation and shared configuration.
For image edits and the unsupported /v1/images/variations route, see
Image API Compatibility.
vLLM-Omni
SGLang
TensorRT-LLM
Text-to-image generation runs a vLLM-Omni worker with --output-modalities image.
Tested Models
To run a non-default model, pass --model to the launch script:
Launch
Launch using the provided script with Qwen/Qwen-Image:
Generate an Image
Image generation is available on two endpoints: /v1/chat/completions returns base64-encoded images inline in choices[].delta.content[].image_url, while /v1/images/generations returns a URL or base64 depending on response_format.
For /v1/images/generations and /v1/images/edits, Dynamo’s vLLM-Omni image handler accepts output_format values png (default), jpeg, and webp. It reports the encoded format in output_format; use jpeg for JPEG output. It reports size when every output has the same valid dimensions and returns null when dimensions are mixed or unavailable. This handler accepts response_format values url and b64_json; if omitted, the response uses base64. JPEG output composites transparent pixels onto white. This handler does not apply quality or background; requests that set either field are rejected with HTTP 400 rather than echoing values that were not used.
/v1/images/generations
/v1/chat/completions
Create a Variation with Image Edits
To generate a new image guided by an existing image, send a reference image and a prompt
to /v1/images/edits. Use a model that supports image conditioning; text-to-image support
alone does not establish editing support. This example uses black-forest-labs/FLUX.2-klein-4B
with vLLM 0.31.0 and vLLM-Omni 0.31.0rc1.
Use a Dynamo build containing the image-reference forwarding fix. Dynamo 1.5.1 ignores edit references. See Image API Compatibility for the JSON request contract and the remaining multipart-upload limitation.
Launch the reference-capable model from the repository root:
In a second terminal, encode a local PNG named reference.png into a JSON request. The
file is read on the client; the server receives a base64 data URL in input_reference.
Decode the returned PNG:
To use a hosted reference instead, set input_reference to an HTTP(S) image URL that the
worker can fetch. Do not use curl -F or the native vLLM-Omni image field through the
Dynamo frontend; this endpoint currently requires the JSON input_reference contract.
See Also
- Text-to-Image with SGLang
- Text-to-Image with TensorRT-LLM
- Disaggregated Serving — GLM-Image (2-stage text-to-image)
- vLLM-Omni Configuration reference