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

# Create image (image generation)

> GoModel API reference for POST /v1/images/generations: Create image (image generation).



## OpenAPI

````yaml /openapi.json post /v1/images/generations
openapi: 3.0.0
info:
  description: >-
    AI gateway routing requests to multiple LLM providers (OpenAI, Anthropic,
    Gemini, Groq, Fireworks AI, Meta, OpenRouter, Kilo AI, DeepSeek, Z.ai, xAI,
    MiniMax, Xiaomi MiMo, OpenCode Go, Oracle, Ollama, Bailian). Drop-in
    OpenAI-compatible API.
  title: GoModel API
  contact: {}
  version: '1.0'
servers:
  - url: '{base_url}'
    description: Edit the base URL to point at your GoModel deployment.
    variables:
      base_url:
        default: http://localhost:8080
        description: Your GoModel deployment URL
security: []
paths:
  /v1/images/generations:
    post:
      tags:
        - images
      summary: Create image (image generation)
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/core.ImageGenerationRequest'
        description: Image generation request
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.ImageGenerationResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
        '502':
          description: Bad Gateway
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
      security:
        - BearerAuth: []
components:
  schemas:
    core.ImageGenerationRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
        'n':
          type: integer
          minimum: 1
        prompt:
          type: string
        provider:
          description: >-
            Provider is gateway routing metadata, stripped before dispatching
            upstream.
          type: string
        quality:
          type: string
        response_format:
          type: string
        size:
          type: string
        stream:
          description: >-
            Stream is typed only so the gateway can reject it: streaming image

            generation returns server-sent events, which this endpoint does not
            relay.
          type: boolean
        user:
          type: string
    core.ImageGenerationResponse:
      type: object
      properties:
        background:
          type: string
        created:
          type: integer
        data:
          type: array
          items:
            $ref: '#/components/schemas/core.ImageData'
        output_format:
          type: string
        provider:
          description: >-
            Provider is a gateway addition, stamped like every other routed
            response,

            so clients can tell which provider served the request.
          type: string
        quality:
          type: string
        size:
          type: string
        usage:
          $ref: '#/components/schemas/core.ImageUsage'
    core.OpenAIErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/core.OpenAIErrorObject'
    core.ImageData:
      type: object
      properties:
        b64_json:
          type: string
        revised_prompt:
          type: string
        url:
          type: string
    core.ImageUsage:
      type: object
      properties:
        input_tokens:
          type: integer
        input_tokens_details:
          $ref: '#/components/schemas/core.ImageTokenDetails'
        output_tokens:
          type: integer
        total_tokens:
          type: integer
    core.OpenAIErrorObject:
      type: object
      required:
        - code
        - message
        - param
        - type
      properties:
        code:
          type: string
          nullable: true
        message:
          type: string
        param:
          type: string
          nullable: true
        provider:
          description: |-
            Provider names the upstream provider that produced the error. It is
            omitted for errors raised by the gateway itself.
          type: string
        type:
          $ref: '#/components/schemas/core.ErrorType'
    core.ImageTokenDetails:
      type: object
      properties:
        image_tokens:
          type: integer
        text_tokens:
          type: integer
    core.ErrorType:
      type: string
      enum:
        - provider_error
        - rate_limit_error
        - invalid_request_error
        - authentication_error
        - not_found_error
      x-enum-varnames:
        - ErrorTypeProvider
        - ErrorTypeRateLimit
        - ErrorTypeInvalidRequest
        - ErrorTypeAuthentication
        - ErrorTypeNotFound
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````