---
title: "Generate images"
method: POST
path: "/api/inference/v1/images/generations"
tags: ["AI"]
---

# Generate images

`POST /api/inference/v1/images/generations`

## Request

- Base URL: `https://docs.anzworldline-solutions.com.au`
- URL: `https://docs.anzworldline-solutions.com.au/api/inference/v1/images/generations`
- Auth: none declared
- TypeScript: <https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/docs/api/inference/v1/images/generations/post.ts> (a function with typed inputs; its response is checked against the schema)

Generates images against the model the resolved site has configured for images, in the OpenAI-compatible request and response shape. Every image is returned inline as b64_json: no hosted, separately-addressable artifact is created, and no url is ever returned. Both model and prompt are required, and model is validated against the site's image configuration rather than its chat or embeddings models; there is no implicit default. The n field is honored — omitting it means one image. A value below 1, a value above the configured maximum, or any value above 1 on a site whose image model can only produce one, is refused with a 400 naming the field. The size field is passed through to the provider as a WIDTHxHEIGHT string; where the site carries an image size setting the caller's value wins and the site's is the default. Every response reports the serving site in the X-dotCMS-Resolved-Site header.

## Query parameters

- `siteId` string

## Request body

- ImageGenerationRequestView: Image generation request in the OpenAI-compatible shape
  - `model` string: Model id, as configured for this site's images
  - `prompt` string: What to generate
  - `n` integer: Number of images; at least 1, defaults to 1
  - `size` string: Image size

## Response `200`

The generated images, each inline as base64

- ImageGenerationView: Image generation response in the OpenAI-compatible shape
  - `created` integer: Epoch seconds
  - `data` ImageView[]: The generated images
    - `b64_json` string: The image bytes, base64 encoded
    - `revised_prompt` string: The prompt the provider actually used

## Other responses

- `400`: Malformed request, or one asking for something unsupported
- `401`: Unauthorized - authentication required
- `403`: Forbidden - the caller cannot read the requested site
- `404`: The requested model is not configured for the resolved site
- `502`: The model provider failed to complete the request

## Changes

- **2026-10-30** `4fd8e917d458`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/changes/api/inference/v1/images/generations/post.md)

---

[API](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api.md) - [All operations](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/revisions/4fd8e917d458?raw)
