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

# 文生图（同步）

> 文生图（同步） - 直接返回生成结果

这是 **Seedream 图片生成 API** 的文生图同步接口。仅通过 `prompt` 生成图片，不传入任何媒体文件。请求后直接返回生成结果，无需额外查询。

## 同步接口说明

同步接口请求后直接返回生成结果，无需通过查询接口轮询。以下所有场景均使用同一接口 `POST /sd/api/v3/images/generations`，仅参数不同：

| 使用场景 | 参数差异 | 说明 |
| :- | :- | :- |
| 文生图 | 仅需 `prompt` | 仅通过文本提示词生成图片 |
| 图生图 | 需 `prompt` + `image`（单张） | 基于单张参考图片进行风格转换或内容编辑，支持透明背景 |
| 多图融合 | 需 `prompt` + `image`（2-10 张数组） | 基于多张参考图融合生成新图片 |
| 图层拆分 | 需 `prompt` + `image` + `layer_decomposition: true` | 将图片拆解为底图和多个图层，仅 5.0 pro / flash 支持 |
| 交互编辑 | 需 `prompt` + `image` | 通过坐标、框选等方式精准编辑图片，仅 5.0 pro / flash 支持 |

**推荐异步接口**：生产环境建议使用异步接口（返回 `id`，通过查询接口获取结果），支持 webhook 回调通知，更适合大批量生成场景。


## OpenAPI

````yaml openapi/cn/seedream-text-to-image-sync.json POST /sd/api/v3/images/generations
openapi: 3.1.0
info:
  title: Seedream - 文生图（同步）
  version: 1.0.0
  description: Seedream 文生图同步接口 - 仅通过文本提示词生成图片，直接返回结果。
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /sd/api/v3/images/generations:
    post:
      description: 文生图（同步） - 直接返回生成结果
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextToImageRequest'
            example:
              model: doubao-seedream-5-0-pro-260628
              prompt: 充满活力的特写肖像，色彩丰富
              size: 2K
              watermark: false
      responses:
        '200':
          description: 生成成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  model:
                    type: string
                  created:
                    type: integer
                    description: 创建时间（Unix 时间戳）
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                        size:
                          type: string
                  usage:
                    type: object
                    properties:
                      generated_images:
                        type: integer
                      total_tokens:
                        type: integer
      security:
        - CustomApiKey: []
components:
  schemas:
    TextToImageRequest:
      type: object
      properties:
        model:
          type: string
          enum:
            - doubao-seedream-5-0-pro-260628
            - doubao-seedream-5-0-flash-260915
          description: 模型名称。
        prompt:
          type: string
          description: 文本提示词。
        size:
          type: string
          description: 图像尺寸。5.0 pro/flash 可选：1K、1.5K、2K（默认 2K），或指定像素值。
          default: 2K
          enum:
            - 1K
            - 1.5K
            - 2K
        output_format:
          type: string
          description: 输出图像格式。
          default: jpeg
          enum:
            - png
            - jpeg
        response_format:
          type: string
          description: 返回格式。`url` 返回图片下载链接（24h 有效），`b64_json` 返回 Base64 编码。
          default: url
          enum:
            - url
            - b64_json
        background:
          type: string
          description: >-
            图片透明通道设置。`transparent`=透明背景（仅图生图场景），`opaque`=不透明背景。仅 5.0 pro/flash
            支持。
          default: opaque
          enum:
            - transparent
            - opaque
        watermark:
          type: boolean
          description: 是否添加水印。true=右下角显示「AI 生成」，false=不添加。
          default: true
          enum:
            - true
            - false
          example: false
        optimize_prompt_options:
          type: object
          description: 提示词优化配置
          properties:
            mode:
              type: string
              enum:
                - standard
                - fast
              default: standard
              description: 优化模式。standard=标准模式（质量更高），fast=快速模式（耗时更短，5.0 flash 不支持）
      required:
        - model
        - prompt
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        请前往 <a href='https://dashboard.ttapi.io' target='_blank'>TTAPI 控制台</a>
        获取 API 密钥。

````

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