> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Images

> Creates an image given a prompt.



## OpenAPI

````yaml /gateway-openapi.json post /images/generations
openapi: 3.0.0
info:
  title: LLM Gateway
  description: API for LLM Gateway
  version: 1.0.0
servers:
  - url: https://{gatewayBaseURL}
    variables:
      gatewayBaseURL:
        default: gateway.truefoundry.ai
        description: Gateway base URL
    description: Gateway base URL
security:
  - AuthorizationBearer: []
tags:
  - name: Chat
  - name: Agent
  - name: Messages
  - name: MCP
  - name: Embeddings
  - name: Rerank
  - name: Responses
  - name: Image
  - name: Audio
  - name: Batch
  - name: Files
  - name: Fine-tuning
  - name: Moderations
  - name: Models
paths:
  /images/generations:
    post:
      tags:
        - Image
      summary: Generate Images
      description: Creates an image given a prompt.
      requestBody:
        description: Prompt and generation options.
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  description: A text description of the desired image(s).
                background:
                  type: string
                  nullable: true
                  description: Sets background transparency for generated images.
                model:
                  type: string
                  description: The model to use for image generation.
                moderation:
                  type: string
                  nullable: true
                  description: Control the content-moderation level for images generated.
                'n':
                  type: integer
                  nullable: true
                  default: 1
                  description: The number of images to generate. Must be between 1 and 10.
                output_compression:
                  type: integer
                  nullable: true
                  description: The compression level (0-100%) for the generated images.
                output_format:
                  type: string
                  nullable: true
                  description: The format in which the generated images are returned.
                partial_images:
                  type: integer
                  nullable: true
                  default: 0
                  description: >-
                    The number of partial images to generate. Used for streaming
                    responses.
                quality:
                  type: string
                  nullable: true
                  description: The quality of the image that will be generated.
                response_format:
                  type: string
                  nullable: true
                  default: url
                  description: >-
                    The format in which generated images are returned. Must be
                    one of url or b64_json.
                size:
                  type: string
                  nullable: true
                  description: The size of the generated images.
                stream:
                  type: boolean
                  nullable: true
                  default: false
                  description: Generate the image in streaming mode.
                style:
                  type: string
                  nullable: true
                  description: The style of the generated images.
                user:
                  type: string
                  nullable: true
                  description: A unique identifier representing your end-user.
              required:
                - prompt
                - model
      responses:
        '200':
          description: Generated images.
          content:
            application/json:
              schema:
                type: object
                properties:
                  created:
                    type: number
                    description: Unix timestamp when the image was generated.
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                          nullable: true
                          description: >-
                            Public URL of the image, when response_format is
                            url.
                        b64_json:
                          type: string
                          nullable: true
                          description: >-
                            Base64-encoded image bytes, when response_format is
                            b64_json.
                        revised_prompt:
                          type: string
                          nullable: true
                          description: >-
                            Prompt as used by the model after any safety or
                            expansion rewrites.
                    description: Generated images.
                required:
                  - created
                  - data
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
components:
  securitySchemes:
    AuthorizationBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````