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

# Generate an image

> Generate one or more images. By default runs synchronously and returns them inline (200). Set `async: true` to run a single image on the background worker and get a 202 with a status URL to poll instead — use it for slow models (e.g. gpt-image high, imagen ultra) that can exceed the synchronous timeout. `model` and `prompt` are required; `n` (max 4; async is single-image), `size`/`aspect_ratio`, `quality`, and `style` are normalized, and everything in `parameters` is forwarded verbatim to the provider. `image`/`mask`/`reference_images` accept an http(s) URL, a data-URI, or a `file_<id>` for edit / image-to-image. `response_format` defaults to `b64_json`. Outputs are saved to /v3/files by default and returned with a reusable `file_id`; set `store: false` to opt out.

See the [Images guide](/build/multimodal/images) for runnable examples, edit / image-to-image, and model discovery.


## OpenAPI

````yaml post /v3/images
openapi: 3.1.0
info:
  description: Schema-driven generative API that orchestrates LLM-powered workflows.
  title: Task API
  version: 3.0.0
servers:
  - description: Production
    url: https://api.opper.ai
  - description: Local development
    url: http://localhost:8080
security:
  - BearerAuth: []
tags:
  - description: Schema-driven function management and execution
    name: Functions
  - description: OpenAI-compatible chat completions
    name: Chat
  - description: OpenAI Responses API compatible endpoint
    name: Responses
  - description: Google-compatible interactions endpoint
    name: Interactions
  - description: Model registry and capabilities
    name: Models
  - description: Synchronous image generation
    name: Images
  - description: Text-to-speech and speech-to-text
    name: Audio
  - description: Asynchronous video generation
    name: Videos
  - description: Reusable file storage for media inputs and generated outputs
    name: Files
  - description: Async generation status and downloads
    name: Artifacts
  - description: OpenAI-compatible embeddings
    name: Embeddings
  - description: Recorded HTTP request/response generations
    name: Generations
  - description: System health and status
    name: System
  - description: Roundtable endpoint — fan out a query to multiple LLMs and combine results
    name: Roundtable
  - description: Web search, fetch, and other utility tools
    name: Tools
paths:
  /v3/images:
    post:
      tags:
        - Images
      summary: Generate an image
      description: >-
        Generate one or more images. By default runs synchronously and returns
        them inline (200). Set `async: true` to run a single image on the
        background worker and get a 202 with a status URL to poll instead — use
        it for slow models (e.g. gpt-image high, imagen ultra) that can exceed
        the synchronous timeout. `model` and `prompt` are required; `n` (max 4;
        async is single-image), `size`/`aspect_ratio`, `quality`, and `style`
        are normalized, and everything in `parameters` is forwarded verbatim to
        the provider. `image`/`mask`/`reference_images` accept an http(s) URL, a
        data-URI, or a `file_<id>` for edit / image-to-image. `response_format`
        defaults to `b64_json`. Outputs are saved to /v3/files by default and
        returned with a reusable `file_id`; set `store: false` to opt out.
      operationId: createImage
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
          description: Successful response
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageJobResponse'
          description: >-
            Accepted – async generation submitted (async: true). Poll the
            returned `status_url` (GET /v3/artifacts/{id}/status) for a
            presigned download URL when complete.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad request
        '401':
          description: Unauthorized - missing or invalid API key
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
components:
  schemas:
    ImageRequest:
      properties:
        aspect_ratio:
          type: string
        async:
          description: >-
            Run generation on the background worker and return a job to poll
            (202) instead of waiting inline (200). Use for slow models.
            Single-image only.
          type: boolean
        image:
          type: string
        mask:
          type: string
        model:
          type: string
        'n':
          type: integer
        parameters:
          type: object
        prompt:
          type: string
        quality:
          type: string
        reference_images:
          items:
            type: string
          type: array
        response_format:
          type: string
        size:
          type: string
        store:
          description: >-
            Persist each generated image to /v3/files and return a reusable
            file_id per image. Defaults to true; set false to skip.
          type: boolean
      required:
        - model
        - prompt
      type: object
    ImageResponse:
      properties:
        created:
          type: integer
        data:
          items:
            properties:
              b64_json:
                type: string
              file_id:
                type: string
              mime_type:
                type: string
              revised_prompt:
                type: string
              url:
                type: string
            type: object
          type: array
        id:
          type: string
        model:
          type: string
        usage:
          properties:
            cost:
              type: number
            images:
              type: integer
          required:
            - cost
            - images
          type: object
      required:
        - id
        - model
        - created
        - data
        - usage
      type: object
    ImageJobResponse:
      properties:
        id:
          type: string
        status_url:
          type: string
      required:
        - id
        - status_url
      type: object
    ErrorResponse:
      properties:
        error:
          properties:
            code:
              type: string
            details:
              description: Any value
            message:
              type: string
          required:
            - code
            - message
          type: object
        meta:
          type: object
      required:
        - error
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: API Key
      description: API key authentication. Pass your API key as a Bearer token.
      scheme: bearer
      type: http

````