Generate images

storage is optional and defaults to durable, which copies output to NinjaChat storage and returns a permanent URL. Set storage=provider to skip that copy for lower latency; provider mode returns either a temporary provider URL or b64_json plus mime_type.

post/images/generations

Request

  • Base URL: https://www.ninjachat.ai/api/v1
  • URL: https://www.ninjachat.ai/api/v1/images/generations
  • Auth: HTTP bearer

Headers

Idempotency-Keystring

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

Request body

promptstring 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'
ninteger
aspect_ratiostring
imagestring uri
reference_imagesstring[]

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

widthinteger
heightinteger
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

Generated images and unit cost.

balancestring
createdinteger required
modelstring required
providerstring required
storage'durable' | 'provider' required
cost_usdnumber required
request_idstring required

Changes

No recorded changes to this operation across all 1 revision of this API.