---
title: "Create an AI image generation job"
method: POST
path: "/api/v1/ai/generate-image"
tags: ["AI"]
---

# Create an AI image generation job

`POST /api/v1/ai/generate-image`

## Request

- Base URL: `https://www.poster.ly`
- URL: `https://www.poster.ly/api/v1/ai/generate-image`
- Auth: HTTP bearer

Queue a Nano Banana or Grok Imagine image job on the Railway worker. Returns job_id immediately. Poll `/api/v1/ai/image-jobs/{id}` for urls. This spends AI credits. Gemini thinking_level does not change the credit price (model + resolution do).

## Request body

- GenerateImageRequest
  - `workspace_id` string: Optional. The workspace this call acts in and whose plan and credits it uses (from whoami). Needed only when the key can act in several workspaces.
  - `prompt` string, required
  - `aspect_ratio` string
  - `style` string
  - `variations` integer
  - `provider` 'google' | 'xai'
  - `model` 'lite' | 'flash' | 'pro': Google Nano Banana tier. Ignored when provider is xai.
  - `resolution` '1K' | '2K' | '4K': Google Nano Banana 2.1 supports 1K, 2K, and 4K. 512 is no longer available and returns a 400. xAI Grok supports only 1K and 2K.
  - `quality` 'low' | 'medium' | 'high': Google: high enables Gemini thinking. xAI: low or medium credit tiers.
  - `thinking_level` 'minimal' | 'high': Google flash/lite thinking. Overrides quality when both are set.
  - `reference_image_urls` string[]: Google only. Up to 14 HTTPS reference images.

## Response `202`

Image generation job accepted

- GenerateImageResponse
  - `job_id` string, required
  - `status` 'pending' | 'processing' | 'completed' | 'failed', required
  - `message` string
  - `provider` 'google' | 'xai'
  - `model` string
  - `resolution` string
  - `thinking_level` 'minimal' | 'high'
  - `credits_used` number, required

## Other responses

- `400`: Validation error
- `401`: Invalid or missing API key
- `402`: Validation error
- `429`: Too many requests

---

[API](https://skmtc.dev/poster/apis/posterly-api.md) · [All operations](https://skmtc.dev/poster/apis/posterly-api/llms.txt) · [OpenAPI document](https://skmtc.dev/poster/apis/posterly-api/revisions/60be02a61f95?raw)
