---
title: "Generate images"
method: POST
path: "/api/{workspaceID}/v1/images/generations"
tags: ["Image Generations"]
---

# Generate images

`POST /api/{workspaceID}/v1/images/generations`

Generates images from a text prompt. Supports models from OpenAI (gpt-image-1, gpt-image-2)
and Google Gemini (Gemini image models).

OpenAI models accept size values like `1024x1024`, `1536x1024`, `1024x1536`, or `auto`.
Gemini models accept aspect ratio values like `1:1`, `2:3`, `16:9`, etc.

## Path parameters

- `workspaceID` string, required

## Request body

- ImageGenerationsRequest
  - `prompt` string, required — Text description of the desired image
  - `model` string, required — Image generation model ID. Supported models: - `google/gemini-2.5-flash-image` - `google/gemini-3-pro-image-preview` - `openai/gpt-image-2` - `openai/gpt-image-1.5` - `openai/gpt-image-1` - `openai/gpt-image-1-mini`
  - `n` number — Number of images to generate (1-10)
  - `size` string — Image size. OpenAI: `auto`, `1024x1024`, `1536x1024`, `1024x1536`. Gemini: aspect ratios like `1:1`, `2:3`, `16:9`.
  - `quality` string — Image quality. OpenAI: `auto`, `low`, `medium`, `high`. Gemini: `1K`, `2K`, `4K`.
  - `background` string — Background setting
  - `moderation` string — Content moderation level
  - `output_format` 'png' | 'jpeg' | 'webp' — Output image format
  - `output_compression` number — Compression level for jpeg/webp
  - `partial_images` number — Number of partial images for progressive loading
  - `response_format` string — Response format (url or b64_json)
  - `stream` boolean — Enable streaming
  - `style` string — Image style
  - `user` string — End-user identifier

## Response `200`

Successful response

- ImageResponse
  - `id` string — Log ID
  - `created` integer
  - `data` object[]
    - `url` string, uri — Image URL (when response_format is url)
    - `b64_json` string — Base64-encoded image data (when response_format is b64_json)
    - `revised_prompt` string — Revised prompt used by the model
  - `usage` object
    - `total_cost` number — Total cost in USD
    - `total_cost_toman` number — Total cost in Tomans

## Other responses

- `400` — Bad request
- `401` — Missing authentication
- `402` — Payment required - insufficient balance
- `503` — Service unavailable (feature disabled)

---

[API](https://skmtc.net/liara-cloud/apis/ai-image-generation.md) · [All operations](https://skmtc.net/liara-cloud/apis/ai-image-generation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/liara-cloud/ai-image-generation/versions/323c54177942/schema)
