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

> ## Agent Instructions
> Send API requests to https://api.ttapi.io with the TT-API-KEY header. Midjourney account hosting uses https://hold.ttapi.io. Claude Code uses https://cc.ttapi.io.
> Most generation endpoints are asynchronous. The submit response returns a job id. Poll that product's fetch endpoint, or pass a webhook on the submit request. A fetch call does not start a new generation.
> 1 USD = 100 quota. Check the pricing page for that product before estimating cost.
> This file lists the English docs. Follow every /_llms/ link recursively for the API reference, Chinese, and Russian. Open a page's .md URL for the endpoint schema.

# Layer Decomposition

> Layer Decomposition - Submit async image generation task, return id

This is the **Seedream Image Generation API** layer decomposition endpoint. Decompose single image into base image (1) + multiple layer outputs (up to 16 layers). Only Seedream 5.0 pro / flash supported. Submit async task and return `id`, use query endpoint to get results.

**Usage**: Use `<bbox>` coordinates in `prompt` to mark areas for decomposition, set `layer_decomposition: true` to enable layer decomposition mode.


## OpenAPI

````yaml openapi/en/seedream-layer-decomposition.json POST /sd/api/v3/images/generations/tasks
openapi: 3.1.0
info:
  title: Seedream - Layer Decomposition
  version: 1.0.0
  description: >-
    Seedream Layer Decomposition API - Decompose single image into base image
    and multiple layers. Only Seedream 5.0 pro/flash supports.
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /sd/api/v3/images/generations/tasks:
    post:
      description: Layer Decomposition - Submit async image generation task, return id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LayerDecompositionRequest'
            example:
              model: doubao-seedream-5-0-pro-260628
              prompt: >-
                Separate the person from the background <bbox>(0.1, 0.2, 0.8,
                0.9)
              image: https://example.com/photo.jpg
              layer_decomposition: true
              watermark: false
      responses:
        '200':
          description: Task submitted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: PENDING_QUEUE
                    description: Task status
                  message:
                    type: string
                    example: success
                  id:
                    type: string
                    description: Task ID
                    example: 30d9b07d-7349-4cbc-8e11-9ba302c6d165
                required:
                  - status
                  - message
                  - id
      security:
        - CustomApiKey: []
components:
  schemas:
    LayerDecompositionRequest:
      type: object
      description: Layer Decomposition request parameters
      properties:
        model:
          type: string
          description: Model name.
          enum:
            - doubao-seedream-5-0-pro-260628
            - doubao-seedream-5-0-flash-260915
        prompt:
          type: string
          description: Text prompt, use <bbox> coordinates to mark areas to decompose.
        image:
          type: string
          description: Image URL to decompose.
        layer_decomposition:
          type: boolean
          description: >-
            Enable layer decomposition mode. true=layer decomposition, decompose
            input image into base image and multiple layers (max 16);
            false=image generation mode. Only Seedream 5.0 pro/flash supports.
          default: false
          enum:
            - true
            - false
        size:
          type: string
          description: >-
            Image size. Layer decomposition options: 1K, 1.5K, 2K, auto (default
            auto, keeps same as input). Pixel values not supported.
          default: auto
          enum:
            - 1K
            - 1.5K
            - 2K
            - auto
        output_format:
          type: string
          description: >-
            Output image format. In layer decomposition scene, only controls
            base image format; layers always output as png.
          default: jpeg
          enum:
            - png
            - jpeg
        response_format:
          type: string
          description: Return format.
          default: url
          enum:
            - url
            - b64_json
        watermark:
          type: boolean
          description: >-
            Whether to add watermark. true=Display "AI Generated" in
            bottom-right, false=Do not add.
          default: true
          enum:
            - true
            - false
          example: false
        optimize_prompt_options:
          type: object
          description: Prompt optimization config
          properties:
            mode:
              type: string
              enum:
                - standard
                - fast
              default: standard
              description: >-
                Optimization mode. standard=standard mode (higher quality,
                longer time), fast=fast mode (shorter time, slightly lower
                quality, 5.0 flash not supported)
        execution_expires_after:
          type: integer
          default: 172800
          description: >-
            Task timeout threshold (seconds). Range [3600, 259200] (1-72 hours),
            default 172800 (48 hours)
        priority:
          type: integer
          default: 0
          description: >-
            Execution priority. Range [0, 9], higher value = higher priority,
            default 0 (FIFO)
        safety_identifier:
          type: string
          description: >-
            End user unique identifier, max 64 characters. Recommend passing a
            hashed string
      required:
        - model
        - prompt
        - image
        - layer_decomposition
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        Get your API key from the <a href='https://dashboard.ttapi.io'
        target='_blank'>TTAPI Dashboard</a>.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.