{
  "openapi": "3.1.0",
  "info": {
    "title": "Seedream - Text-to-Image (Sync)",
    "version": "1.0.0",
    "description": "Seedream Text-to-Image Sync API - Generate images only through text prompt, return results directly."
  },
  "servers": [
    {
      "url": "https://api.ttapi.io"
    }
  ],
  "components": {
    "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>."
      }
    },
    "schemas": {
      "TextToImageRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "doubao-seedream-5-0-pro-260628",
              "doubao-seedream-5-0-flash-260915"
            ],
            "description": "Model name."
          },
          "prompt": {
            "type": "string",
            "description": "Text prompt."
          },
          "size": {
            "type": "string",
            "description": "Image size. 5.0 pro/flash options: 1K, 1.5K, 2K (default 2K), or specify pixel values.",
            "default": "2K",
            "enum": [
              "1K",
              "1.5K",
              "2K"
            ]
          },
          "output_format": {
            "type": "string",
            "description": "Output image format.",
            "default": "jpeg",
            "enum": [
              "png",
              "jpeg"
            ]
          },
          "response_format": {
            "type": "string",
            "description": "Return format. `url` returns image download link (24h valid), `b64_json` returns Base64 encoded data.",
            "default": "url",
            "enum": [
              "url",
              "b64_json"
            ]
          },
          "background": {
            "type": "string",
            "description": "Image alpha channel setting. `transparent`=transparent background (image-to-image only), `opaque`=opaque background. Only 5.0 pro/flash supports.",
            "default": "opaque",
            "enum": [
              "transparent",
              "opaque"
            ]
          },
          "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), fast=fast mode (shorter time, 5.0 flash not supported)"
              }
            }
          }
        },
        "required": [
          "model",
          "prompt"
        ]
      }
    }
  },
  "paths": {
    "/sd/api/v3/images/generations": {
      "post": {
        "description": "Text-to-Image (Sync) - Return generation results directly",
        "security": [
          {
            "CustomApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TextToImageRequest"
              },
              "example": {
                "model": "doubao-seedream-5-0-pro-260628",
                "prompt": "Vibrant close-up portrait, rich colors",
                "size": "2K",
                "watermark": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generation successful",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "created": {
                      "type": "integer",
                      "description": "Created time (Unix timestamp)"
                    },
                    "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"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
