Guides

Generating images

Text-to-image, image editing, and multi-input references.

5 min read

Image generations use POST /v1/generations with an image modelId. The fastest way to discover available models is the /v1/generation-options catalog endpoint.

Text-to-image

Pass a prompt and a model. Empty attachments means pure text-to-image.

1curl -X POST $BASE_URL/v1/generations \
2 -H "x-api-key: $SIXART_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "prompt": "A futuristic city with neon lights at sunset",
6 "modelId": "nano-banana",
7 "attachments": [],
8 "aspectRatio": "16:9",
9 "options": { "resolution": "1K" }
10}'

Image editing (input URL)

To edit an existing image, attach its URL with role: "input". Sixart fetches the URL server-side — make sure it's publicly reachable.

1curl -X POST $BASE_URL/v1/generations \
2 -H "x-api-key: $SIXART_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "prompt": "change the colour of the tshirt to black",
6 "modelId": "nano-banana",
7 "attachments": [
8 { "url": "https://your-cdn.com/path/to/input.jpg", "role": "input" }
9 ],
10 "aspectRatio": "9:16",
11 "options": { "resolution": "1K" }
12}'

Multi-input with @1 / @2

Some models accept multiple inputs. Reference them positionally in the prompt as @1, @2, … in the order they appear in the attachments array.

1curl -X POST $BASE_URL/v1/generations \
2 -H "x-api-key: $SIXART_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "prompt": "Place the subject from @1 into the scene from @2",
6 "modelId": "qwen-image-2.0-pro",
7 "attachments": [
8 { "url": "https://your-cdn.com/path/to/subject.jpg", "role": "input" },
9 { "url": "https://your-cdn.com/path/to/scene.jpg", "role": "reference" }
10 ],
11 "aspectRatio": "1:1"
12}'

Use /v1/generation-options to discover which models accept inputs vs. references and how many at a time.