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

# /v1/images/generations

> OpenAI 호환 이미지 생성 모델을 사용하여 텍스트 프롬프트에서 이미지를 생성합니다.

テキスト プロンプトから画像を作成します。

* `Authorization: Bearer {API_KEY}`で認証する
* これをテキストから画像へのルートとして使用します。編集、修復、または画像の拡張には、`/v1/images/edits` を使用してください。
* `gpt-image-1`、`dall-e-3`、および `dall-e-2` は異なるパラメーター セットを公開しており、それらの違いは上のネイティブ パラメーター パネルに表示されるようになりました。
* 応答に一時的な `url` 値が含まれている場合は、それらをサーバー側ですぐにミラーリングします。 `b64_json` が含まれている場合は、メインスレッドで大きな画像をデコードしすぎないようにします。


## 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://maas.apigo.ai
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      summary: OpenAI image generations
      description: >-
        Creates images from text prompts with OpenAI-compatible image generation
        models.
      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

````