> ## 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-4o Image

> 使用 OpenAI GPT-4o 模型生成图片（异步）

使用 [OpenAI](https://openai.com) 的 GPT-4o 原生图像生成能力创建和编辑图片。

**模型特点：**

* **原生多模态** - 图像生成内置于 GPT-4o 架构，非外部模型调用
* **精准文字渲染** - 显著优于 DALL·E 3 的文字生成能力
* **多轮对话一致性** - 通过自然对话迭代优化，保持风格连贯
* **图片理解与编辑** - 支持上传图片作为输入进行理解和变换


## OpenAPI

````yaml /cn/openapi.yaml POST /generate/k/gpt4o-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/gpt4o-image:
    post:
      tags:
        - public
      summary: GPT-4o Image 图片生成
      description: 使用 OpenAI GPT-4o 模型生成图片（异步）
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ka.CreateGPT4oImageTaskRequest'
        description: Task parameters
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.CreateTaskResponse'
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
      security:
        - AccessToken: []
components:
  schemas:
    ka.CreateGPT4oImageTaskRequest:
      properties:
        filesUrl:
          description: 文件 URL 列表（可选）- 文件 URL 列表，最多5张图片
          example:
            - ''
          items:
            type: string
          type: array
        isEnhance:
          default: false
          description: 启用增强（可选）- 提示词增强，默认 false
          example: false
          type: boolean
        maskUrl:
          description: 遮罩 URL（可选）- 用于编辑的遮罩图片 URL，黑色区域将被替换/修改
          example: ''
          type: string
        nVariants:
          default: 1
          description: 变体数量（可选）- 图片变体数量，可选 1、2 或 4，默认1
          enum:
            - 1
            - 2
            - 4
          example: 1
          type: integer
        prompt:
          description: 提示词（可选）- 描述你希望 GPT-4o 生成的内容
          example: A beautiful sunset over the mountains
          type: string
        size:
          default: '1:1'
          description: 尺寸（必填）- 图片宽高比，必须是支持的格式之一
          enum:
            - '1:1'
            - '3:2'
            - '2:3'
          example: '1:1'
          type: string
      required:
        - size
      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 进行认证

````