---
title: "Generate images (legacy path)"
method: POST
path: "/images"
---

# Generate images (legacy path)

`POST /images`

## Request

- Base URL: `https://www.ninjachat.ai/api/v1`
- URL: `https://www.ninjachat.ai/api/v1/images`
- Auth: HTTP bearer

Supported compatibility surface — kept working indefinitely, but not the path for new integrations. Modern equivalent: `POST /images/generations`.

Backward-compatible alias of /images/generations.

## Headers

- `Idempotency-Key` string

## Request body

- ImageGenerationRequest
  - `prompt` string, required
  - `model` 'nova-canvas' | 'runway-gen4-image-turbo' | 'seedream' | 'recraft-v3' | 'google-imagen-4' | 'nano-banana' | 'nano-banana-2' | 'nano-banana-pro' | 'flux-2-klein' | 'flux-2-pro' | 'flux-2-max' | 'flux-2-flex' | 'flux-schnell' | 'flux-kontext-pro' | 'flux-kontext-max' | 'flux-1-pro-ultra' | 'flux-1.1-pro' | 'flux-1-dev' | 'flux-1-fill' | 'qwen-image-3' | 'qwen-image-max' | 'seedream-4.5' | 'seedream-5-lite' | 'seedream-5-pro' | 'flux-2-klein-4b' | 'flux-2-klein-9b' | 'sdxl-turbo' | 'pruna-p-image' | 'wan-2.6-image' | 'nano-banana-2-lite' | 'bria-fibo' | 'bria-3.2' | 'qwen-image-edit-max' | 'wan-2.7-image-edit' | 'z-image-turbo' | 'qwen-image-2512' | 'flux-2-dev' | 'stable-diffusion-3.5-large' | 'qwen-image-edit-plus' | 'hidream-l1-fast' | 'flux-krea-dev' | 'qwen-image-edit-2511' | 'flux-kontext-dev' | 'grok-imagine' | 'grok-imagine-image-2.0' | 'grok-imagine-image-quality' | 'gpt-image-2' | 'ideogram-v3-quality' | 'ideogram-v3-turbo' | 'google-imagen-4-ultra' | 'google-imagen-4-fast' | 'luma-photon' | 'minimax-image-01' | 'ninja-vision-1' | 'flux-pro-ultra' | 'flux-dev': Image model ID. Legacy ninja-vision-1 resolves to seedream (Seedream 4.5); flux-pro-ultra resolves to flux-1-pro-ultra.
  - `size` '1920x1920' | '2560x1440' | '1440x2560'
  - `n` integer
  - `aspect_ratio` string
  - `image` string, uri
  - `reference_images` string[]: Reference image URLs, in order. Use this or image, not both. The maximum depends on the model.
  - `width` integer
  - `height` integer
  - `storage` 'durable' | 'provider': Optional; defaults to durable. durable copies the output to NinjaChat storage and returns a permanent URL. provider skips that copy for lower latency and returns the provider's temporary URL or inline base64 payload.

## Response `200`

Generated images and unit cost.

- ImageGenerationResponse
  - `cost` object
    - `this_request` string, required
    - `per_image` string
    - `per_video` string
    - `images` integer
  - `balance` string
  - `metadata` object
    - `latency_ms` number, required
    - `group` string
    - `search_depth` string
    - `results_count` integer
  - `created` integer, required
  - `data` union[], required
    - union
      - object
        - `url` string, uri, required
        - `revised_prompt` string, nullable
      - object
        - `b64_json` string, required
        - `mime_type` string, required
        - `revised_prompt` string, nullable
  - `images` union[]
    - union
      - object
        - `url` string, uri, required
        - `revised_prompt` string, nullable
      - object
        - `b64_json` string, required
        - `mime_type` string, required
        - `revised_prompt` string, nullable
  - `model` string, required
  - `provider` string, required
  - `storage` 'durable' | 'provider', required
  - `usage` object, required
    - `images_generated` integer, required
  - `cost_usd` number, required
  - `request_id` string, required
  - `routing` object, required
    - `provider_attempts` string[], required
    - `retries` integer, required

## Other responses

- `400`: Invalid or unsupported request parameter.
- `401`: Missing or invalid API key.
- `402`: Insufficient balance or project spend limit reached.
- `429`: Rate limit exceeded.
- `500`: Gateway error.

---

[API](https://skmtc.dev/ninjachat/apis/ninjachat-api.md) · [All operations](https://skmtc.dev/ninjachat/apis/ninjachat-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ninjachat/apis/ninjachat-api/revisions/fa7dfcbdcb03?raw)
