{
  "openapi": "3.1.0",
  "info": {
    "title": "SeedRouter GPT Image 2.5",
    "version": "1.0.0",
    "description": "Official image parameters with asynchronous task delivery and URL inputs/outputs. stream and partial_images are not exposed. Not a synchronous SDK replacement."
  },
  "servers": [
    {
      "url": "https://api.seedrouter.ai/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/images/generations": {
      "post": {
        "summary": "Create an image generation or editing task; images selects editing",
        "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",
            "enum": [
              "gpt-image-2.5-flare",
              "gpt-image-2.5-sunburst",
              "gpt-image-2.5-flare-official",
              "gpt-image-2.5-sunburst-official"
            ]
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32000
          },
          "n": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 10
              },
              {
                "type": "null"
              }
            ],
            "default": 1
          },
          "size": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": "auto",
            "description": "auto or WIDTHxHEIGHT; multiples of 16; each edge <=3840; 655360–8294400 total pixels; aspect ratio 1:3–3:1."
          },
          "quality": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "auto",
                  "low",
                  "medium",
                  "high",
                  "xhigh",
                  "max"
                ]
              },
              {
                "type": "null"
              }
            ],
            "default": "auto"
          },
          "background": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "auto",
                  "opaque",
                  "transparent"
                ]
              },
              {
                "type": "null"
              }
            ],
            "default": "auto",
            "description": "Transparent requires PNG."
          },
          "output_format": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "png",
                  "jpeg"
                ]
              },
              {
                "type": "null"
              }
            ],
            "default": "png"
          },
          "output_compression": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              {
                "type": "null"
              }
            ],
            "default": 100,
            "description": "Only with JPEG. Explicit zero is preserved."
          },
          "moderation": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "auto",
                  "low"
                ]
              },
              {
                "type": "null"
              }
            ],
            "default": "auto"
          },
          "user": {
            "type": "string"
          },
          "images": {
            "minItems": 1,
            "maxItems": 16,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "image_url": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "required": [
                "image_url"
              ],
              "additionalProperties": false
            },
            "description": "1–16 public HTTP(S) JPEG/PNG/WebP image URLs, each smaller than 50 MB. No base64 or file uploads."
          },
          "mask": {
            "type": "object",
            "properties": {
              "image_url": {
                "type": "string",
                "format": "uri"
              }
            },
            "required": [
              "image_url"
            ],
            "additionalProperties": false,
            "description": "PNG smaller than 4 MB, same dimensions as first reference image. Transparent pixels are edited. Requires images."
          }
        },
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": false
      },
      "TaskAccepted": {
        "type": "object",
        "required": [
          "id",
          "model",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "enum": [
              "gpt-image-2.5-flare",
              "gpt-image-2.5-sunburst",
              "gpt-image-2.5-flare-official",
              "gpt-image-2.5-sunburst-official"
            ]
          },
          "status": {
            "const": "processing"
          },
          "created_at": {
            "type": "integer"
          }
        }
      },
      "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"
          }
        }
      },
      "Task": {
        "type": "object",
        "required": [
          "id",
          "model",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "enum": [
              "gpt-image-2.5-flare",
              "gpt-image-2.5-sunburst",
              "gpt-image-2.5-flare-official",
              "gpt-image-2.5-sunburst-official"
            ]
          },
          "status": {
            "enum": [
              "processing",
              "completed",
              "failed"
            ]
          },
          "created_at": {
            "type": "integer"
          },
          "finished_at": {
            "type": "integer"
          },
          "output": {
            "type": "object",
            "properties": {
              "created": {
                "type": "integer"
              },
              "size": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,4}x[1-9][0-9]{0,4}$"
              },
              "quality": {
                "enum": [
                  "low",
                  "medium",
                  "high",
                  "xhigh",
                  "max"
                ]
              },
              "background": {
                "enum": [
                  "opaque",
                  "transparent"
                ]
              },
              "output_format": {
                "enum": [
                  "png",
                  "jpeg"
                ]
              },
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "url"
                  ],
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              },
              "usage": {
                "type": "object",
                "description": "Numeric input_tokens, output_tokens, total_tokens and token details when reported."
              }
            }
          },
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
