{
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "bearerFormat": "AISA API Key",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Standard OpenAI-compatible `POST /v1/images/generations` endpoint. As of September 30, 2026 it serves `seedream-5-0-260128`, `wan2.7-image`, `wan2.7-image-pro`, `gpt-image-2`, `gpt-image-2.5-flare`, and `gpt-image-2.5-sunburst`. No image model is served on `/v1/chat/completions`; Gemini-compatible `generateContent` requests use [`/v1beta/models/{model}:generateContent`](/api-reference/chat/post_models-model-generatecontent).",
    "title": "OpenAI-Compatible Image Generations",
    "version": "1.0.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/images/generations": {
      "post": {
        "description": "使用 OpenAI 兼容的 images-generations endpoint 生成图像。\n\n**尺寸限制（仅 Seedream 路由）。** Seedream 上游要求每张图像至少 **3,686,400 像素**。低于该值的请求会返回 `400 InvalidParameter: image size must be at least 3686400 pixels`。Wan 和 `gpt-image-2` 路由可接受更小尺寸——`wan2.7-image` 已验证 `1024x1024` 可用。",
        "operationId": "createImageGeneration",
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "basic": {
                  "summary": "Single 2K image",
                  "value": {
                    "model": "seedream-5-0-260128",
                    "n": 1,
                    "prompt": "A cute red panda, ultra-detailed, cinematic lighting",
                    "size": "2048x2048"
                  }
                },
                "batch": {
                  "summary": "Four candidates for selection",
                  "value": {
                    "model": "seedream-5-0-260128",
                    "n": 4,
                    "prompt": "Oil painting of a rolling hillside at sunset",
                    "size": "2048x2048"
                  }
                },
                "minimum_size": {
                  "summary": "Exactly at minimum allowed size (1920×1920)",
                  "value": {
                    "model": "seedream-5-0-260128",
                    "n": 1,
                    "prompt": "A futuristic cyberpunk city, neon lights, rainy night, 8k",
                    "size": "1920x1920"
                  }
                }
              },
              "schema": {
                "properties": {
                  "model": {
                    "description": "图像生成模型。`seedream-5-0-260128`、`wan2.7-image`、`wan2.7-image-pro`、`gpt-image-2`、`gpt-image-2.5-flare` 或 `gpt-image-2.5-sunburst`。",
                    "enum": [
                      "seedream-5-0-260128",
                      "wan2.7-image",
                      "wan2.7-image-pro",
                      "gpt-image-2",
                      "gpt-image-2.5-flare",
                      "gpt-image-2.5-sunburst"
                    ],
                    "type": "string"
                  },
                  "n": {
                    "default": 1,
                    "description": "要生成的图像数量。每张图像均按单张图像费率单独计费。",
                    "minimum": 1,
                    "type": "integer"
                  },
                  "prompt": {
                    "description": "要生成的图像的文本描述。",
                    "type": "string"
                  },
                  "size": {
                    "description": "图像尺寸，格式为 `宽x高`。Seedream 路由要求 `宽 × 高 ≥ 3,686,400`（例如 `1920x1920`、`2048x2048`）；Wan 和 `gpt-image-2` 可接受更小尺寸，如 `1024x1024`。",
                    "example": "2048x2048",
                    "type": "string"
                  }
                },
                "required": [
                  "model",
                  "prompt"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "created": 1776495432,
                  "data": [
                    {
                      "size": "2048x2048",
                      "url": "https://cdn.aisa.one/images/seedream/20260418-abc.png"
                    }
                  ],
                  "model": "seedream-5-0-260128",
                  "usage": {
                    "generated_images": 1,
                    "output_tokens": 16384,
                    "total_tokens": 16384
                  }
                },
                "schema": {
                  "properties": {
                    "created": {
                      "example": 1776495432,
                      "type": "integer"
                    },
                    "data": {
                      "description": "每张生成的图像对应一个条目。",
                      "items": {
                        "properties": {
                          "size": {
                            "description": "返回图像的实际尺寸。",
                            "type": "string"
                          },
                          "url": {
                            "description": "生成图像的短期有效 URL。请下载并持久化保存；该 URL 会过期。",
                            "format": "uri",
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "model": {
                      "example": "seedream-5-0-260128",
                      "type": "string"
                    },
                    "usage": {
                      "properties": {
                        "generated_images": {
                          "type": "integer"
                        },
                        "output_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "图像生成成功。"
          },
          "400": {
            "description": "请求无效。最常见的情况：`size` 小于 3,686,400 像素 → `\"image size must be at least 3686400 pixels\"`。"
          },
          "401": {
            "description": "AIsa API 密钥缺失或无效。"
          },
          "404": {
            "description": "该模型不走此 endpoint。网关会返回 `model_route_not_supported`，并附上该模型实际支持的路由——参见[模型目录](/guides/models)。"
          },
          "429": {
            "description": "已达到速率限制。"
          },
          "500": {
            "description": "内部错误。"
          },
          "502": {
            "description": "无法连接上游提供商。"
          }
        },
        "summary": "生成图像（OpenAI 兼容）"
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://api.aisa.one/v1"
    }
  ]
}
