> ## 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

> 使用 GPT Image 2 系列模型异步生成新图片，或编辑最多 16 张参考图。模型名决定 1K、2K 或 4K 分辨率档，输出质量固定为 high。请求返回任务 ID。



## OpenAPI

````yaml /zh/api-reference/image/openapi.json post /v1/tlimages/proimage
openapi: 3.0.3
info:
  title: 图片服务 API
  description: AI图片生成服务 API - 提供多种AI模型图片生成、任务查询和历史记录功能
  version: 1.0.0
  contact:
    name: API Support
servers:
  - url: https://api.tensormaster.com
    description: 生产环境
security: []
tags:
  - name: 图片生成
    description: 图片生成相关接口
  - name: 任务管理
    description: 任务管理相关接口
paths:
  /v1/tlimages/proimage:
    post:
      tags:
        - 图片生成
      summary: Gpt image 2
      description: >-
        使用 GPT Image 2 系列模型异步生成新图片，或编辑最多 16 张参考图。模型名决定 1K、2K 或 4K 分辨率档，输出质量固定为
        high。请求返回任务 ID。
      operationId: proImage
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  description: GPT Image 2 模型及输出分辨率档位
                  enum:
                    - gpt-image-2
                    - gpt-image-2-2k
                    - gpt-image-2-4k
                  example: gpt-image-2
                prompt:
                  type: string
                  description: 图片生成或编辑指令
                  maxLength: 32000
                  example: 在简洁的影棚背景中生成一张高品质商品图
                size:
                  type: string
                  description: >-
                    文生图的输出画幅。支持 auto，以及
                    1:1、4:3、3:4、3:2、2:3、16:9、9:16、21:9、5:4、4:5，也可以传
                    1920x1080、512x512 等常见 WxH 像素尺寸。图生图请传 1024x1024 等 WxH
                    像素尺寸。交付尺寸由所选模型档位决定。
                  example: '16:9'
                'n':
                  type: integer
                  description: 生成图片数量
                  minimum: 1
                  maximum: 10
                  default: 1
                image:
                  type: array
                  description: >-
                    图生图的可选参考图。传多张图片时重复提交 image 字段；支持 PNG、WebP、JPG 和 JPEG。上传文件与
                    imageUrl 中的图片总数不能超过 16。
                  maxItems: 16
                  items:
                    type: string
                    format: binary
                imageUrl:
                  type: string
                  description: 图生图的可选参考图 URL。多个 URL 使用英文逗号分隔；上传文件与 URL 中的图片总数不能超过 16。
                mask:
                  type: string
                  format: binary
                  description: 图生图的可选 PNG 蒙版。至少需要同时传一张参考图，尺寸须与第一张参考图一致；透明区域会被编辑，非透明区域会被保留。
      responses:
        '200':
          description: 任务创建成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeneralResponse'
              examples:
                success:
                  summary: 成功响应
                  value:
                    code: 1000
                    msg: 任务创建成功
                    data:
                      taskid: abcd_1234567890abcdef
      security:
        - ApiKeyAuth: []
components:
  schemas:
    GeneralResponse:
      type: object
      description: 通用响应
      allOf:
        - $ref: '#/components/schemas/BaseResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/GeneralData'
          required:
            - data
    BaseResponse:
      type: object
      description: 基础响应结构
      properties:
        code:
          type: integer
          description: 响应状态码：1000=成功，9999=失败，9000=积分不足
        msg:
          type: string
          description: 响应消息
      required:
        - code
        - msg
    GeneralData:
      type: object
      description: 通用数据响应
      properties:
        taskid:
          type: string
          description: 任务ID，用于后续查询任务状态
        url:
          type: string
          description: 生成的图片URL（某些接口返回）
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: API密钥认证，请在请求头中包含Authorization字段

````