> ## Documentation Index
> Fetch the complete documentation index at: https://edenai-docs-refresh-dead-model-ids.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Image Generations

> OpenAI-compatible image generation endpoint.



## OpenAPI

````yaml https://api.edenai.run/v3/docs/openapi.json post /v3/images/generations
openapi: 3.1.0
info:
  title: Eden AI API V3
  version: 3.0.0
servers:
  - url: https://api.edenai.run
    description: Production server
security: []
paths:
  /v3/images/generations:
    post:
      tags:
        - Images
      summary: Image Generations
      description: OpenAI-compatible image generation endpoint.
      operationId: image_generations_v3_images_generations_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageGenerationBody'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - AuthBearer: []
components:
  schemas:
    ImageGenerationBody:
      properties:
        routing:
          anyOf:
            - $ref: '#/components/schemas/ProviderRoutingPreferences'
            - type: 'null'
          description: >-
            How to pick between the providers that serve the requested model.
            Applies only when `model` is a model name with no provider prefix
            (e.g. 'gpt-5.5'); ignored for a concrete 'provider/model' id, which
            already names its provider. This does not choose the model — for
            that see `router_candidates` with model='@edenai'.
        model:
          type: string
          title: Model
          description: provider/model, e.g. 'openai/gpt-image-2'
        prompt:
          type: string
          maxLength: 32000
          minLength: 1
          title: Prompt
        'n':
          anyOf:
            - type: integer
              maximum: 10
              minimum: 1
            - type: 'null'
          title: 'N'
        size:
          anyOf:
            - type: string
            - type: 'null'
          title: Size
          description: >-
            Provider-specific size string. OpenAI accepts '1024x1024',
            '1536x1024', '1024x1536', 'auto'. Vertex Imagen accepts square or
            aspect-ratio strings. Validation is delegated to the provider.
        user:
          anyOf:
            - type: string
            - type: 'null'
          title: User
          description: End-user identifier for abuse tracking.
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Arbitrary metadata attached to the request.
        extra_headers:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Extra Headers
          description: >-
            Additional HTTP headers forwarded to the provider API. Credential
            headers (Authorization, x-api-key, ...) are rejected.
        quality:
          anyOf:
            - type: string
            - type: 'null'
          title: Quality
          description: >-
            Provider-specific quality string (e.g. 'low', 'medium', 'high',
            'standard', 'hd', 'auto'). Accepted values depend on the model.
        response_format:
          anyOf:
            - type: string
            - type: 'null'
          title: Response Format
          description: >-
            Legacy DALL-E parameter. Ignored by gpt-image-* and forwarded to the
            provider for any model that still honors it.
      additionalProperties: true
      type: object
      required:
        - model
        - prompt
      title: ImageGenerationBody
      description: OpenAI-compatible ``POST /v1/images/generations`` request body.
    ImageResponse:
      properties:
        cost:
          anyOf:
            - type: number
            - type: 'null'
          title: Cost
        provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider
        created:
          anyOf:
            - type: integer
            - type: 'null'
          title: Created
        data:
          items:
            $ref: '#/components/schemas/ImageDataItem'
          type: array
          title: Data
        usage:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Usage
      additionalProperties: true
      type: object
      title: ImageResponse
      description: >-
        OpenAI-compatible image response + Eden ``cost`` / ``provider`` fields.


        Shared by ``POST /v3/images/generations`` and ``POST /v3/images/edits``
        —

        the wire shape is identical.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ProviderRoutingPreferences:
      properties:
        sort:
          anyOf:
            - type: string
              enum:
                - cost
                - speed
                - latency
                - exact
            - type: 'null'
          title: Sort
          description: >-
            What to optimise for when several providers serve the requested
            model. 'cost' (default) picks the cheapest for this request's shape;
            'speed' the highest tokens/second; 'latency' the fastest to first
            token; 'exact' the most reliable at producing well-formed tool calls
            / structured output. Health is always a filter first — no mode will
            route you to a failing provider. Can also be written as a model
            suffix, e.g. 'gpt-5.5:speed'.
        sticky:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Sticky
          description: >-
            Keep a conversation on the provider holding its prompt cache. On by
            default, and only ever active for models whose providers discount
            cache reads. Set false to route every request independently on price
            instead. Naming an explicit `sort` also takes priority over cache
            affinity.
        allow_fallbacks:
          type: boolean
          title: Allow Fallbacks
          description: >-
            Whether other providers of the same model may be tried when the
            chosen one fails. Set false to pin the request to the single best
            provider: it then fails rather than silently moving to another
            seller. useful when a cache-warm prompt would cold-miss elsewhere.
            This governs PROVIDERS of the requested model only; models you list
            in `fallbacks` are your own choice and are always kept.
          default: true
        allowed_providers:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowed Providers
          description: >-
            Restrict routing to these providers, e.g. ['openai', 'anthropic'].
            Only providers that serve the requested model are considered, so an
            entry that does not sell it is simply inert. If none of them do, the
            request fails rather than falling back to a provider you excluded.
            Case-insensitive. Applies to routed providers only. a concrete
            'provider/model' you named in `fallbacks` is your own choice and is
            kept.
      type: object
      title: ProviderRoutingPreferences
      description: >-
        How to choose between SELLERS of one model — not which model to use.


        Only meaningful when `model` is a canonical name (`gpt-5.5`) rather than
        a concrete

        `provider/model` — with a concrete id there is nothing to choose
        between. For choosing the

        MODEL itself see ``router_candidates`` and ``model="@edenai"``, which is
        a different router.
    ImageDataItem:
      properties:
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        b64_json:
          anyOf:
            - type: string
            - type: 'null'
          title: B64 Json
        revised_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Revised Prompt
      additionalProperties: true
      type: object
      title: ImageDataItem
      description: |-
        Single image entry inside the OpenAI-shaped ``data: [...]`` array.

        Providers return either ``url`` (most non-OpenAI providers) or
        ``b64_json`` (gpt-image-*); ``revised_prompt`` is OpenAI-specific.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    AuthBearer:
      type: http
      scheme: bearer

````