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

# Wan2 文生图

> 使用通义万相 Wan2 系列模型生成图片，支持 wan2.5-t2i-preview/wan2.2-t2i-flash/wan2.2-t2i-plus 三种模型

使用[阿里云](https://tongyi.aliyun.com/wan)通义万相 Wan2 系列模型从文本生成图片。

**模型特点：**

* **多模型可选** - 支持 wan2.5-t2i-preview/wan2.2-t2i-flash/wan2.2-t2i-plus
* **原生多模态** - 同一架构支持文本、图像多种模态输入输出
* **中文原生** - 国内领先的中文理解能力，直接使用中文提示词
* **复杂指令理解** - 支持运镜等复杂连续指令


## OpenAPI

````yaml /cn/openapi.yaml POST /generate/bailian/wan2-text-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/bailian/wan2-text-to-image:
    post:
      tags:
        - public
      summary: 通义万相 Wan2 文生图
      description: >-
        使用通义万相 Wan2 系列模型生成图片，支持
        wan2.5-t2i-preview/wan2.2-t2i-flash/wan2.2-t2i-plus 三种模型
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/bailian.CreateWan2TextToImageTaskRequest'
        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'
        '404':
          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:
    bailian.CreateWan2TextToImageTaskRequest:
      properties:
        model:
          description: |-
            模型选择（可选，默认 wan2.5-t2i-preview）
            可选值：wan2.5-t2i-preview, wan2.2-t2i-flash, wan2.2-t2i-plus
          enum:
            - wan2.5-t2i-preview
            - wan2.2-t2i-flash
            - wan2.2-t2i-plus
          type: string
        negative_prompt:
          description: 负向提示词（可选，最大 500 字符）
          maxLength: 500
          type: string
        prompt:
          description: 正向提示词（必填，最大 2000 字符）
          maxLength: 2000
          minLength: 1
          type: string
        seed:
          description: 随机种子（可选，范围 0-2147483647）
          maximum: 2147483647
          minimum: 0
          type: integer
        size:
          description: |-
            图片尺寸（可选，默认 1280*1280）
            wan2.5-t2i-preview: 总像素 [768*768, 1440*1440]，宽高比 [1:4, 4:1]
            wan2.2 及以下: 宽高 [512, 1440]
          type: string
      required:
        - 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 进行认证

````