PlatformAPI documentation

Developer docs

7. Image generation API

Version 1.0 · 2026-10-20

← Back to the API reference

POST /v1/images/generations (also available as POST /v1/images) generates PNG images from text and returns them as base64. The endpoint accepts only the fields below; any other field returns 400.

Request parameters

ParameterTypeRequiredDescription
modelstringYesflux-schnell or chroma1-hd
promptstringYesDescription of the image
nintegerNoNumber of images, 1–4, default 1; billed per image
sizestringNoWIDTHxHEIGHT, each side 256–1536, rounded down to a multiple of 16; default 1024x1024
seedintegerNo0–4294967295; fix it to reproduce a result
stepsintegerNoflux-schnell: default 4, max 8. chroma1-hd: default 25, max 50
negative_promptstringNoWhat you do not want in the image; recommended for chroma1-hd only
guidance_scalenumberNoHow closely to follow the prompt; chroma1-hd only
stylestringNoPortrait layout presets: person, person_scene, object. They rewrite the prompt and add a negative prompt automatically — leave unset for general use
response_formatstringNoOnly b64_json is supported; image URLs are not provided

Example

python
import base64

resp = client.images.generate(
    model="flux-schnell",
    prompt="Jiufen Old Street in morning light, photorealistic",
    size="1024x1024",
    n=1,
    extra_body={"seed": 7},
)
with open("jiufen.png", "wb") as f:
    f.write(base64.b64decode(resp.data[0].b64_json))

Response

json
{
  "created": 1792483207,
  "data": [{ "b64_json": "iVBORw0KGgo...", "media_type": "image/png" }],
  "seed": 7,
  "steps": 4,
  "model": "flux-schnell",
  "guidance_scale": 0.0,
  "usage": { "prompt_tokens": 0, "completion_tokens": 1000, "total_tokens": 1000 }
}

Which model to choose

  • flux-schnell: speed first — suited to large batches of drafts and real-time generation inside a product.
  • chroma1-hd: quality first, with negative prompts and guidance_scale — suited to production assets.

Both cost US$0.01 per image. flux-schnell accepts negative_prompt, but it has almost no effect and makes generation slower; if you need a negative prompt, use chroma1-hd.