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

# Flux 2 Flex 文生图

> 使用 Flux 2 Flex 模型生成图片（异步）

使用 [Black Forest Labs](https://bfl.ai) 的 FLUX.2 Flex 模型从文本生成高质量图片。

**模型特点：**

* **可调节质量-速度平衡** - 通过 steps 参数控制生成步数，灵活权衡质量与速度
* **卓越的文字渲染** - 业界领先的文字生成能力，适合海报、产品图等场景
* **多参考图融合** - 支持最多 10 张参考图融合，保持风格一致性
* **高分辨率输出** - 最高支持 4MP 分辨率


## OpenAPI

````yaml /cn/openapi.yaml POST /generate/k/flux2-flex-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/k/flux2-flex-text-to-image:
    post:
      tags:
        - public
      summary: Flux 2 Flex 文生图
      description: 使用 Flux 2 Flex 模型生成图片（异步）
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ka.CreateFlux2FlexTextToImageTaskRequest'
        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.CreateFlux2FlexTextToImageTaskRequest:
      properties:
        aspect_ratio:
          default: auto
          description: 宽高比（可选，默认值 auto）
          enum:
            - '1:1'
            - '4:3'
            - '3:4'
            - '16:9'
            - '9:16'
            - '3:2'
            - '2:3'
            - auto
          example: auto
          type: string
        prompt:
          description: 提示词（必填，3-5000字符）
          example: A humanoid figure with a vintage television set for a head
          maxLength: 5000
          minLength: 3
          type: string
        resolution:
          default: 1K
          description: 分辨率（可选，默认值 1K）
          enum:
            - 1K
            - 2K
          example: 1K
          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 进行认证

````