Skip to main content

Text-to-image

Send a text prompt, and the response contains the generated image. The request is synchronous. There is no task to poll.

Models

See Choosing a model for a comparison, and Performance tiers for the tiers that each model serves.

Endpoint

Request

Every request must include your API key and a JSON content type. See Authentication.
string
required
Your API key.
string
required
Must be application/json.
string
required
The model that generates the image.Options: nunchux-flux.2-klein-4b, nunchux-flux.2-klein-9b, nunchux-flux.1-schnell, nunchux-flux.1-dev, nunchux-flux.2-dev, nunchux-flux.2-dev-flash, nunchux-flux.3-image-klein, nunchux-flux.3-image-klein-base, nunchux-qwen-image, nunchux-qwen-image-2512-lightning, nunchux-qwen-image-2512, nunchux-qwen-image-2.1, nunchux-hidream-o1-image, nunchux-hidream-o1-image-flash, nunchux-ideogram-4, nunchux-z-image-turbo, nunchux-krea-2-turbo
string
required
A text description of the image. Specific, descriptive prompts give better results.On Qwen Image 2.1, the prompt can use up to 8192 tokens. A longer prompt returns a 400 with error.details.field set to prompt.
string
default:"radical_speed"
The balance of speed and cost. See Performance tiers.Options: radical_speed, radical_valueFLUX.1 dev, FLUX.2 dev and Qwen Image have radical_speed only. On these models, radical_value returns a 400.FLUX.2 dev Flash has radical_value only. Send "tier": "radical_value". A request without tier uses radical_speed, so it returns a 400.Do not send this field to Ideogram 4. On Ideogram 4, extra.rendering_speed selects the tier.
integer
Output width in pixels. Send it together with height. Required on models priced per megapixel. Today, that is every model except Ideogram 4, which uses 1024x1024 when you send no dimensions. Range: 1 to 8192. On Ideogram 4: 1024 to 2048, in steps of 16. On Z-Image Turbo: 256 to 2048, in steps of 16. On Krea 2 Turbo: 1024 to 2048, in steps of 16. On FLUX.1 dev: 256 to 2048, in steps of 32. On FLUX.2 dev, FLUX.2 dev Flash, Qwen Image and Qwen Image 2512: 256 to 2048, in steps of 16. On FLUX 3 Image Klein and FLUX 3 Image Klein Base: 256 to 4096, in steps of 16. On Radical Value, FLUX 3 Image Klein and FLUX 3 Image Klein Base take at most 4,194,304 pixels (width times height, the area of 2048x2048), so 4096x1024 works and 2576x1632 returns a 400. On Qwen Image 2.1: 256 to 2752, in steps of 32. On HiDream O1 and HiDream O1 Flash: one of the sizes listed under Dimensions below.
integer
Output height in pixels. Send it together with width. Required on models priced per megapixel. Today, that is every model except Ideogram 4, which uses 1024x1024 when you send no dimensions. Range: 1 to 8192. On Ideogram 4: 1024 to 2048, in steps of 16. On Z-Image Turbo: 256 to 2048, in steps of 16. On Krea 2 Turbo: 1024 to 2048, in steps of 16. On FLUX.1 dev: 256 to 2048, in steps of 32. On FLUX.2 dev, FLUX.2 dev Flash, Qwen Image and Qwen Image 2512: 256 to 2048, in steps of 16. On FLUX 3 Image Klein and FLUX 3 Image Klein Base: 256 to 4096, in steps of 16. On Radical Value, FLUX 3 Image Klein and FLUX 3 Image Klein Base take at most 4,194,304 pixels (width times height, the area of 2048x2048), so 4096x1024 works and 2576x1632 returns a 400. On Qwen Image 2.1: 256 to 2752, in steps of 32. On HiDream O1 and HiDream O1 Flash: one of the sizes listed under Dimensions below.
integer
HiDream O1, HiDream O1 Flash, FLUX.1 dev, FLUX.2 dev, FLUX.2 dev Flash, FLUX 3 Image Klein, FLUX 3 Image Klein Base, Qwen Image, Qwen Image 2512, Qwen Image 2.1, Z-Image Turbo and Krea 2 Turbo only. The number of denoising steps. Range: 1 to 16 on Z-Image Turbo and FLUX 3 Image Klein, 1 to 8 on Krea 2 Turbo, 12 to 50 on FLUX.2 dev Flash, 16 to 50 on FLUX 3 Image Klein Base, 1 to 50 on the others. Default: 28 on FLUX.1 dev, 40 on Qwen Image 2.1, 16 on FLUX 3 Image Klein, 8 on Z-Image Turbo and Krea 2 Turbo, 50 on the others. More steps give more detail, but take longer.On FLUX.2 dev Flash, the step count does not change the image or the time. The model is distilled, and every count it accepts runs the same schedule. It accepts steps so that a FLUX.2 dev request also works on it.Do not send this field to Ideogram 4: it returns a 400. On Ideogram 4, extra.rendering_speed selects the tier.
number
HiDream O1, Qwen Image, Qwen Image 2512, Qwen Image 2.1 and FLUX.1 dev only. How closely the image follows the prompt. Range: 0.0 to 20.0. Default: 5.0 on HiDream O1, 4.0 on Qwen Image and Qwen Image 2512, 1.0 on Qwen Image 2.1, off on FLUX.1 dev. Higher values follow the prompt more closely. Lower values give the model more freedom. On Qwen Image, Qwen Image 2512, Qwen Image 2.1 and FLUX.1 dev, it also sets how strongly the image avoids the negative_prompt.On FLUX.1 dev, send it with negative_prompt, at a value above 1.0. The model then renders a second pass for the negative prompt, so the request takes longer. Without it, FLUX.1 dev ignores negative_prompt.On Qwen Image 2.1, the default 1.0 has no effect. Send a value above 1.0 together with negative_prompt.
number
FLUX.1 dev, FLUX.2 dev and FLUX 3 Image Klein Base only. How closely the image follows the prompt. Range: 0.0 to 20.0. Default: 3.5 on FLUX.1 dev, 4.0 on FLUX.2 dev and FLUX 3 Image Klein Base.
string
Qwen Image, Qwen Image 2512, Qwen Image 2.1, FLUX.1 dev and FLUX 3 Image Klein Base only. What the image must not show. On FLUX.1 dev and Qwen Image 2.1, it takes effect only when you also send true_cfg_scale above 1.0.
string
default:"off"
Ideogram 4, FLUX 3 Image Klein and FLUX 3 Image Klein Base only. With any mode other than off, Nunchux rewrites the prompt into a detailed scene description before the image renders. On Ideogram 4, fast adds a few seconds. standard, balanced and quality take longer: up to about 40, 45 and 55 seconds. If the rewrite fails, the image renders from your prompt, and the response has no revised_prompt. On FLUX 3 Image Klein and FLUX 3 Image Klein Base, standard is the only mode, and it adds about 3 to 4 seconds. The response returns the rewritten prompt as revised_prompt. FLUX 3 Image Klein and FLUX 3 Image Klein Base follow a full description of the scene much better than a short prompt, so send standard unless your prompt already describes the subject, the setting, the light and the style.Options: off, fast, standard, balanced, quality. On FLUX 3 Image Klein and FLUX 3 Image Klein Base: off, standard.
object
Model options.
integer
default:1
The number of images to generate. Only 1 is supported.
string
default:"b64_json"
The format of the returned image.Options: url, b64_jsonIn both formats, Nunchux keeps the generated image for 7 days, so that it appears in your request history. Then Nunchux deletes it.
integer
The random seed. The same seed with the same parameters gives the same result.
boolean
default:true
Whether Nunchux’s content filter checks this request. Only accounts approved to turn moderation off may send false. Others get a 403. See Content moderation.
Dimensions
  • Send width and height together. A request with only one of them returns a 400.
  • Models priced per megapixel charge from the output area, so they require width and height. A request with no dimensions returns a 400. The API does not choose a default size for these models. The pricing page shows each model’s unit. Today, every text-to-image model except Ideogram 4 is priced per megapixel.
  • Both values must be integers. The string "1024" is rejected, not converted.
  • Larger images take longer to generate.
  • HiDream O1 and HiDream O1 Flash render these sizes: 1024x1024, 2048x2048, 2304x1728, 1728x2304, 2560x1440, 1440x2560, 2496x1664, 1664x2496, 3104x1312, 1312x3104, 2304x1792, 1792x2304. On HiDream O1 Flash, another size is not refused: the image comes back at the closest of these sizes, by aspect ratio first, which can be larger than you asked for. A request for 1536x1024 returns 2496x1664. Send one of the listed sizes to get the size you ask for.
