GPT Image 2
GPT Image 2: calidad fotorrealista, renderizado preciso de texto y edición a nivel de píxel
Características
- Generación de texto a imagen
- Edición de imagen a imagen (hasta 4 imágenes de referencia)
- Calidad fotorrealista y tipografía precisa
- Salida de una sola imagen (n=1)
Precios
| Resolution | Credits |
|---|---|
| 1k | 3 (~$0.03) |
| 2k | 4 (~$0.04) |
| 4k | 5 (~$0.06) |
Punto de conexión
POST
/api/v1/images/generateParámetros
| Parámetro | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| model | string | Necesario | Must be "gpt-image-2" |
| type | string | Opcional | "text-to-image" or "image-to-image" (default: text-to-image) |
| prompt | string | Necesario | Text description (3–20000 chars) |
| image_urls | string[] | Opcional | Required for image-to-image. Up to 4 reference image URLs |
| input_image | string | Opcional | Deprecated. Alias for image_urls[0] |
| image_size | string | Opcional | 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 | Opcional | Optional output resolution: "1k", "2k", or "4k" (default: "1k") |
| num_images | number | Opcional | Must be 1 (gpt-image-2 always returns a single image) |
Ejemplo de Solicitud (Texto a Imagen)
{
"model": "gpt-image-2",
"resolution": "2k",
"prompt": "A hand-drawn illustrated greeting card with the text \"Hello, world!\" in serif letters"
}Ejemplo de Solicitud (Imagen a Imagen)
{
"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"]
}Ejemplo de Respuesta
{
"success": true,
"data": {
"task_id": "task_gpt2_123",
"credits_used": 4,
"remaining_credits": 496,
"model": "gpt-image-2"
}
}Ejemplos de Código (Texto a Imagen)
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"
}'Ejemplos de Código (Imagen a Imagen)
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"]
}'