{
  "openapi": "3.1.0",
  "info": {
    "title": "SeedRouter Seedream 5.5",
    "version": "1.0.0",
    "description": "Seedream 5.5 images from text or up to 10 reference images, transparent output, and layer decomposition into a base image and transparent layers with optional text recognition. 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-5"
          },
          "prompt": {
            "type": "string",
            "description": "Required for generation. Optional with layer_decomposition: name the elements to split out, or omit it and the model finds the subjects, text and background."
          },
          "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; every one is billed. Exactly one with layer_decomposition. Base64 is not accepted."
          },
          "size": {
            "type": "string",
            "default": "2K",
            "description": "Generation: 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."
          },
          "output_format": {
            "type": "string",
            "enum": [
              "png",
              "jpeg"
            ],
            "default": "png",
            "description": "With layer_decomposition it sets the base image only; layers are always PNG."
          },
          "background": {
            "type": "string",
            "enum": [
              "auto",
              "opaque",
              "transparent"
            ],
            "default": "auto",
            "description": "transparent requires png output. Omit it with layer_decomposition, including auto."
          },
          "layer_decomposition": {
            "type": "boolean",
            "default": false,
            "description": "Split the one input image into a base image and transparent PNG layers."
          },
          "layer_decomposition_options": {
            "type": "object",
            "properties": {
              "max_images": {
                "type": "integer",
                "minimum": 2,
                "maximum": 100,
                "default": 30,
                "description": "Most images returned, the base image included. The model may return fewer."
              },
              "text_recognition": {
                "type": "boolean",
                "default": false,
                "description": "Add the recognized text, line boxes, a similar font and the color to regular text layers."
              }
            },
            "additionalProperties": false,
            "description": "Only with layer_decomposition."
          },
          "optimize_prompt_options": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "const": "standard",
                "default": "standard",
                "description": "Only standard; prompt optimization cannot be turned off."
              }
            },
            "additionalProperties": false
          },
          "watermark": {
            "type": "boolean",
            "default": false,
            "description": "true adds an \"AI generated\" mark."
          },
          "content_filter": {
            "type": "boolean",
            "default": true,
            "description": "SeedRouter extension. false turns off content filtering."
          }
        },
        "required": [
          "model"
        ]
      },
      "TaskAccepted": {
        "type": "object",
        "required": [
          "id",
          "model",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "enum": [
              "seedream-5-5"
            ]
          },
          "status": {
            "const": "processing"
          },
          "created_at": {
            "type": "integer"
          }
        }
      },
      "Task": {
        "type": "object",
        "required": [
          "id",
          "model",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "enum": [
              "seedream-5-5"
            ]
          },
          "status": {
            "enum": [
              "processing",
              "completed",
              "failed"
            ]
          },
          "created_at": {
            "type": "integer"
          },
          "finished_at": {
            "type": "integer"
          },
          "output": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "maxItems": 100,
                "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": [
                        "png",
                        "jpeg"
                      ]
                    },
                    "background": {
                      "enum": [
                        "opaque",
                        "transparent"
                      ]
                    },
                    "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": "[left, top, right, bottom] in base-image pixels (absolute) and scaled to 0-1000 (normalized).",
                      "properties": {
                        "absolute": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          },
                          "minItems": 4,
                          "maxItems": 4
                        },
                        "normalized": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          },
                          "minItems": 4,
                          "maxItems": 4
                        }
                      }
                    },
                    "text_recognition": {
                      "type": "object",
                      "description": "Only with text_recognition, on regular text layers. Fonts and style marks are model estimates.",
                      "properties": {
                        "text": {
                          "type": "string",
                          "description": "Lines joined by \\n."
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "bounding_box": {
                                "type": "object",
                                "description": "[left, top, right, bottom] in base-image pixels (absolute) and scaled to 0-1000 (normalized).",
                                "properties": {
                                  "absolute": {
                                    "type": "array",
                                    "items": {
                                      "type": "integer"
                                    },
                                    "minItems": 4,
                                    "maxItems": 4
                                  },
                                  "normalized": {
                                    "type": "array",
                                    "items": {
                                      "type": "integer"
                                    },
                                    "minItems": 4,
                                    "maxItems": 4
                                  }
                                }
                              },
                              "runs": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "text": {
                                      "type": "string"
                                    },
                                    "style": {
                                      "type": "object",
                                      "properties": {
                                        "similar_font_family": {
                                          "type": "string"
                                        },
                                        "foreground_color": {
                                          "type": "string",
                                          "description": "#RRGGBB"
                                        },
                                        "bold": {
                                          "type": "boolean"
                                        },
                                        "italic": {
                                          "type": "boolean"
                                        },
                                        "underline": {
                                          "type": "boolean"
                                        },
                                        "strikethrough": {
                                          "type": "boolean"
                                        },
                                        "shadow": {
                                          "type": "boolean"
                                        },
                                        "translucent": {
                                          "type": "boolean"
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
          }
        }
      }
    }
  }
}
