{
  "openapi": "3.1.0",
  "info": {
    "title": "Seedream - 文生图（同步）",
    "version": "1.0.0",
    "description": "Seedream 文生图同步接口 - 仅通过文本提示词生成图片，直接返回结果。"
  },
  "servers": [{ "url": "https://api.ttapi.io" }],
  "components": {
    "securitySchemes": {
      "CustomApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "TT-API-KEY",
        "description": "请前往 <a href='https://dashboard.ttapi.io' target='_blank'>TTAPI 控制台</a> 获取 API 密钥。"
      }
    },
    "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"]
      }
    }
  },
  "paths": {
    "/sd/api/v3/images/generations": {
      "post": {
        "description": "文生图（同步） - 直接返回生成结果",
        "security": [{ "CustomApiKey": [] }],
        "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" } } }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
