---
title: "Create image"
method: POST
path: "/v1/images/generations"
---

# Create image

`POST /v1/images/generations`

Creates an image given a prompt. Internally routes to a chat completions model with image generation capabilities.

## Request body

- object
  - `prompt` string, required — A text description of the desired image(s).
  - `model` string — The model to use for image generation. Defaults to auto which selects an appropriate image generation model.
  - `n` integer — The number of images to generate. Must be between 1 and 10.
  - `size` string — The size of the generated images. Supported sizes depend on the model and provider.
  - `quality` 'standard' | 'hd' | 'low' | 'medium' | 'high' | 'auto' — The quality of the image that will be generated. Supported values depend on the model and provider.
  - `response_format` 'b64_json' — The format in which the generated images are returned. Only b64_json is supported since images are generated via chat completions models.
  - `style` 'vivid' | 'natural' — The style of the generated images.
  - `aspect_ratio` string — The aspect ratio of the generated images (e.g. '1:1', '16:9', '4:3', '5:4'). Takes precedence over size if both are provided.

## Response `200`

Image generation response.

- object
  - `created` number, required
  - `data` object[], required
    - `b64_json` string, required
    - `revised_prompt` string

## Other responses

- `400` — Invalid request body or parameters.
- `401` — Missing or invalid API key.
- `402` — Insufficient credits or plan limits reached.
- `403` — Forbidden request or upstream response.
- `404` — Unknown model or upstream not-found response.
- `410` — Archived or unavailable project.
- `429` — Rate limited (organization, endpoint, or upstream provider). Back off until Retry-After elapses.
- `500` — Internal server error.
- `502` — Failed to connect to the upstream provider.
- `503` — Service unavailable upstream response.
- `504` — Upstream provider timeout.

---

[API](https://skmtc.dev/llmgateway/apis/llmgateway-api.md) · [All operations](https://skmtc.dev/llmgateway/apis/llmgateway-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/llmgateway/llmgateway-api/revisions/aaf167e3d8cc/schema)
