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

# Image Generation

`POST /v1/images/generations`

## Request

- Base URL: `https://apipie.ai`
- URL: `https://apipie.ai/v1/images/generations`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Generates images based on the prompt using OpenAI's image generation API.

## Request body

- ImageGenerationRequest
  - `prompt` string, required: Text description of the desired image(s)
  - `model` string: The model to use for image generation
  - `n` integer: The number of images to generate, we currently only support one at a time
  - `size` string: The size of the generated images
  - `quality` string: The quality of the image that will be generated
  - `response_format` string: The format in which the generated images are returned, we support either b64_json or "url"
  - `style` string: The style of the generated images the options are vivid and natural and does not apply to all providers
  - `image` string: The URL to an image you want the image model to update (Not supported by Dall-e-3)
  - `seed` integer: A randomness initializer for image reproducibility. Check specific models for compatibility.
  - `steps` integer: Amount of computational iterations to run. More is typically higher quality. Check specific models for compatibility.
  - `loras` string[]: Augment the output with a LoRa model. Check specific models for compatibility.
  - `strength` number: Controls the strength of the applied effect. Check specific models for compatibility.
  - `aspect_ratio` '9:21' | '21:9': Aspect Ratio. Check specific models for compatibility.
  - `text_layout` object[]: Text layout configuration for image generation. Check specific models for compatibility.
    - `text` string, required
    - `bbox` array[], required
      - number[]

## Response `200`

Result of the Image Generation

- ImageGenerationResponse
  - `created` integer, required: UTC timestamp of when the image was created
  - `data` object[], required
    - `url` string: URL of the generated image
    - `revised_prompt` string: If exists, the actual prompt that was processed as some providers automatically enhance them

---

[API](https://skmtc.dev/apipie/apis/introduction.md) · [All operations](https://skmtc.dev/apipie/apis/introduction/llms.txt) · [OpenAPI document](https://skmtc.dev/apipie/apis/introduction/revisions/f8386be4eb3f?raw)
