Skip to main content
POST
Generate images (legacy path)

Authorizations

Authorization
string
header
required

Use an API key created in the NinjaChat developer console.

Headers

Idempotency-Key
string

Safely retry the same logical write without duplicate billing or execution.

Required string length: 1 - 255

Body

application/json
prompt
string
required
Required string length: 1 - 4000
model
enum<string>
default:nano-banana-2

Image model ID. Legacy ninja-vision-1 resolves to seedream (Seedream 4.5); flux-pro-ultra resolves to flux-1-pro-ultra.

Available options:
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
size
enum<string>
default:1920x1920
Available options:
1920x1920,
2560x1440,
1440x2560
n
integer
default:1
Required range: 1 <= x <= 4
aspect_ratio
string
Maximum string length: 20
image
string<uri>
reference_images
string<uri>[]

Reference image URLs, in order. Use this or image, not both. The maximum depends on the model.

Required array length: 1 - 14 elements
width
integer
Required range: 256 <= x <= 2048
height
integer
Required range: 256 <= x <= 2048
storage
enum<string>
default:durable

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.

Available options:
durable,
provider

Response

Generated images and unit cost.

created
integer
required
data
object[]
required
model
string
required
Required string length: 1 - 160
provider
string
required
storage
enum<string>
required
Available options:
durable,
provider
usage
object
required
cost_usd
number
required
Required range: x >= 0
request_id
string
required
routing
object
required
cost
object
balance
string
metadata
object
images
object[]