Generate images (legacy path)
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>",
"usage": {
"images_generated": 1
},
"cost_usd": 1,
"request_id": "<string>",
"routing": {
"provider_attempts": [
"<string>"
],
"retries": 1
}
}{
"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>"
}
}Legacy (supported)
Generate images (legacy path)
Backward-compatible alias of /images/generations.
POST
/
images
Generate images (legacy path)
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>",
"usage": {
"images_generated": 1
},
"cost_usd": 1,
"request_id": "<string>",
"routing": {
"provider_attempts": [
"<string>"
],
"retries": 1
}
}{
"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.
Required string length:
1 - 255Body
application/json
Required string length:
1 - 4000Available 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-2511, flux-kontext-dev, grok-imagine, grok-imagine-image-2.0, grok-imagine-image-quality, gpt-image-2 Available options:
1920x1920, 2560x1440, 1440x2560 Required range:
1 <= x <= 4Maximum string length:
20Required range:
256 <= x <= 2048Required range:
256 <= x <= 2048Response
Generated images and unit cost.