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

# GPT Image 2 图片编辑

> 使用 GPT Image 2 模型编辑图片（异步）

使用 OpenAI GPT Image 2 模型编辑图片。

**模型特点：**

* **图片编辑** - 支持一张或多张输入图片（每张最大 30MB，支持 jpeg/png/webp/jpg）
* **长提示词** - 支持最长 20000 字符的提示词
* **多种宽高比** - 支持 auto、1:1、5:4、9:16、21:9、16:9、4:3、3:2、4:5、3:4、2:3
* **高分辨率** - 支持 1K / 2K / 4K 输出
* **NSFW 检测** - 可选的 NSFW 内容检测（默认开启）


## OpenAPI

````yaml /cn/openapi.yaml POST /generate/k/gpt-image-2-image-to-image
openapi: 3.0.0
info:
  contact:
    email: support@sinancode.com
    name: API Support
    url: https://sinancode.com/support
  description: AI 模型任务调度平台 API
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  termsOfService: https://sinancode.com/terms-of-service
  title: TikTomato API
  version: '1.0'
servers:
  - url: https://api.sinancode.com/v1
    description: Production server
security: []
paths:
  /generate/k/gpt-image-2-image-to-image:
    post:
      tags:
        - public
      summary: GPT Image 2 图片编辑
      description: 使用 GPT Image 2 模型编辑图片（异步）
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ka.CreateGPTImage2ImageToImageTaskRequest'
        description: 任务参数
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.CreateTaskResponse'
        '400':
          description: 参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '500':
          description: 服务器错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
      security:
        - AccessToken: []
components:
  schemas:
    ka.CreateGPTImage2ImageToImageTaskRequest:
      properties:
        aspect_ratio:
          default: auto
          description: 宽高比（可选，默认 auto）
          enum:
            - auto
            - '1:1'
            - '5:4'
            - '9:16'
            - '21:9'
            - '16:9'
            - '4:3'
            - '3:2'
            - '4:5'
            - '3:4'
            - '2:3'
          example: auto
          type: string
        input_urls:
          description: 输入图片 URL 列表（必填，最多30MB，支持 jpeg/png/webp/jpg）
          example:
            - https://media.sinancode.com/examples/gpt-image-2/input.png
          items:
            type: string
          minItems: 1
          type: array
        nsfw_checker:
          default: true
          description: NSFW 检查（可选，默认 true）
          example: true
          type: boolean
        prompt:
          description: 提示词（必填，最大20000字符）
          example: take a photo with Sam Altman in the conference room
          maxLength: 20000
          minLength: 1
          type: string
        resolution:
          default: 1K
          description: 分辨率（可选，默认 1K）
          enum:
            - 1K
            - 2K
            - 4K
          example: 1K
          type: string
      required:
        - input_urls
        - prompt
      type: object
    dto.CreateTaskResponse:
      properties:
        task_id:
          description: Task ID
          example: 01234567-89ab-cdef-0123-456789abcdef
          type: string
      required:
        - task_id
      type: object
    apierror.ErrorResponse:
      properties:
        error_code:
          description: Machine-readable error code (e.g. TASK.INVALID_PARAMS)
          type: string
        message:
          description: User-friendly error message
          type: string
      type: object
  securitySchemes:
    AccessToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 请使用您的 API Token 进行认证

````