{
  "openapi": "3.1.0",
  "info": {
    "title": "SeedRouter Kling Image 4.0 Long Image",
    "version": "1.0.0",
    "description": "Generate tall 1K or 2K ecommerce product detail pages and webpage visual designs. Asynchronous delivery of one PNG URL per request."
  },
  "servers": [
    {
      "url": "https://api.seedrouter.ai/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/images/generations": {
      "post": {
        "summary": "Create an ecommerce product detail page or webpage design long image",
        "operationId": "createImageTask",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageRequest"
              }
            }
          }
        },
        "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"
                }
              }
            }
          },
          "413": {
            "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": {
      "ImageRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "const": "kling-image-4-0-long-image"
          },
          "contents": {
            "minItems": 1,
            "maxItems": 4,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "prompt"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "text"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "refer_image"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "url"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "style_refer_image"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "url"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "subject_refer_image"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "url"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "description": "One prompt plus mode-specific reference images: 1–3 refer_image items for ecommerce, or up to one style_refer_image and one subject_refer_image for webpage. Each supplied reference ID must be unique.",
            "contains": {
              "type": "object",
              "properties": {
                "type": {
                  "const": "prompt"
                }
              },
              "required": [
                "type"
              ]
            },
            "minContains": 1,
            "maxContains": 1
          },
          "settings": {
            "type": "object",
            "properties": {
              "skill": {
                "type": "string",
                "enum": [
                  "ecommerce",
                  "webpage"
                ],
                "description": "Required page type: ecommerce for product detail pages or webpage for webpage visual designs."
              },
              "length": {
                "description": "Ecommerce page length: short (approx. 2–5 sections), medium (default, approx. 6–10 sections), or long (approx. 11–18 sections). Ignored in webpage mode.",
                "type": "string",
                "enum": [
                  "short",
                  "medium",
                  "long"
                ]
              },
              "resolution": {
                "description": "Output width tier: 1k (default, 1024 px wide) or 2k (2048 px wide). Height adapts to content.",
                "type": "string",
                "enum": [
                  "1k",
                  "2k"
                ]
              }
            },
            "required": [
              "skill"
            ],
            "additionalProperties": false
          },
          "options": {
            "type": "object",
            "properties": {
              "watermark_info": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "const": false
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "model",
          "contents",
          "settings"
        ],
        "additionalProperties": false
      },
      "TaskAccepted": {
        "type": "object",
        "required": [
          "id",
          "model",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "const": "kling-image-4-0-long-image"
          },
          "status": {
            "const": "processing"
          },
          "created_at": {
            "type": "integer"
          }
        }
      },
      "Task": {
        "type": "object",
        "required": [
          "id",
          "model",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "const": "kling-image-4-0-long-image"
          },
          "status": {
            "enum": [
              "processing",
              "completed",
              "failed"
            ]
          },
          "created_at": {
            "type": "integer"
          },
          "finished_at": {
            "type": "integer"
          },
          "output": {
            "type": "object",
            "properties": {
              "created": {
                "type": "integer"
              },
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "url"
                  ],
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          },
          "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"
          }
        }
      }
    }
  }
}
