---
title: "Openai Images Generations"
method: POST
path: "/v1/images/generations"
tags: ["Image Generation"]
---

# Openai Images Generations

`POST /v1/images/generations`

Generate image using OpenAI Images API

## Headers

- `xi-api-key` string, nullable
- `x-api-key` string, nullable

## Request body

- OpenAIImagesGenerationsIn
  - `model` string, required — The model to use for image generation.
  - `n` integer — The number of images to generate.
  - `response_format` 'b64_json' | 'url'
  - `size` string — The size of the generated images. Available sizes depend on the model.
  - `user` string, nullable — A unique identifier representing your end-user, which can help to monitor and detect abuse.
  - `prompt` string, required — A text description of desired image(s).
  - `quality` string, nullable — The quality of the image that will be generated.
  - `style` string, nullable — The style of the generated images.

## Response `200`

Successful Response

- OpenAIImagesOut
  - `created` integer — Unix timestamp of when the images were created
  - `data` OpenAIImageData[], required — List of generated images
    - `b64_json` string, nullable — The base64-encoded image data
    - `revised_prompt` string, nullable — The prompt used to generate this image
    - `url` string, nullable — The URL of the generated image

## Other responses

- `422` — Validation Error

## Changes

- **2026-09-04** `a307ab69a81c` — 1 info
  - added the new `url` enum value to the request property `response_format/anyOf[subschema #1: OpenAIImagesResponseFormat]/`

[Change history](https://skmtc.dev/deepinfra/apis/deepinfra-api/changes/v1/images/generations/post.md)

---

[API](https://skmtc.dev/deepinfra/apis/deepinfra-api.md) · [All operations](https://skmtc.dev/deepinfra/apis/deepinfra-api/llms.txt) · [OpenAPI document](https://skmtc.dev/deepinfra/apis/deepinfra-api/revisions/064652e2e23e?raw)
