Nano Banana API's: $0.01$0.04(75% OFF)
Menu
ImageGPT AI API

API Documentation

Transform your ideas into stunning images and videos with our powerful AI models

Direct Image Generation API Playground

Test and explore the Image Generation API with multiple models and output formats

Select Model

Endpoint

POSThttps://api.imagegpt.online/generate/text-image

Headers

Request Body

Code Sample

fetch('https://api.imagegpt.online/generate/text-image', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
  "prompt": "Photorealistic portrait of the same person (keep his real face unchanged). A man with medium curly brown hair, light skin, and soft features sits relaxed, forearms on a light blue table, holding a small white puppy with a red collar. He wears a cozy color-block knitted sweater (beige, tan, light blue, black) with ribbed neck and cuffs, a silver watch, and a turquoise-beaded bracelet. Soft diffused lighting, smooth steel-blue background, slightly elevated front angle warm, intimate, digital photo",
  "width": 512,
  "height": 512,
  "model": "FLUX-SCHNELL",
  "outputType": "binary",
  "outputFormat": "png"
})
})
  .then(response => response.blob())
  .then(blob => {
    const imageUrl = URL.createObjectURL(blob);
    console.log('Image URL:', imageUrl);
    // Display in img tag: document.getElementById('myImg').src = imageUrl;
  })
  .catch(error => console.error('Error:', error));
API Documentation

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.

POSThttps://api.imagegpt.online/generate/text-image

All requests must include your API key in the request header. Keep your API key secret and never expose it in client-side code in production.

http header
x-api-key: YOUR_API_KEY

Missing or invalid API key returns a 401 Unauthorized response.

Send a JSON body with the following fields:

ParameterTypeDefaultDescription
model*
string—Model ID to use for generation. See the model list above for all available IDs.
prompt*
string—Text description of the image you want to generate.
width
number512Output image width in pixels.
height
number512Output image height in pixels.
outputType
string"binary"Output delivery format. One of "binary" (image blob), "url" (hosted link), or "base64" (encoded string).
outputFormat
string"png"Image file format. Either "png" or "jpg".
image
string[]—Array of input image URLs (max 3). Required only for image-to-image generation.

* Required fields.

The response shape depends on the outputType you chose:

binary

outputType: "binary"

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

outputType: "url"

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

outputType: "base64"

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

A minimal working text-to-image request using the fetch API:

javascript
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));

For image-to-image, add an image array:

javascript
body: JSON.stringify({
  model: 'FLUX-KONTEXT',
  prompt: 'Same person, wearing a red jacket',
  image: ['https://example.com/input.jpg'],
  width: 512,
  height: 512,
  outputType: 'url',
  outputFormat: 'png'
})

Credits are charged per image generated. The badge next to each model shows its credit cost:

Economy
3 credits / image

Fast, lightweight models ideal for drafts and prototypes.

e.g. Flux Schnell, Z Image Turbo

Standard
10–30 credits / image

Balanced quality for everyday generation tasks.

e.g. GPT Image 1.0, Seedream, Nova Canvas

Premium
35–100 credits / image

Highest fidelity for production-quality output.

e.g. Nano Banana Pro, Seedream 4.0, Ideogram

ImageGPT prohibits NSFW, sexually explicit, adult, exploitative, deceptive, or harmful AI-generated content. Content moderation is applied to supported image and video generation.