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

# Flux 图像编辑 API 文档

> 使用 Flux 图像编辑 API 对已有图片进行局部修改、重绘和提示词驱动编辑，适用于图像优化与内容调整。



## OpenAPI

````yaml openapi/cn/flux.json POST /flux/edits
openapi: 3.1.0
info:
  title: Flux API DOCS
  version: 1.0.0
  description: TTAPI Flux API 接口服务，目前集成了市场上最为领先的视频大模型sora2。
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /flux/edits:
    post:
      description: 根据文本提示和上传垫图生成新图像
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/EditsRequest'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    EditsRequest:
      type: object
      properties:
        image:
          type: file
          description: 垫图，支持多张
        prompt:
          type: string
          description: 生成图像描述词。注意：Flux支持多语言理解能力，但实测英文最佳。
        mode:
          type: string
          example: flux1-dev
          description: 模型版本
          enum:
            - flux1-dev
            - flux1-schnell
            - flux1-pro
            - flux-kontext-pro
            - flux-kontext-max
            - flux-2-pro
            - flux-2-flex
            - flux-2-max
            - flux-2-klein-4b
            - flux-2-klein-9b
        aspect_ratio:
          type: string
          example: '1:1'
          description: 图像比例
          enum:
            - '21:9'
            - '16:9'
            - '4:3'
            - '3:2'
            - '1:1'
            - '2:3'
            - '3:4'
            - '9:16'
            - '9:21'
        hookUrl:
          type: string
          description: 回调通知地址
      required:
        - image
        - mode
  responses:
    SuccessResponse:
      description: 请求成功
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: success
              data:
                type: object
                example:
                  jobId: jobId
            required:
              - status
              - message
              - data
    400Response:
      description: 参数错误
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: '"prompt" cannot be empty.'
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: 授权失败
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: Wrong TT-API-KEY or email is not activated.
            required:
              - status
              - message
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        请前往 <a href='https://dashboard.ttapi.io' target='_blank'>TTAPI 控制台</a>
        获取 API 密钥。

````