Skip to main content
POST
Creates an image generation job. Credits are deducted when the job is queued. Poll Poll image status with the returned generation.id until status is COMPLETED or FAILED. This endpoint takes a simple, fixed set of fields and translates them onto the chosen model. It runs through the same live pricing as Generate, which exposes every input a model has.

Headers

Request body

Fields a model doesn’t take are ignored, and anything you leave out uses the model’s own default.
string
required
Text prompt for the image.
string
Model key. Default: nano-banana-2.gpt-image-1.5 now runs as gpt-image-2, and seedream-v5-lite as seedream-5.0-pro. Each model’s aspect ratios, resolutions and quality tiers are listed by List models.
string
Aspect ratio, such as 1:1 or 9:16. Valid values depend on the model; auto uses the model’s default. Aliases: aspect, aspect_ratio, ratio.
string
Output size written as a number plus k: 1k, 2k or 4k, for models that offer it. Other values (such as 1024x1024, basic or high) are ignored and the model’s default applies. Nano Banana 2 and Nano Banana Pro default to 2k.
string
Quality tier, for models that offer one.
string[]
Reference image URLs, for style or subject guidance. The maximum count depends on the model. Aliases: referenceImageUrls, referenceImageUrl, images. URLs hosted outside Unsora are copied into your library first (up to 12 per request).

Credits

Each run is priced live from the provider’s cost for those inputs (model, resolution, quality). Get the price first with Quote a generation.

Async completion

Poll Poll image status with generation.id until status is COMPLETED or FAILED. Webhooks are not supported on the public API.

Response

Example

Errors

Authorizations

Authorization
string
header
required

An Unsora API key (uns_…). A Clerk session token also works.

Headers

Idempotency-Key
string

API key requests only. Retrying with the same key within 24 hours replays the first response (with the Idempotent-Replayed: true header) instead of charging again. The body isn't compared; reusing the key on a different endpoint returns 409 IDEMPOTENCY_CONFLICT. Keys over 128 characters are ignored.

Maximum string length: 128

Body

application/json
prompt
string
required
model
enum<string>
default:nano-banana-2

Image model key from GET /catalog. Older names also work: gpt_image_2; gpt-image-1.5 runs as gpt-image-2 and seedream-v5-lite as seedream-5.0-pro.

Available options:
gpt-image-2.5-flare,
gpt-image-2.5-sunburst,
gpt-image-2,
nano-banana-pro,
nano-banana-2,
nano-banana-2-lite,
seedream-5.0-pro
aspectRatio
string

Aspect ratio. Valid values depend on the model; auto uses the model's default. Aliases: aspect, aspect_ratio, ratio.

resolution
string

Output size written as a number plus k (1k, 2k, 4k), for models that offer it. Other values (such as 1024x1024, basic, high) are ignored and the model's default applies.

quality
string

Quality tier, for models that offer it (see GET /catalog).

referenceImages
string<uri>[]

Reference image URLs. The maximum count depends on the model. Aliases: referenceImageUrls, referenceImageUrl, images.

Response

Generation queued

success
boolean
required
generation
object
required
model
string
creditsDeducted
integer
creditsRemaining
integer