Skip to content
lumalabs.ai

Image generation

Complete parameter reference for generating images with the Luma Agents API — prompts, aspect ratios, styles, reference images, web search, and output formats.

Create images from text descriptions. This guide covers every parameter for type: "image" requests. For editing existing images, see Image editing.

At minimum, you need a prompt:

from luma_agents import Luma
client = Luma()
generation = client.generations.create(
prompt="An astronaut riding a horse on Mars, oil painting style",
)

When no other parameters are specified, the API uses these defaults: model: "uni-1", type: "image", style: "auto". aspect_ratio and output_format are left unset so the model can pick an appropriate value based on the prompt — pass them explicitly to force a specific ratio or format.

A text description of the image to generate, from 1 to 6,000 characters. Be specific about subject, setting, lighting, style, and mood for best results.

{
"prompt": "A neon-lit Tokyo alley in the rain, reflections on wet pavement, cinematic photography"
}

Which model to use. Defaults to "uni-1". Supported values:

  • uni-1 — the default.
  • uni-1-max — produces higher-quality output than uni-1. See Models for details and Pricing for per-image rates.
{
"model": "uni-1"
}

Controls the output image dimensions. When omitted (or null), the model selects an appropriate ratio based on the prompt. Pass one of the supported values below to force a specific ratio.

ValueOrientation
3:1Ultra-wide landscape
2:1Wide landscape
16:9Standard widescreen
3:2Classic landscape
1:1Square
2:3Classic portrait
9:16Standard portrait
1:2Tall portrait
1:3Ultra-tall portrait
generation = client.generations.create(
prompt="A white cat wearing a tiny crown, sitting on a stack of old books",
aspect_ratio="1:1",
)

Applies a style preset to the generation. Defaults to "auto".

ValueDescriptionAllowed aspect_ratio
autoModel selects the best style for the promptAll 9 values, or omit to let the model pick
mangaManga/anime aesthetic with ink outlines and screentone shadingPortrait only: 2:3, 9:16, 1:2, 1:3 (or omit)
generation = client.generations.create(
prompt="A warrior standing at the edge of a cliff overlooking a vast ocean",
style="manga",
aspect_ratio="2:3",
)

manga is portrait-only. Pair it with a portrait aspect_ratio (2:3, 9:16, 1:2, 1:3), or omit aspect_ratio to let the model pick one. Pairing style: "manga" with a landscape or square ratio (3:1, 2:1, 16:9, 3:2, 1:1) is rejected at submit time with HTTP 422:

{
"detail": "aspect_ratio='1:1' is not allowed when style='manga'. Valid aspect_ratio: 1:2, 1:3, 2:3, 9:16"
}

The Valid aspect_ratio: list always names the portrait values you can use. Branch on the 422 status code; the detail string format is stable but parse it loosely (the leading aspect_ratio=... value reflects what you sent).

This constraint applies to type: "image" only. On type: "image_edit" requests, the output dimensions are derived from the source image rather than the body, so style: "manga" is accepted regardless of source aspect ratio — see Image editing.

Sets the output image format. When omitted (or null), the model selects an appropriate format based on the prompt. Pass an explicit value to force a specific format.

ValueBest for
pngLossless quality
jpegSmaller file size, photographs

When set to true, the model searches the web for visual references before generating. This improves accuracy for prompts that reference real-world subjects, landmarks, or products.

generation = client.generations.create(
prompt="The Eiffel Tower at golden hour with cherry blossoms in the foreground",
web_search=True,
)

Provide up to 9 reference images to guide the generation. Each reference accepts either a url (publicly accessible) or inline data (base64-encoded with media_type) — not both.

Single reference image:

generation = client.generations.create(
prompt="A similar scene but at sunset, with warm orange and pink tones",
image_ref=[
{"url": "https://example.com/reference.jpg"},
],
)

Multiple references — combine different visual aspects:

generation = client.generations.create(
prompt="Use the color palette from the first reference and the composition from the second. "
"Create a portrait of a jazz musician in a smoky club.",
image_ref=[
{"url": "https://example.com/color-reference.jpg"},
{"url": "https://example.com/composition-reference.jpg"},
],
)

Using base64 data instead of a URL:

{
"prompt": "Reimagine this in watercolor style",
"image_ref": [
{
"data": "iVBORw0KGgoAAAANSUhEUgAAAAUA...",
"media_type": "image/png"
}
]
}
RuleConstraint
promptRequired. 1–6,000 characters
modelMust be one of: uni-1, uni-1-max. Defaults to uni-1
typeMust be image or image_edit. Defaults to image
aspect_ratioMust be one of the 9 supported values, or null (default — model picks)
styleMust be auto or manga. Defaults to auto
style + aspect_ratioWhen style="manga" (and type="image"), aspect_ratio must be portrait — 2:3, 9:16, 1:2, 1:3, or omitted. Other values return HTTP 422
output_formatMust be png or jpeg, or null (default — model picks)
image_refMaximum 9 entries. Each must provide url or data — not both
image_ref[].dataMust be valid base64. Requires media_type. Max 50 MB, max 8000 px per side
image_ref[].urlMust be publicly accessible. Max 50 MB, max 8000 px per side
web_searchMust be a boolean. Defaults to false
sourceMust be null or omitted for type: "image". See Image editing

See Error handling for the full list of validation errors.

A successful request returns HTTP 201 with a GenerationResponse:

{
"id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"type": "image",
"state": "queued",
"model": "uni-1",
"created_at": "2026-04-08T12:00:00Z",
"output": [],
"failure_reason": null,
"failure_code": null
}
StateDescription
queuedJob is waiting to be picked up
processingImage is being generated
completedGeneration succeeded — output contains download URLs
failedGeneration failed — check failure_reason and failure_code

Poll GET /v1/generations/{id} until the state reaches completed or failed. See the Quickstart for polling examples.

On completion, output contains one or more objects with presigned download URLs:

{
"output": [
{
"type": "image",
"url": "https://storage.example.com/generations/d290f1ee/output.png?X-Amz-Expires=3600&..."
}
]
}
  • Image editing — Modify existing images with text prompts and reference images
  • Video generation — Ray 3.2 text-to-video and image-to-video
  • Video editing — Ray 3.2 video editing
  • Models — Model capabilities and limitations
  • Pricing — Pay-as-you-go and Provisioned Throughput plans
  • Error handling — Every error code with troubleshooting steps
  • FAQ — Quick answers to common questions
  • API Reference — Complete endpoint specifications