Generate an image

Generate, edit, inpaint, or produce variations of images. Outputs are hosted CDN URLs (signed for 7 days) by default, or inline `b64_json` when `response_format` requests it. By default the request is asynchronous: the response is a `job_id` plus polling URL, and you poll `GET /v1/jobs/<job-id>` for the finished images. This is the right mode for long or batched generations. Pass `sync: true` to hold the request open instead and receive the finished OpenAI-compatible image response (`created` + `data[]`) directly, with no polling. This is what OpenAI SDKs and OpenAI-compatible tools expect from `images.generate`. If a synchronous generation runs past the wait window (about four minutes), the response falls back to the async `job_id` envelope and the job keeps running. Image-edit flows accept `image: ["https://..."]` with up to the model's documented limit (3 for `qwen-image-2-0`, 9 for `wan2-7-image`, 14 for `seedream-5-0-lite`). Image-set modes generate cohesive image series, see each model's page for the toggle. Pass `template: "<slug>"` to apply a catalog-backed image template. Browse image templates with `GET /v1/images/templates` or all generation templates with `GET /v1/templates`.

Authentication

AuthorizationBearer

Pass your EmpirioLabs API key as a bearer token. The Anthropic-style x-api-key header is also accepted on every endpoint.

Request

This endpoint expects an object.
modelstringOptional
promptstringOptional
templatestringOptional

Optional image template slug. When provided, the canonical prompt blends with your prompt, the recommended model is chosen if you don’t pass one, and default params merge for any key you didn’t set. See GET /v1/images/templates.

aspect_ratiostringOptional
resolutionstringOptional
num_imagesintegerOptional1-4Defaults to 1
imagelist of stringsOptional

Reference image URLs for image-edit mode.

response_formatenumOptionalDefaults to url
Allowed values:
syncbooleanOptionalDefaults to false

Hold the request and return the finished image response directly instead of the async job_id envelope. Alias: wait. Falls back to the async envelope if the generation outlasts the wait window.

Response

Async (default): a job_id envelope to poll. With sync: true: the finished image response.

JobAcceptedobject
OR
ImageResponseobject