curl -X POST "https://mvp.tryunsora.com/api/v1/image-generations/create" \
-H "Authorization: Bearer uns_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Product photo on marble, soft studio light",
"model": "nano-banana-2",
"aspectRatio": "1:1",
"resolution": "2k"
}'
curl -X POST "https://mvp.tryunsora.com/api/v1/image-generations/create" \
-H "Authorization: Bearer uns_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Same character, new outfit, editorial look",
"model": "gpt-image-2",
"aspectRatio": "9:16",
"resolution": "2k",
"referenceImages": [
"https://cdn.example.com/ref-1.jpg"
]
}'
{
"success": true,
"generation": {
"id": "<string>",
"status": "<string>",
"model": "<string>",
"mode": "<string>",
"modelId": "<string>"
},
"model": "<string>",
"creditsDeducted": 123,
"creditsRemaining": 123
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}Image generator
Create image
Queue an AI image generation from a text prompt with Nano Banana, GPT Image or Seedream, then poll until your image is ready.
POST
/
image-generations
/
create
curl -X POST "https://mvp.tryunsora.com/api/v1/image-generations/create" \
-H "Authorization: Bearer uns_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Product photo on marble, soft studio light",
"model": "nano-banana-2",
"aspectRatio": "1:1",
"resolution": "2k"
}'
curl -X POST "https://mvp.tryunsora.com/api/v1/image-generations/create" \
-H "Authorization: Bearer uns_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Same character, new outfit, editorial look",
"model": "gpt-image-2",
"aspectRatio": "9:16",
"resolution": "2k",
"referenceImages": [
"https://cdn.example.com/ref-1.jpg"
]
}'
{
"success": true,
"generation": {
"id": "<string>",
"status": "<string>",
"model": "<string>",
"mode": "<string>",
"modelId": "<string>"
},
"model": "<string>",
"creditsDeducted": 123,
"creditsRemaining": 123
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}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
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer uns_* API key or Clerk JWT |
Idempotency-Key | No | Max 128 chars. Replays the same response for 24h on API key requests |
Content-Type | Yes | application/json |
Request body
Fields a model doesn’t take are ignored, and anything you leave out uses the model’s own default.Model key. Default:
nano-banana-2.model | Name |
|---|---|
nano-banana-2 | Nano Banana 2 |
nano-banana-2-lite | Nano Banana 2 Lite |
nano-banana-pro | Nano Banana Pro |
gpt-image-2 | GPT Image 2 |
gpt-image-2.5-flare | GPT Image 2.5 Flare |
gpt-image-2.5-sunburst | GPT Image 2.5 Sunburst |
seedream-5.0-pro | Seedream 5.0 Pro |
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.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.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.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 withgeneration.id until status is COMPLETED or FAILED. Webhooks are not supported on the public API.
Response
{
"success": true,
"model": "nano-banana-2",
"generation": {
"id": "cm123abc",
"status": "QUEUED",
"model": "nano-banana-2",
"mode": "create",
"modelId": "google/nano-banana-2/text-to-image"
},
"creditsDeducted": 5,
"creditsRemaining": 95
}
Example
curl -X POST "https://mvp.tryunsora.com/api/v1/image-generations/create" \
-H "Authorization: Bearer uns_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Product photo on marble, soft studio light",
"model": "nano-banana-2",
"aspectRatio": "1:1",
"resolution": "2k"
}'
curl -X POST "https://mvp.tryunsora.com/api/v1/image-generations/create" \
-H "Authorization: Bearer uns_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Same character, new outfit, editorial look",
"model": "gpt-image-2",
"aspectRatio": "9:16",
"resolution": "2k",
"referenceImages": [
"https://cdn.example.com/ref-1.jpg"
]
}'
Errors
| HTTP | When |
|---|---|
400 | Missing prompt, an invalid model or input, a reference image that couldn’t be imported, or too many reference images |
401 | Invalid auth |
402 | Insufficient credits |
404 | User not found |
409 | IDEMPOTENCY_CONFLICT: the Idempotency-Key was already used on a different endpoint |
429 | Rate limit exceeded |
502 | The pricing service couldn’t be reached. Try again |
503 | PROVIDER_UNAVAILABLE: generation is temporarily unavailable. Nothing was charged |
Authorizations
Headers
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:
128Body
application/json
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 
