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

> Generate or edit images using Flux Kontext model (async)

Generate and edit images using [Black Forest Labs](https://bfl.ai)' FLUX.1 Kontext model with context-aware capabilities.

**Key Features:**

* **Context Understanding** - Modify existing images through text instructions without complex workflows
* **Character Consistency** - Maintain visual features of characters/objects across multiple scenes
* **Local Editing** - Precisely modify specific areas of an image without affecting other parts
* **Fast Iteration** - Generate 1MP images in 3-5 seconds, 8x faster than GPT-Image


## OpenAPI

````yaml /en/openapi.yaml POST /generate/k/flux-kontext
openapi: 3.0.0
info:
  contact:
    email: support@sinancode.com
    name: API Support
    url: https://sinancode.com/support
  description: AI Model Task Scheduling Platform 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/flux-kontext:
    post:
      tags:
        - public
      summary: Flux Kontext Image Generation/Editing
      description: Generate or edit images using Flux Kontext model (async)
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ka.CreateFluxKontextTaskRequest'
        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.CreateFluxKontextTaskRequest:
      properties:
        aspect_ratio:
          default: auto
          description: aspect ratio（optional，default 16:9）
          enum:
            - auto
            - '21:9'
            - '16:9'
            - '4:3'
            - '1:1'
            - '3:4'
            - '9:16'
          example: '16:9'
          type: string
        enable_translation:
          default: true
          description: Enable automatic translation (optional, default true)
          example: true
          type: boolean
        input_image:
          description: Input image URL (optional, for edit mode)
          example: https://example.com/input.jpg
          type: string
        model:
          default: flux-kontext-pro
          description: modelversion（optional，default flux-kontext-pro）
          enum:
            - flux-kontext-pro
            - flux-kontext-max
          example: flux-kontext-pro
          type: string
        output_format:
          default: jpeg
          description: outputformat（optional，default jpeg）
          enum:
            - jpeg
            - png
          example: jpeg
          type: string
        prompt:
          description: Prompt (required, English supported)
          example: a beautiful landscape with mountains
          minLength: 1
          type: string
        prompt_upsampling:
          default: false
          description: Enable prompt enhancement (optional, default false)
          example: false
          type: boolean
        safety_tolerance:
          default: 2
          description: Safety tolerance level (optional, 0-6, default 2)
          example: 2
          maximum: 6
          minimum: 0
          type: integer
        upload_cn:
          description: Use China mainland server for upload (optional)
          example: false
          type: boolean
        watermark:
          description: Watermark identifier (optional)
          example: ''
          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: Please use your API Token for authentication

````