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

# Gpt image 2

> Generate new images or edit up to 16 reference images asynchronously with the GPT Image 2 model family. The model name selects the 1K, 2K, or 4K resolution tier, and output quality is fixed to high. The request returns a task ID.



## OpenAPI

````yaml /api-reference/image/openapi.json post /v1/tlimages/proimage
openapi: 3.0.3
info:
  title: Images Service API
  description: >-
    AI Image Generation Service API - Provides various AI model image
    generation, task query and history record functions
  version: 1.0.0
  contact:
    name: API Support
servers:
  - url: https://api.tensormaster.com
    description: Production
security: []
tags:
  - name: Image Generation
    description: Image generation related interfaces
  - name: Task Management
    description: Task management related interfaces
paths:
  /v1/tlimages/proimage:
    post:
      tags:
        - Image Generation
      summary: Gpt image 2
      description: >-
        Generate new images or edit up to 16 reference images asynchronously
        with the GPT Image 2 model family. The model name selects the 1K, 2K, or
        4K resolution tier, and output quality is fixed to high. The request
        returns a task ID.
      operationId: proImage
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  description: GPT Image 2 model and output resolution tier
                  enum:
                    - gpt-image-2
                    - gpt-image-2-2k
                    - gpt-image-2-4k
                  example: gpt-image-2
                prompt:
                  type: string
                  description: Image generation or editing instructions
                  maxLength: 32000
                  example: Create a premium product photo on a clean studio background
                size:
                  type: string
                  description: >-
                    Output aspect ratio for text-to-image requests. Use auto,
                    one of 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9, 5:4, or
                    4:5, or a common WxH pixel size such as 1920x1080 or
                    512x512. For image editing, pass a WxH pixel size such as
                    1024x1024. Delivered dimensions follow the selected model
                    tier.
                  example: '16:9'
                'n':
                  type: integer
                  description: Number of images to generate
                  minimum: 1
                  maximum: 10
                  default: 1
                image:
                  type: array
                  description: >-
                    Optional reference images for image editing. Repeat the
                    image field for multiple PNG, WebP, JPG, or JPEG files. The
                    combined total of uploaded files and imageUrl entries cannot
                    exceed 16.
                  maxItems: 16
                  items:
                    type: string
                    format: binary
                imageUrl:
                  type: string
                  description: >-
                    Optional reference image URL for image editing. Separate
                    multiple URLs with commas. The combined total of uploaded
                    files and URLs cannot exceed 16.
                mask:
                  type: string
                  format: binary
                  description: >-
                    Optional PNG mask for image editing. It requires at least
                    one reference image and must match the first image
                    dimensions. Transparent areas are edited while
                    non-transparent areas are preserved.
      responses:
        '200':
          description: Task created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeneralResponse'
              examples:
                success:
                  summary: Successful response
                  value:
                    code: 1000
                    msg: Task created successfully
                    data:
                      taskid: abcd_1234567890abcdef
      security:
        - ApiKeyAuth: []
components:
  schemas:
    GeneralResponse:
      type: object
      description: General response
      allOf:
        - $ref: '#/components/schemas/BaseResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/GeneralData'
          required:
            - data
    BaseResponse:
      type: object
      description: Base response structure
      properties:
        code:
          type: integer
          description: >-
            Response status code: 1000=Success, 9999=Failure, 9000=Insufficient
            Credits
        msg:
          type: string
          description: Response message
      required:
        - code
        - msg
    GeneralData:
      type: object
      description: General data response
      properties:
        taskid:
          type: string
          description: Task ID, used for subsequent task status query
        url:
          type: string
          description: Generated image URL (returned by some interfaces)
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API Key authentication, please include the Authorization field in the
        request header

````