const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>'})
};
fetch('https://www.ninjachat.ai/api/v1/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://www.ninjachat.ai/api/v1/images"
payload = { "prompt": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://www.ninjachat.ai/api/v1/images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>"
}
'{
"created": 123,
"data": [
{
"url": "<string>",
"revised_prompt": "<string>"
}
],
"model": "<string>",
"provider": "<string>",
"storage": "durable",
"usage": {
"images_generated": 1
},
"cost_usd": 1,
"request_id": "<string>",
"routing": {
"provider_attempts": [
"<string>"
],
"retries": 1
},
"cost": {
"this_request": "<string>",
"per_image": "<string>",
"per_video": "<string>",
"images": 1
},
"balance": "<string>",
"metadata": {
"latency_ms": 1,
"group": "<string>",
"search_depth": "<string>",
"results_count": 1
},
"images": [
{
"url": "<string>",
"revised_prompt": "<string>"
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Generate images (legacy path)
Supported compatibility surface — kept working indefinitely, but not the path for new integrations. Modern equivalent: POST /images/generations.
Backward-compatible alias of /images/generations.
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>'})
};
fetch('https://www.ninjachat.ai/api/v1/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://www.ninjachat.ai/api/v1/images"
payload = { "prompt": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://www.ninjachat.ai/api/v1/images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>"
}
'{
"created": 123,
"data": [
{
"url": "<string>",
"revised_prompt": "<string>"
}
],
"model": "<string>",
"provider": "<string>",
"storage": "durable",
"usage": {
"images_generated": 1
},
"cost_usd": 1,
"request_id": "<string>",
"routing": {
"provider_attempts": [
"<string>"
],
"retries": 1
},
"cost": {
"this_request": "<string>",
"per_image": "<string>",
"per_video": "<string>",
"images": 1
},
"balance": "<string>",
"metadata": {
"latency_ms": 1,
"group": "<string>",
"search_depth": "<string>",
"results_count": 1
},
"images": [
{
"url": "<string>",
"revised_prompt": "<string>"
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
Use an API key created in the NinjaChat developer console.
Headers
Safely retry the same logical write without duplicate billing or execution.
1 - 255Body
1 - 4000Image model ID. Legacy ninja-vision-1 resolves to seedream (Seedream 4.5); flux-pro-ultra resolves to flux-1-pro-ultra.
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 1920x1920, 2560x1440, 1440x2560 1 <= x <= 420Reference image URLs, in order. Use this or image, not both. The maximum depends on the model.
1 - 14 elements256 <= x <= 2048256 <= x <= 2048Optional; 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.
durable, provider Response
Generated images and unit cost.
- Option 1
- Option 2
Show child attributes
Show child attributes
1 - 160durable, provider Show child attributes
Show child attributes
x >= 0Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
- Option 1
- Option 2
Show child attributes
Show child attributes