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

# /v1/images/generations

> Creates images from text prompts with OpenAI-compatible image generation models.

Create images from text prompts.

* Authenticate with `Authorization: Bearer {API_KEY}`
* Use this as the text-to-image route; for edits, inpainting, or image expansion, use `/v1/images/edits`
* `gpt-image-1`, `dall-e-3`, and `dall-e-2` expose different parameter sets, and those differences are now rendered in the native parameter panel above
* If the response contains temporary `url` values, mirror them server-side quickly; if it contains `b64_json`, avoid decoding too many large images on the main thread


## OpenAPI

````yaml POST /v1/images/generations
openapi: 3.1.0
info:
  title: OpenAPI Plant Store
  description: >-
    A sample API that uses a plant store as an example to demonstrate features
    in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api-vip.apigo.ai
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      summary: OpenAI image generations
      description: 使用兼容 OpenAI 的图像生成模型，根据文本提示创建图像。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenAIImagesGenerationsRequest'
            example:
              prompt: 一只可爱的小猫在花园里玩耍，阳光明媚，油画风格
              model: gpt-image-1
              size: 1024x1024
              quality: high
      responses:
        '200':
          description: Successful image generation response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIImagesResponse'
              example:
                created: 1589478378
                background: auto
                output_format: png
                quality: high
                size: 1024x1024
                data:
                  - url: https://example.com/generated-image.png
                usage:
                  input_tokens: 15
                  input_tokens_details:
                    image_tokens: 0
                    text_tokens: 15
                  output_tokens: 1
                  total_tokens: 16
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    OpenAIImagesGenerationsRequest:
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          description: Text prompt for the desired image.
          example: 一只可爱的小猫在花园里玩耍，阳光明媚，油画风格
        model:
          type: string
          enum:
            - gpt-image-1
            - dall-e-3
            - dall-e-2
          description: Image generation model.
        background:
          type: string
          enum:
            - transparent
            - opaque
            - auto
          description: Only supported by gpt-image-1.
        moderation:
          type: string
          enum:
            - auto
            - low
          description: Only supported by gpt-image-1.
        'n':
          type: integer
          minimum: 1
          maximum: 10
          default: 1
          description: Number of images to generate. dall-e-3 only supports 1.
        output_compression:
          type: integer
          minimum: 0
          maximum: 100
          default: 100
          description: Compression level for gpt-image-1 jpeg/webp output.
        output_format:
          type: string
          enum:
            - png
            - jpeg
            - webp
          description: Only supported by gpt-image-1.
        partial_images:
          type: integer
          minimum: 0
          maximum: 3
          default: 0
          description: Number of partial images for streaming previews.
        quality:
          type: string
          enum:
            - auto
            - high
            - medium
            - low
            - hd
            - standard
          description: Supported values vary by model.
        response_format:
          type: string
          enum:
            - url
            - b64_json
          description: Only applies to dall-e-2 and dall-e-3.
        size:
          type: string
          enum:
            - 1024x1024
            - 1536x1024
            - 1024x1536
            - auto
            - 256x256
            - 512x512
            - 1792x1024
            - 1024x1792
          description: Allowed values depend on the selected model.
        stream:
          type: boolean
          default: false
          description: Only supported by gpt-image-1.
        style:
          type: string
          enum:
            - vivid
            - natural
          description: Only supported by dall-e-3.
        user:
          type: string
          description: Unique identifier for the end user.
    OpenAIImagesResponse:
      type: object
      required:
        - created
        - data
      properties:
        created:
          type: integer
          format: int64
          description: Unix timestamp in seconds.
        background:
          type: string
          enum:
            - transparent
            - opaque
            - auto
        output_format:
          type: string
          enum:
            - png
            - jpeg
            - webp
        quality:
          type: string
          enum:
            - auto
            - high
            - medium
            - low
            - hd
            - standard
        size:
          type: string
        data:
          type: array
          items:
            $ref: '#/components/schemas/OpenAIImageData'
        usage:
          $ref: '#/components/schemas/OpenAIImageUsage'
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    OpenAIImageData:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: Temporary URL for the generated image.
        b64_json:
          type: string
          description: Base64-encoded image payload.
        revised_prompt:
          type: string
          description: Provider-revised prompt when available.
    OpenAIImageUsage:
      type: object
      properties:
        input_tokens:
          type: integer
        input_tokens_details:
          $ref: '#/components/schemas/OpenAIImageTokenDetails'
        output_tokens:
          type: integer
        total_tokens:
          type: integer
    OpenAIImageTokenDetails:
      type: object
      properties:
        image_tokens:
          type: integer
        text_tokens:
          type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````