{
  "openapi": "3.1.0",
  "info": {
    "title": "SeedRouter Nano Banana 2 Lite (gemini-3.1-flash-lite-image)",
    "version": "1.0.0",
    "description": "Google's generateContent request body with a model field, asynchronous task delivery and URL inputs/outputs. streamGenerateContent and Google Search grounding (tools) are not exposed."
  },
  "servers": [
    {
      "url": "https://api.seedrouter.ai/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/images/generations": {
      "post": {
        "summary": "Create an image task; fileData parts in contents are reference images",
        "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": [
              "gemini-3.1-flash-lite-image-official"
            ]
          },
          "contents": {
            "minItems": 1,
            "maxItems": 32,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "const": "user"
                    },
                    "parts": {
                      "minItems": 1,
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "text"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "fileData": {
                                "type": "object",
                                "properties": {
                                  "mimeType": {
                                    "type": "string",
                                    "enum": [
                                      "image/png",
                                      "image/jpeg",
                                      "image/webp",
                                      "image/heic",
                                      "image/heif",
                                      "video/mp4",
                                      "video/mpeg",
                                      "video/mov",
                                      "video/avi",
                                      "video/x-flv",
                                      "video/mpg",
                                      "video/webm",
                                      "video/wmv",
                                      "video/3gpp",
                                      "application/pdf"
                                    ]
                                  },
                                  "fileUri": {
                                    "type": "string",
                                    "format": "uri"
                                  }
                                },
                                "required": [
                                  "mimeType",
                                  "fileUri"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "fileData"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "parts"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "const": "model"
                    },
                    "parts": {
                      "minItems": 1,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "fileData": {
                            "type": "object",
                            "properties": {
                              "mimeType": {
                                "type": "string",
                                "enum": [
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp",
                                  "image/heic",
                                  "image/heif",
                                  "video/mp4",
                                  "video/mpeg",
                                  "video/mov",
                                  "video/avi",
                                  "video/x-flv",
                                  "video/mpg",
                                  "video/webm",
                                  "video/wmv",
                                  "video/3gpp",
                                  "application/pdf"
                                ]
                              },
                              "fileUri": {
                                "type": "string",
                                "format": "uri"
                              }
                            },
                            "required": [
                              "mimeType",
                              "fileUri"
                            ],
                            "additionalProperties": false
                          },
                          "thought": {
                            "type": "boolean"
                          },
                          "thoughtSignature": {
                            "type": "string",
                            "pattern": "^https:\\/\\/[^\\s?#]+\\/tasks\\/task_[A-Za-z0-9]{1,64}\\/\\d{1,3}\\.sig$"
                          }
                        },
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "role",
                    "parts"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "description": "Google generateContent contents. Parts are text or fileData {mimeType, fileUri} with a public HTTP(S) URL (images, video, or PDF); at most 14 references; inlineData is not accepted. The last turn is user."
          },
          "systemInstruction": {
            "type": "object",
            "properties": {
              "parts": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "text"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "parts"
            ],
            "additionalProperties": false
          },
          "safetySettings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "category": {
                  "type": "string",
                  "enum": [
                    "HARM_CATEGORY_HARASSMENT",
                    "HARM_CATEGORY_HATE_SPEECH",
                    "HARM_CATEGORY_SEXUALLY_EXPLICIT",
                    "HARM_CATEGORY_DANGEROUS_CONTENT"
                  ]
                },
                "threshold": {
                  "type": "string",
                  "enum": [
                    "BLOCK_NONE",
                    "BLOCK_ONLY_HIGH",
                    "BLOCK_MEDIUM_AND_ABOVE",
                    "BLOCK_LOW_AND_ABOVE",
                    "OFF"
                  ]
                }
              },
              "required": [
                "category",
                "threshold"
              ],
              "additionalProperties": false
            }
          },
          "generationConfig": {
            "type": "object",
            "properties": {
              "responseModalities": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "TEXT",
                    "IMAGE"
                  ]
                }
              },
              "candidateCount": {
                "type": "number",
                "const": 1
              },
              "imageConfig": {
                "type": "object",
                "properties": {
                  "aspectRatio": {
                    "type": "string",
                    "enum": [
                      "1:4",
                      "4:1",
                      "1:8",
                      "8:1",
                      "1:1",
                      "2:3",
                      "3:2",
                      "3:4",
                      "4:3",
                      "4:5",
                      "5:4",
                      "9:16",
                      "16:9",
                      "21:9"
                    ]
                  },
                  "imageSize": {
                    "type": "string",
                    "enum": [
                      "1K"
                    ],
                    "default": "1K"
                  }
                },
                "additionalProperties": false
              },
              "temperature": {
                "type": "number",
                "minimum": 0,
                "maximum": 2
              },
              "topP": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "topK": {
                "type": "integer",
                "minimum": 1,
                "maximum": 2147483647
              },
              "seed": {
                "type": "integer",
                "minimum": -2147483648,
                "maximum": 2147483647
              },
              "maxOutputTokens": {
                "type": "integer",
                "minimum": 1,
                "maximum": 4096
              },
              "stopSequences": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "mediaResolution": {
                "type": "string",
                "enum": [
                  "MEDIA_RESOLUTION_LOW",
                  "MEDIA_RESOLUTION_MEDIUM",
                  "MEDIA_RESOLUTION_HIGH"
                ]
              },
              "thinkingConfig": {
                "type": "object",
                "properties": {
                  "includeThoughts": {
                    "type": "boolean"
                  },
                  "thinkingLevel": {
                    "type": "string",
                    "enum": [
                      "MINIMAL",
                      "HIGH"
                    ]
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "model",
          "contents"
        ],
        "additionalProperties": false
      },
      "TaskAccepted": {
        "type": "object",
        "required": [
          "id",
          "model",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "enum": [
              "gemini-3.1-flash-lite-image-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": [
              "gemini-3.1-flash-lite-image-official"
            ]
          },
          "status": {
            "enum": [
              "processing",
              "completed",
              "failed"
            ]
          },
          "created_at": {
            "type": "integer"
          },
          "finished_at": {
            "type": "integer"
          },
          "output": {
            "type": "object",
            "properties": {
              "created": {
                "type": "integer"
              },
              "output_format": {
                "enum": [
                  "png",
                  "jpeg",
                  "webp"
                ]
              },
              "text": {
                "type": "string",
                "description": "Non-thought text parts, when responseModalities includes TEXT."
              },
              "thoughts": {
                "type": "string",
                "description": "Thought text, when thinkingConfig.includeThoughts is true. Interim thought images are not delivered."
              },
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "url"
                  ],
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              },
              "parts": {
                "type": "array",
                "description": "Final response parts in order, for multi-turn editing. Each is {text, thoughtSignature} or {image (index into data), thoughtSignature}; thoughtSignature is a URL to send back unchanged in a model turn.",
                "items": {
                  "type": "object"
                }
              },
              "usage": {
                "type": "object",
                "description": "input_tokens, output_tokens (text, thinking and image output), total_tokens, and output_tokens_details.image_tokens / text_tokens / reasoning_tokens."
              }
            }
          },
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
