{
  "openapi": "3.0.3",
  "info": {
    "title": "OpenAI-Compatible Image Generations",
    "version": "1.0.0",
    "description": "Standard OpenAI-compatible `POST /v1/images/generations` endpoint. As of July 28, 2026 it serves `seedream-5-0-260128`, `wan2.7-image`, `wan2.7-image-pro`, and `gpt-image-2`. The older `seedream-4-5-251128` is routed through [`/v1/chat/completions`](/api-reference/chat/post_chat-completions-image-generation) instead, and Gemini-compatible `generateContent` requests use [`/v1beta/models/{model}:generateContent`](/api-reference/chat/post_models-model-generatecontent)."
  },
  "servers": [
    {
      "url": "https://api.aisa.one/v1"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "AISA API Key"
      }
    }
  },
  "paths": {
    "/images/generations": {
      "post": {
        "summary": "Generate images (OpenAI-compatible)",
        "description": "Generate images with the OpenAI-compatible images-generations endpoint.\n\n**Size constraint (Seedream routes only).** Seedream's upstream requires a minimum of **3,686,400 pixels** per image. Requests below that return `400 InvalidParameter: image size must be at least 3686400 pixels`. Wan and `gpt-image-2` routes accept smaller sizes — `1024x1024` is verified working for `wan2.7-image`.",
        "operationId": "createImageGeneration",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "enum": [
                      "seedream-5-0-260128",
                      "wan2.7-image",
                      "wan2.7-image-pro",
                      "gpt-image-2"
                    ],
                    "description": "Image generation model. `seedream-5-0-260128` ($0.035/request), `wan2.7-image` ($0.030/request), `wan2.7-image-pro` ($0.075/request), or `gpt-image-2` ($0.03/request or $0.05 per 1024×1024 image)."
                  },
                  "prompt": {
                    "type": "string",
                    "description": "Text description of the image to generate."
                  },
                  "n": {
                    "type": "integer",
                    "minimum": 1,
                    "default": 1,
                    "description": "Number of images to generate. Each image is billed separately at the per-image rate."
                  },
                  "size": {
                    "type": "string",
                    "description": "Image dimensions as `WIDTHxHEIGHT`. Seedream routes require `width × height ≥ 3,686,400` (e.g. `1920x1920`, `2048x2048`); Wan and `gpt-image-2` accept smaller sizes such as `1024x1024`.",
                    "example": "2048x2048"
                  }
                }
              },
              "examples": {
                "basic": {
                  "summary": "Single 2K image",
                  "value": {
                    "model": "seedream-5-0-260128",
                    "prompt": "A cute red panda, ultra-detailed, cinematic lighting",
                    "n": 1,
                    "size": "2048x2048"
                  }
                },
                "minimum_size": {
                  "summary": "Exactly at minimum allowed size (1920×1920)",
                  "value": {
                    "model": "seedream-5-0-260128",
                    "prompt": "A futuristic cyberpunk city, neon lights, rainy night, 8k",
                    "n": 1,
                    "size": "1920x1920"
                  }
                },
                "batch": {
                  "summary": "Four candidates for selection",
                  "value": {
                    "model": "seedream-5-0-260128",
                    "prompt": "Oil painting of a rolling hillside at sunset",
                    "n": 4,
                    "size": "2048x2048"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Images generated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "model": {
                      "type": "string",
                      "example": "seedream-5-0-260128"
                    },
                    "created": {
                      "type": "integer",
                      "example": 1776495432
                    },
                    "data": {
                      "type": "array",
                      "description": "One entry per generated image.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "Short-lived URL to the generated image. Download and persist it; the URL expires."
                          },
                          "size": {
                            "type": "string",
                            "description": "Actual dimensions of the returned image."
                          }
                        }
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "generated_images": {
                          "type": "integer"
                        },
                        "output_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "model": "seedream-5-0-260128",
                  "created": 1776495432,
                  "data": [
                    {
                      "url": "https://cdn.aisa.one/images/seedream/20260418-abc.png",
                      "size": "2048x2048"
                    }
                  ],
                  "usage": {
                    "generated_images": 1,
                    "output_tokens": 16384,
                    "total_tokens": 16384
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. Most common: `size` smaller than 3,686,400 pixels → `\"image size must be at least 3686400 pixels\"`."
          },
          "401": {
            "description": "Missing or invalid AIsa API key."
          },
          "404": {
            "description": "The model isn't routed through this endpoint. The gateway returns `model_route_not_supported` with the model's actual supported routes — see the [model catalog](/guides/models)."
          },
          "429": {
            "description": "Rate limit hit."
          },
          "500": {
            "description": "Internal error."
          },
          "502": {
            "description": "Upstream provider unreachable."
          }
        }
      }
    }
  }
}