A minimal request body:
A request body for Qwen Image 2.1, with a negative prompt:
A request body for FLUX 3 Image Klein, with prompt expansion. The response returns the rewritten prompt in data[0].revised_prompt:

Response

The response is JSON. The data array contains the image, as base64 data or as a URL.
integer
required
The Unix timestamp of the generation.
array
required
The generated items.
string
required
The model that generated the image.
string
required
The tier that served the request: radical_speed or radical_value. On Ideogram 4 this field is always radical_speed and does not show the Turbo, Balanced or Quality tier. The extra.rendering_speed you sent selects that tier.
Base64 format
URL format
To save a base64 result from cURL, add this pipe to the command:

Example

Tips

  • Write detailed prompts. Include the style, lighting, composition, colors, materials and atmosphere.
  • Use FLUX.2 Klein 9B for production output. Use FLUX.2 Klein 4B when speed is more important than detail.
  • Use Qwen Image when the image must contain text, and for Chinese text. Use Ideogram 4 when the words must be legible on a poster, a label or a cover. Put the exact words in quotes or capitals, and say where they go.
  • Use Qwen Image 2512 when you want more detail than Qwen Image 2512 Lightning gives and the extra time is acceptable. Use negative_prompt to keep things out of the image.
  • Use HiDream O1 for large, photographic images. Describe the light and the materials. A larger size costs more, because the price is per megapixel.
  • Use HiDream O1 Flash for HiDream O1’s large sizes in less time. Put everything in the prompt: it takes no guidance and no negative prompt.
  • Use FLUX.2 dev Flash to try many prompts quickly at FLUX.2 dev’s detail. Send tier as radical_value. To get a different image, change the seed, not steps. Put everything in the prompt: it takes no guidance and no negative prompt.
  • Use FLUX.2 dev or FLUX.1 dev when you want more detail than FLUX.2 Klein gives, and the extra time is acceptable. Steer them with guidance_scale. On FLUX.1 dev, to keep things out of the image, send negative_prompt with true_cfg_scale above 1.0, at the cost of a second pass.
  • Use FLUX 3 Image Klein for fast output from the newest FLUX generation. Write a full description of the scene: the subject, the setting, the light, the composition and the style. A short prompt gives a generic image. To have Nunchux write the description from a short prompt, send prompt_expansion set to standard. Keep the default 16 steps. It takes no guidance and no negative prompt.
  • Use FLUX 3 Image Klein Base when you want more detail or more control than FLUX 3 Image Klein gives, and the extra time is acceptable. Steer it with guidance_scale and negative_prompt. Send prompt_expansion set to standard for a short prompt.
  • Use Qwen Image 2.1 for images up to 2752x2752. Send width and height in multiples of 32. To keep things out of the image, send negative_prompt with true_cfg_scale above 1.0.
  • Use Z-Image Turbo for fast photographic images. It is step-distilled: keep the default 8 steps, and describe what you want in the prompt, because it takes no guidance and no negative prompt.
  • Use Krea 2 Turbo for fast photographic images at larger sizes, up to 2048x2048. Each side must be at least 1024. Keep the default 8 steps, and leave out guidance and the negative prompt. The same prompt and seed give a close result, but not always an identical image.
  • On Ideogram 4, draft with extra.rendering_speed set to turbo. Use quality for the final image.
  • On FLUX.2 Klein, FLUX 3 Image Klein, FLUX 3 Image Klein Base, Qwen Image 2512, Qwen Image 2512 Lightning, Qwen Image 2.1, HiDream O1, HiDream O1 Flash, Z-Image Turbo and Krea 2 Turbo, use radical_speed when response time is important. Use radical_value for large batches where cost per image is more important.
  • Keep the seed when you like a result. Then change one parameter at a time.

Errors and limits

Refused requests
  • Nunchux charges only after a successful generation. A refused request is never billed.
  • Do not branch on a dimension-specific code. A refused size, steps value or field returns invalid_request, and error.details.field names the field. engine_error means the model could not render a request it accepted.
For authentication, credit and rate-limit errors, see Error codes. Every request counts toward the requests-per-minute cap of your plan. See Rate limits.