Generate an image

POST/v1/images/generate

Render an image in one of your modes — from a source image (a sketch, a 3D viewport, a photo) or from a prompt alone.

With an image, the mode turns it into a render (the same pipeline as Luce's canvas). Without one, Luce makes an image from your prompt (text-to-image).

mode is a mode id from GET /v1/modes. Mode custom renders your prompt as written. tags are the labels a mode offers in its tag_groups.

Some modes render at the model's own size; GET /v1/modes lists sizes per mode. Text-to-image ignores size.

Needs the generate scope. Creates a job of type image.generate; send an Idempotency-Key to retry safely.

Body

FieldTypeDescription
modestringA mode id from GET /v1/modes.Default "custom".
imagestringAn image: a file id from POST /v1/files (file_…), the id of an earlier job whose output to use (job_…), or a public https:// URL (PNG, JPEG or WebP).
promptstringWhat you want. Required for text-to-image and for mode custom. Up to 4000 characters.
tagsstring[]Up to 30 tag labels from the mode's tag_groups (lighting, season, scene…).
creativityinteger 0–100How far the render may stray from the source image.Default 10.
qualitystringpro uses the higher-quality model where the mode offers it.One of "standard", "pro".Default "standard".
sizestringOutput size where the mode honours one.One of "1K", "2K", "4K".Default "1K".
aspect_ratiostringOutput proportions. Default: the source image's.One of "16:9", "9:16", "1:1", "4:5", "4:3", "3:4".
seedinteger 0–2147483647Fix the seed for repeatable results on engines that support one.
reference_imagesstring[]Up to 4 images to guide materials and style (same forms as image).
lighting_referencestringAn image whose lighting to follow.
metadataobjectUp to 20 keys of your own (string → string, values up to 500 characters). Stored on the job and returned with it and in webhooks.

Example

curl -X POST https://www.luce.space/api/v1/images/generate \
  -H "Authorization: Bearer $LUCE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "mode": "comfy_render_2",
  "image": "file_O57EAQfNx6UbXJxr",
  "tags": [
    "Golden Hour"
  ],
  "size": "2K",
  "metadata": {
    "order_id": "A-1042"
  }
}'

Response

HTTP 202. The job starts queued or running; GET /v1/jobs/{id} or a webhook tells you when it ends.

{
  "id": "job_api7QmVZk2rT9wXs1bYc",
  "object": "job",
  "type": "image.generate",
  "status": "queued",
  "livemode": true,
  "created_at": "2026-11-24T10:15:02.114Z",
  "completed_at": null,
  "cost": {
    "credits": 10,
    "prepaid": 10,
    "pay_as_you_go": 0
  },
  "output": null,
  "error": null,
  "metadata": {
    "order_id": "A-1042"
  }
}

Errors

codeWhen
invalid_bodyThe body isn't valid JSON or misses a required field.
invalid_paramA field has a wrong type or an out-of-range value; param names it.
invalid_inputAn input image or video can't be used (unreachable, too large, wrong type, or an upload not completed).
mode_unavailableThis mode isn't offered on the API.
insufficient_balancePrepaid AI Credits can't cover the job and pay as you go is off.
monthly_cap_reachedThe job would pass this month's pay-as-you-go cap.
payment_past_duePay as you go is paused after a failed payment.
idempotency_conflictThe Idempotency-Key was used before with a different body.
rate_limitedToo many requests; wait for Retry-After seconds.
Generate an image — Luce API reference