> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# Generate images

> Generate images with Seedream, Wan, gpt-image-2, and GPT Image 2.5 via the standard POST /v1/images/generations endpoint. OpenAI-compatible request shape; Seedream routes require a minimum image size of 3,686,400 pixels (e.g., 1920×1920).

The 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 `POST /v1/chat/completions` — image generation goes through this endpoint (and `POST /v1/images/edits` where noted).

## Routing at a glance

| Model | Endpoint |
| - | - |
| `seedream-5-0-260128` | **`POST /v1/images/generations`** *(this page)* |
| `wan2.7-image` / `wan2.7-image-pro` | **`POST /v1/images/generations`** *(this page)*, `POST /v1/images/edits` |
| `gpt-image-2` | **`POST /v1/images/generations`** *(this page)*, `POST /v1/images/edits` |
| `gpt-image-2.5-flare` / `gpt-image-2.5-sunburst` | **`POST /v1/images/generations`** *(this page)*, `POST /v1/images/edits` |
| Gemini-compatible models | [`POST /v1beta/models/{model}:generateContent`](https://aisa.one/docs/api-reference/chat/post_models-model-generatecontent) |

## Supported models

| Model | Billed by | Notes |
| - | - | - |
| `seedream-5-0-260128` | Per request | Min image size **3,686,400 pixels** (e.g., 1920×1920) |
| `wan2.7-image` | Per request | Also accepts `POST /v1/images/edits` |
| `wan2.7-image-pro` | Per request | Higher-quality Wan route |
| `gpt-image-2` | Per 1M tokens: input, output, cache write | See [AI Model Pricing](https://aisa.one/docs/guides/pricing.md#models) |
| `gpt-image-2.5-flare` | Per 1M tokens: input, output, cache read | GPT Image 2.5 route |
| `gpt-image-2.5-sunburst` | Per 1M tokens: input, output, cache read | GPT Image 2.5 route |

Current prices are on [aisa.one/models](https://aisa.one/models).

## Size constraint ⚠️ (Seedream routes)

Seedream's upstream enforces a minimum of **3,686,400 pixels**. Requests below that are rejected with:

```
400 InvalidParameter: image size must be at least 3686400 pixels
```

| Size | Pixels | Accepted? |
| - | - | - |
| `1024x1024` | 1,048,576 | ❌ |
| `1536x1536` | 2,359,296 | ❌ |
| `1920x1920` | 3,686,400 | ✅ (exact threshold) |
| `2048x2048` | 4,194,304 | ✅ |
| `2304x1600` | 3,686,400 | ✅ |
| `2560x1920` | 4,915,200 | ✅ |

Any aspect ratio works as long as `width × height ≥ 3,686,400`.

## Request

```bash curl theme={null}
curl -sS -X POST "https://api.aisa.one/v1/images/generations" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedream-5-0-260128",
    "prompt": "A cute red panda, ultra-detailed, cinematic lighting",
    "n": 1,
    "size": "2048x2048"
  }'
```

```python Python theme={null}
from openai import OpenAI

client = OpenAI(base_url="https://api.aisa.one/v1", api_key="sk-aisa-...")

resp = client.images.generate(
    model="seedream-5-0-260128",
    prompt="A cute red panda, ultra-detailed, cinematic lighting",
    n=1,
    size="2048x2048",
)

for item in resp.data:
    print(item.url)
```

```typescript TypeScript theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.aisa.one/v1",
  apiKey: process.env.AISA_API_KEY,
});

const resp = await client.images.generate({
  model: "seedream-5-0-260128",
  prompt: "A cute red panda, ultra-detailed, cinematic lighting",
  n: 1,
  size: "2048x2048",
});

for (const item of resp.data) {
  console.log(item.url);
}
```

### Request fields

| Field | Type | Required | Notes |
| - | - | - | - |
| `model` | string | yes | One of `seedream-5-0-260128`, `wan2.7-image`, `wan2.7-image-pro`, `gpt-image-2`, `gpt-image-2.5-flare`, `gpt-image-2.5-sunburst` |
| `prompt` | string | yes | Text description of the image to generate |
| `n` | integer | no | Number of images. A per-request model charges one request price whatever `n` is; a token-priced model charges the tokens it reports |
| `size` | string | no | `WIDTHxHEIGHT`. Seedream routes must satisfy `width × height ≥ 3,686,400`; `wan2.7-image` and `gpt-image-2` accept smaller sizes (`1024x1024` verified working) |

## Response

```json theme={null}
{
  "model": "seedream-5-0-260128",
  "created": 1776495432,
  "data": [
    {
      "url": "https://cdn.aisa.one/images/seedream/...",
      "size": "2048x2048"
    }
  ],
  "usage": {
    "generated_images": 1,
    "output_tokens": 16384,
    "total_tokens": 16384
  }
}
```

**AIsa's response adds a few extensions** over the vanilla OpenAI schema:

* `model` echoed at the root
* `data[].size` — actual dimensions of each returned image
* `usage` — as the model reports it, for example `generated_images`, `output_tokens` and `total_tokens`. Token-priced models are charged from the token counts; per-request models are charged once per request

> [!WARNING]
>
> URLs in `data[].url` are **short-lived**. Download and persist the image to your own storage before it expires.

## Common 4xx causes

* `400 InvalidParameter — image size must be at least 3686400 pixels` — `size` was too small. Use `1920x1920` or larger.
* `400 model_route_not_supported` — the model doesn't serve this endpoint (e.g., a text model like `gpt-4.1-mini`). The error body's `supported_routes` lists the routes it does serve.
* `404 model not found` — the model ID doesn't exist on the gateway (e.g., the retired `seedream-4-5-251128`). Check the [model catalog](https://aisa.one/docs/guides/models.md).
* `400 invalid_request` — malformed `size` string (e.g., `1024` instead of `1024x1024`).

See [Error Codes](https://aisa.one/docs/api-reference/errors.md) and [Rate Limits](https://aisa.one/docs/api-reference/rate-limits.md) for more.

## Related

> [card] [Model catalog](https://aisa.one/docs/guides/models.md)
>
> Current model IDs and the endpoints each one serves.

> [card] [Gemini generateContent](https://aisa.one/docs/api-reference/chat/post_models-model-generatecontent.md)
>
> Gemini-compatible generateContent endpoint.

> [card] [Media Gen skill](https://aisa.one/docs/agent-skills/media-gen.md)
>
> Agent skill that wraps image + video generation.

## Request contract

* **Method and path:** POST /v1/images/generations
* **Availability:** enabled
* **Request URL template:** `https://api.aisa.one/v1/images/generations`
* **X-AISA-Cost-Mode:** header; optional

[Complete OpenAPI definition](https://aisa.one/docs/openapi/media-generation.json)

Effective request declaration (including authentication and referenced schemas):

```json theme={null}
{
  "operationId": "createImageGeneration",
  "method": "POST",
  "path": "/v1/images/generations",
  "servers": [
    {
      "url": "https://api.aisa.one"
    }
  ],
  "parameters": [
    {
      "description": "Return a free, read-only cost quote for this caller and payload instead of generating.",
      "in": "header",
      "name": "X-AISA-Cost-Mode",
      "schema": {
        "enum": [
          "quote"
        ],
        "type": "string"
      }
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "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": {
            "image": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Reference image(s) for models that start from a picture, as an https or data: URL."
            },
            "model": {
              "description": "An image model from GET /v1/models, for example seedream-5-0-260128, wan2.7-image or gpt-image-2.",
              "minLength": 1,
              "type": "string"
            },
            "n": {
              "default": 1,
              "description": "Number of images, for models that support more than one.",
              "minimum": 1,
              "type": "integer"
            },
            "prompt": {
              "description": "Text description of the image to generate.",
              "minLength": 1,
              "type": "string"
            },
            "size": {
              "description": "WIDTHxHEIGHT, for example 2048x2048. Accepted sizes depend on the model.",
              "example": "2048x2048",
              "type": "string"
            }
          },
          "required": [
            "model",
            "prompt"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "x-aisa-status": "enabled",
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
```

## Cost and request rules

Price depends on the selected model. Fixed-price models charge once per request, regardless of n; token-priced models charge for actual token usage. Your account price may differ; use a request quote where supported.


## OpenAPI

````yaml openapi/media-generation.json POST /v1/images/generations
openapi: 3.1.0
info:
  description: >-
    Image and video generation on AIsa models. The model field selects the
    model; GET /v1/models lists the enabled image and video models and the
    routes each one serves.
  title: Media Generation
  version: '1'
  x-aisa-capabilities:
    idempotency: Idempotency-Key
    max_price: X-AISA-Max-Price-USD
    quote:
      header: X-AISA-Cost-Mode
      value: quote
  x-aisa-catalogs:
    media-generation:
      description: >-
        Image and video generation on AIsa models. The model field selects the
        model; GET /v1/models lists the enabled image and video models and the
        routes each one serves.
      title: Media Generation
      x-aisa-capabilities:
        idempotency: Idempotency-Key
        max_price: X-AISA-Max-Price-USD
        quote:
          header: X-AISA-Cost-Mode
          value: quote
      x-aisa-document:
        facts_hash: 91bf641454e0de177731cf163176d280d129e69966cbcc50fec1085b586240bc
        generator_version: '3'
        protocol_version: '1'
        schema_version: '1'
      x-aisa-plans:
        builder: 1
        display_plan: payg
        payg: 1
        similarweb_payg: 1
        team: 1
        version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-configured-paths:
    - /v1/images/generations
    - /v1/models
    - /v1/models/{model}
    - /v1/video/generations
    - /v1/video/generations/{task_id}
  x-aisa-document:
    composer_version: '31'
    document_hash: sha256:57822a7aaff281af1eafe18f7aa610c6cd83e7b77a5df5b713b9d88d6f8cf2d2
    facts_hash: 91bf641454e0de177731cf163176d280d129e69966cbcc50fec1085b586240bc
    generator_version: '3'
    protocol_version: '1'
    response_pending: []
    schema_version: '1'
  x-aisa-plans:
    builder: 1
    display_plan: payg
    payg: 1
    similarweb_payg: 1
    team: 1
    version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-provider: media-generation
servers:
  - url: https://api.aisa.one
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      summary: Generate images
      description: >-
        Generate images with the OpenAI-compatible images-generations endpoint.


        **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`.


        OpenAI-compatible image generation. The gateway requires model and
        resolves it from the model catalog; the remaining fields are forwarded
        to the selected model, which validates them. Accepted sizes are
        model-specific (Seedream requires at least 3,686,400 pixels, for example
        2048x2048). Images are returned as url or b64_json, as the model
        produces them. With X-AISA-Cost-Mode: quote the route returns a
        cost_estimate instead and generates nothing.
      operationId: createImageGeneration
      parameters:
        - description: >-
            Return a free, read-only cost quote for this caller and payload
            instead of generating.
          in: header
          name: X-AISA-Cost-Mode
          schema:
            enum:
              - quote
            type: string
      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:
                image:
                  anyOf:
                    - type: string
                    - items:
                        type: string
                      type: array
                  description: >-
                    Reference image(s) for models that start from a picture, as
                    an https or data: URL.
                model:
                  description: >-
                    An image model from GET /v1/models, for example
                    seedream-5-0-260128, wan2.7-image or gpt-image-2.
                  minLength: 1
                  type: string
                'n':
                  default: 1
                  description: Number of images, for models that support more than one.
                  minimum: 1
                  type: integer
                prompt:
                  description: Text description of the image to generate.
                  minLength: 1
                  type: string
                size:
                  description: >-
                    WIDTHxHEIGHT, for example 2048x2048. Accepted sizes depend
                    on the model.
                  example: 2048x2048
                  type: string
              required:
                - model
                - prompt
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: true
                properties:
                  created:
                    type: integer
                  data:
                    items:
                      additionalProperties: true
                      properties:
                        b64_json:
                          description: Base64-encoded image bytes.
                          type: string
                        revised_prompt:
                          type: string
                        url:
                          description: Temporary URL of the image.
                          type: string
                      type: object
                    type: array
                required:
                  - data
                type: object
          description: Generated images.
          headers:
            X-AISA-Customer-Cost-Micros-USD:
              description: >-
                The charge settled for this request, in micro-USD. Omitted for
                requests paid by x402 or MPP, which report payment through that
                protocol.
              schema:
                minimum: 0
                type: integer
        default:
          description: >-
            Validation, authentication, balance or provider error. Provider
            refusals, such as content checks, keep their 4xx status.
components:
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.