{
  "openapi": "3.1.0",
  "info": {
    "title": "SeedRouter Seedream 5.0 Pro",
    "version": "1.0.0",
    "description": "Seedream 5.0 Pro images from text or up to 10 reference images, layer decomposition into a base image and up to 16 transparent layers, and transparent backgrounds. Asynchronous task delivery; media by URL only; callbacks are not offered; tasks cannot be cancelled."
  },
  "servers": [
    {
      "url": "https://api.seedrouter.ai/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/images/generations": {
      "post": {
        "summary": "Create an image generation task",
        "operationId": "createImageTask",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted. Poll the returned id; no image is returned by this call.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/tasks/{task_id}": {
      "get": {
        "summary": "Read an owned image task",
        "operationId": "getImageTask",
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^task_[A-Za-z0-9]{1,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Processing, completed or failed task. Polling timeout is not a task failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "401": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "const": "seedream-5-0-pro"
          },
          "prompt": {
            "type": "string",
            "description": "Required for generation. Optional with layer_decomposition: name the elements to split out, or omit it to split every major element."
          },
          "image": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "maxItems": 10,
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "One public http(s) image URL, or a list of up to 10. Exactly one with layer_decomposition or background transparent. Base64 is not accepted."
          },
          "size": {
            "type": "string",
            "default": "2K",
            "description": "1K, 1.5K or 2K (describe the shape in the prompt), or WIDTHxHEIGHT totalling 921,600 to 4,624,220 pixels with an aspect ratio between 1:16 and 16:1. With layer_decomposition: auto (default), 1K, 1.5K or 2K."
          },
          "layer_decomposition": {
            "type": "boolean",
            "default": false,
            "description": "Split the one input image into a base image and up to 16 transparent PNG layers."
          },
          "optimize_prompt_options": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "standard",
                  "fast"
                ],
                "default": "standard",
                "description": "standard for higher quality, fast for lower latency."
              }
            },
            "additionalProperties": false
          },
          "output_format": {
            "type": "string",
            "enum": [
              "jpeg",
              "png"
            ],
            "default": "jpeg",
            "description": "With layer_decomposition it sets the base image only; layers are always PNG."
          },
          "background": {
            "type": "string",
            "enum": [
              "opaque",
              "transparent"
            ],
            "default": "opaque",
            "description": "transparent needs exactly one input image with an alpha channel, not jpeg output and not layer_decomposition."
          },
          "watermark": {
            "type": "boolean",
            "default": true,
            "description": "true adds an \"AI generated\" mark in the lower-right corner."
          },
          "content_filter": {
            "type": "boolean",
            "default": true,
            "description": "SeedRouter field. false is available through the API only; the Playground keeps it on."
          }
        },
        "required": [
          "model"
        ]
      },
      "TaskAccepted": {
        "type": "object",
        "required": [
          "id",
          "model",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "enum": [
              "seedream-5-0-pro"
            ]
          },
          "status": {
            "const": "processing"
          },
          "created_at": {
            "type": "integer"
          }
        }
      },
      "Task": {
        "type": "object",
        "required": [
          "id",
          "model",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "enum": [
              "seedream-5-0-pro"
            ]
          },
          "status": {
            "enum": [
              "processing",
              "completed",
              "failed"
            ]
          },
          "created_at": {
            "type": "integer"
          },
          "finished_at": {
            "type": "integer"
          },
          "output": {
            "type": "object",
            "properties": {
              "created": {
                "type": "integer"
              },
              "data": {
                "type": "array",
                "maxItems": 17,
                "description": "One image, or with layer_decomposition the base image (z_index 0) followed by each layer.",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "size": {
                      "type": "string",
                      "description": "WIDTHxHEIGHT in pixels."
                    },
                    "output_format": {
                      "enum": [
                        "jpeg",
                        "png"
                      ]
                    },
                    "z_index": {
                      "type": "integer",
                      "description": "Layer decomposition only: 0 is the base image; higher numbers sit on top."
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "bounding_box": {
                      "type": "object",
                      "description": "Layers only: [left, top, right, bottom] in base-image pixels (absolute) and in thousandths of its width and height (normalized).",
                      "properties": {
                        "absolute": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          },
                          "minItems": 4,
                          "maxItems": 4
                        },
                        "normalized": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          },
                          "minItems": 4,
                          "maxItems": 4
                        }
                      }
                    }
                  }
                }
              },
              "usage": {
                "type": "object",
                "properties": {
                  "output_tokens": {
                    "type": "integer"
                  },
                  "total_tokens": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "enum": [
              10001,
              10002,
              20001,
              20002,
              30001,
              30002,
              50001,
              50002,
              50003,
              60001,
              60002,
              60003,
              60004,
              90001
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
