API Nano Banana : 0,01 $0,04 $(75 % DE RÉDUCTION)
Menu
ImageGPT AI API

Documentation API

Transformez vos idées en images et vidéos époustouflantes grâce à nos puissants modèles IA

Terrain de jeu API de génération d'images directe

Testez et explorez l'API de génération d'images avec plusieurs modèles et formats de sortie

Sélectionner un modèle

Point de terminaison

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

En-têtes

Corps de la requête

Exemple de code

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));
Documentation API

API de Génération d'Images

Une API REST unifiée pour générer des images avec 15+ modèles d'IA — texte vers image et image vers image avec multiples formats de sortie, via un seul endpoint avec tarification par crédits.

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

Toutes les requêtes doivent inclure votre clé API dans l'en-tête. Gardez-la secrète et ne l'exposez jamais côté client en production.

http header
x-api-key: YOUR_API_KEY

Une clé API manquante ou invalide renvoie une réponse 401 Unauthorized .

Envoyez un corps JSON avec les champs suivants :

ParamètreTypeDéfautDescription
model*
string—ID du modèle pour la génération.
prompt*
string—Description textuelle de l'image à générer.
width
number512Largeur de l'image en pixels.
height
number512Hauteur de l'image en pixels.
outputType
string"binary"Format de livraison : "binary", "url" ou "base64".
outputFormat
string"png"Format de fichier image : "png" ou "jpg".
image
string[]—Tableau d'URLs d'images (max 3). Requis uniquement pour image vers image.

* Champs obligatoires.

La forme de la réponse dépend du outputType choisi :

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
}

Une requête minimale texte vers image avec 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));

Pour image vers image, ajoutez un image tableau :

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'
})

Les crédits sont facturés par image générée. Le badge indique le coût :

Économique
3 crédits / image

Modèles rapides et légers pour les brouillons.

e.g. Flux Schnell, Z Image Turbo

Standard
10–30 crédits / image

Qualité équilibrée pour l'usage quotidien.

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

Premium
35–100 crédits / image

Fidélité maximale pour la production.

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

ImageGPT interdit le contenu IA généré à caractère NSFW, sexuellement explicite, pour adultes, exploiteur, trompeur ou nuisible. La modération de contenu est appliquée à la génération d'images et de vidéos prise en charge.