Skip to main content

Image Generation API

A unified REST API to generate images using 15+ AI models — supporting text-to-image and image-to-image generation with multiple output formats, all through a single endpoint with a credit-based pricing system.

Endpoints​

MethodPathDescription
POST/generate/text-imageGenerate an image from a text prompt.
POST/generate/image-imageGenerate an image from one or more input images (image-to-image).

Parameters​

Request body fields for /generate/text-image:

ParameterTypeRequiredDefaultDescription
modelstringYes—Model ID to use for generation. See the model list below for all available IDs.
promptstringYes—Text description of the image you want to generate.
widthnumberNo512Output image width in pixels.
heightnumberNo512Output image height in pixels.
outputTypestringNo"binary"Output delivery format. One of "binary" (image blob), "url" (hosted link), or "base64" (encoded string).
outputFormatstringNo"png"Image file format. Either "png" or "jpg".
imagestring[]No—Array of input image URLs (max 3). Required only for image-to-image generation.

Response example​

binary

const blob = await response.blob();
const url = URL.createObjectURL(blob);

url

{
"success": true,
"taskId": "imagegpt_img-...",
"url": "https://...",
"creditsDeducted": 3
}

base64

{
"success": true,
"taskId": "imagegpt_img-...",
"base64": "/9j/4QWm...",
"creditsDeducted": 3
}

Examples​

Text-to-image (fetch)
fetch('https://api.imagegpt.online/generate/text-image', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
model: 'FLUX-SCHNELL',
prompt: 'A futuristic city at sunset, photorealistic',
width: 512,
height: 512,
outputType: 'url',
outputFormat: 'png'
})
})
.then(res => res.json())
.then(data => console.log('Image URL:', data.url));
Image-to-image (body)
body: JSON.stringify({
model: 'FLUX-KONTEXT',
prompt: 'Turn this photo into an oil painting',
image: ['https://example.com/input.jpg'],
outputType: 'url'
})

Pricing​

Charged in credits per image. Each image deducts the credit value shown for the selected model.

Models​

Each model has its own page with parameters, examples, and a live playground.

ModelModel IDCredits / image
Flux SchnellFLUX-SCHNELL3
Z Image TurboZIMAGE-TURBO5
GPT Image 1.0GPT-IMAGE-110
GPT Image 1.5GPT-IMAGE-1.525
GPT Image 2.0GPT-IMAGE-235
GPT Image 2.5 FlareGPT-IMAGE-2.5-FLARE35
Nano BananaNANOBANANA10
Nano Banana 2 LiteNANOBANANA-2-LITE10
Nano Banana 2NANOBANANA-240
Nano Banana 2.1NANOBANANA-2.120
Nano Banana ProNANOBANANA-PRO100
SeedreamSEEDREAM25
Seedream 4.0SEEDREAM 4.035
Seedream Lite 5.0SEEDREAM LITE 5.035
IdeogramIDEOGRAM35
Qwen ImageQWEN-IMAGE30
Flux KontextFLUX-KONTEXT25
Wan Image 2.7WAN-IMAGE-2.740
Grok ImagineGROK-IMAGE20