GPT Image 2
GPT Image 2 : qualité photoréaliste, rendu de texte précis et édition au pixel près
Fonctionnalités
- Génération d'image à partir de texte
- Édition image à image (jusqu'à 4 images de référence)
- Qualité photoréaliste et typographie précise
- Sortie d'une seule image (n=1)
Tarification
| Resolution | Credits |
|---|---|
| 1k | 3 (~$0.03) |
| 2k | 4 (~$0.04) |
| 4k | 5 (~$0.06) |
Point de terminaison
POST
/api/v1/images/generateParamètres
| Paramètre | Type | Obligatoire | Description |
|---|---|---|---|
| model | string | Obligatoire | Must be "gpt-image-2" |
| type | string | Facultatif | "text-to-image" or "image-to-image" (default: text-to-image) |
| prompt | string | Obligatoire | Text description (3–20000 chars) |
| image_urls | string[] | Facultatif | Required for image-to-image. Up to 4 reference image URLs |
| input_image | string | Facultatif | Deprecated. Alias for image_urls[0] |
| image_size | string | Facultatif | Optional aspect ratio: "1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5", "2:1", "1:2", "21:9", or "9:21". Required for 4k; auto/default is not allowed with 4k. |
| resolution | string | Facultatif | Optional output resolution: "1k", "2k", or "4k" (default: "1k") |
| num_images | number | Facultatif | Must be 1 (gpt-image-2 always returns a single image) |
Exemple de Requête (Texte vers Image)
{
"model": "gpt-image-2",
"resolution": "2k",
"prompt": "A hand-drawn illustrated greeting card with the text \"Hello, world!\" in serif letters"
}Exemple de Requête (Image vers Image)
{
"model": "gpt-image-2",
"type": "image-to-image",
"resolution": "2k",
"prompt": "Place the subject on a beach at golden hour, keep facial features identical",
"image_urls": ["https://tempfile.aiquickdraw.com/workers/nano/image_1772780968156_ygk0zm.png"]
}Exemple de réponse
{
"success": true,
"data": {
"task_id": "task_gpt2_123",
"credits_used": 4,
"remaining_credits": 496,
"model": "gpt-image-2"
}
}Exemples de Code (Texte vers Image)
curl -X POST https://gateway.bananapro.site/api/v1/images/generate \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"resolution": "2k",
"prompt": "A hand-drawn illustrated greeting card with the text \"Hello, world!\" in serif letters"
}'Exemples de Code (Image vers Image)
curl -X POST https://gateway.bananapro.site/api/v1/images/generate \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"type": "image-to-image",
"resolution": "2k",
"prompt": "Place the subject on a beach at golden hour, keep facial features identical",
"image_urls": ["https://tempfile.aiquickdraw.com/workers/nano/image_1772780968156_ygk0zm.png"]
}'