Table of contents
Official Content
  • This documentation is valid for:

The image API allows you to generate one or more images from a natural language prompt. Depending on the selected provider and model, you can adjust parameters such as size, quality and aspect ratio.

Check the Globant Enterprise AI API Reference for generic variables needed to use the API.

Endpoint

Method Path Description
POST /images/generations Generates one or more images from a text prompt.
POST /images/edits Edits an image using a prompt.

POST /images/generations

Generates images from a text description using the selected model and rendering settings.

Request

  • Method: POST
  • Path: $BASE_URL/images/generations
  • Headers:
    • Content-Type: application/json
    • Authorization: Bearer $GEAI_APITOKEN

Request Body

{
  "model": "string",         // e.g. "openai/gpt-image-1"
  "prompt": "string",        // Description of the desired image
  "n": integer,              // Number of images to generate (1-10 depending on model)
  "quality": "string",       // Rendering quality, e.g. "high"
  "size": "string",          // Image dimensions, e.g. "1024x1024"
  "aspectRatio": "string"   // Relationship between an image's width and height (1:1, 9:16, 16:9, 3:4, 4:3). Optional.
}

The supported models and their accepted parameters are listed in the following table.

Provider Model Supported Parameters Environment support
OpenAI openai/gpt-image-1.5 prompt
quality: 'low', 'medium' or 'high'
Beta
OpenAI openai/gpt-image-1 prompt
n: 1-10, default to 1
size: '1024x1024', '1024x1536' or '1536x1024'
quality: 'low', 'medium' or 'high'
Beta, Production
OpenAI openai/gpt-image-1-mini prompt
quality: 'low', 'medium' or 'high'
Beta, Production
OpenAI openai/dall-e-3 prompt
n: 1
size: '1024x1024', '1024x1792' or '1792x1024'
quality: 'standard' or 'hd'
Beta, Production
OpenAI openai/dall-e-2 prompt
n: 1-10, default to 1
size
Beta, Production
Azure OpenAI azure/gpt-image-1 prompt
n: 1-10, default to 1
size: '1024x1024', '1024x1536' or '1536x1024'
quality: 'low', 'medium' or 'high'
Beta, Production
Azure OpenAI azure/gpt-image-1-mini prompt
quality: 'low', 'medium' or 'high'
Beta, Production
Azure OpenAI azure/dall-e-3 prompt
n: 1
size: '1024x1024', '1024x1792' or '1792x1024'
quality: 'standard' or 'hd'
Beta, Production
Vertex AI vertex_ai/gemini-2.5-flash-image prompt
aspectRatio: '1:1', '9:16', '16:9', '3:4', '4:3', '4:5', etc.
Beta, Production
Vertex AI vertex_ai/gemini-2.5-flash-image-preview prompt
aspectRatio
Beta, Production
Vertex AI vertex_ai/gemini-3-pro-image-preview prompt
aspectRatio: '1:1', '3:2', '2:3', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9'
Beta, Production
Vertex AI vertex_ai/imagen-3.0-generate-001
vertex_ai/imagen-3.0-fast-generate-001
vertex_ai/imagen-3.0-generate-002
prompt
n: 1-4, default to 1
aspectRatio
Beta, Production
Vertex AI vertex_ai/imagen-4.0-generate-preview-06-06
vertex_ai/imagen-4.0-fast-generate-preview-06-06
prompt
n: 1-4, default to 1
aspectRatio
Beta, Production
Vertex AI vertex_ai/imagen-4.0-ultra-generate-preview-06-06 prompt
n: 1
aspectRatio
Beta, Production
xAI xai/grok-2-image-1212 prompt
n: 1-10, default to 1
Beta, Production

cURL Sample

curl -X POST "$BASE_URL/images/generations" \
-H "Authorization: Bearer $GEAI_APITOKEN" \
-H 'Content-Type: application/json' \
-d '{
  "model": "openai/gpt-image-1",
  "prompt": "generate a lovely bath basket with attractive items in it",
  "n": 1,
  "quality": "high",
  "size": "1024x1024"
}'

POST /images/edits

Edits a single image using an AI model, based on a user-provided prompt and (optionally) a mask image. Returns edited images as Amazon Simple Storage Service (S3) URLs.

Parameters

The supported models and their accepted parameters are listed in the following table.

Provider Model Supported Parameters Environment support
OpenAI openai/gpt-image-1.5 prompt
quality: 'low', 'medium' or 'high'
Beta
OpenAI openai/gpt-image-1 prompt
n: 1-10, default to 1
size: '1024x1024', '1024x1536' or '1536x1024'
quality: 'low', 'medium' or 'high'
Beta, Production
OpenAI openai/gpt-image-1-mini prompt
n: 1-10, default to 1
size: '1024x1024', '1024x1536' or '1536x1024'
quality: 'low', 'medium' or 'high'
Beta, Production
Azure OpenAI azure/gpt-image-1 prompt
n: 1-10, default to 1
size: '1024x1024', '1024x1536' or '1536x1024'
quality: 'low', 'medium' or 'high'
Beta, Production
Azure OpenAI azure/gpt-image-1-mini prompt
quality: 'low', 'medium' or 'high'
Beta, Production
Azure OpenAI azure/dall-e-3 prompt
n: 1
size: '1024x1024', '1024x1792' or '1792x1024'
quality: 'standard' or 'hd'
Beta, Production
Vertex AI vertex_ai/gemini-2.5-flash-image prompt
aspectRatio: '1:1', '9:16', '16:9', '3:4', '4:3', '4:5', etc.
Beta, Production
Vertex AI vertex_ai/gemini-3-pro-image-preview prompt
aspectRatio: '1:1', '3:2', '2:3', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9'
Beta, Production

NOTE: Although these models will remain available, new models are periodically added for these purposes. You can check the complete list of available models in the Console.

Request

  • Method: POST
  • Path: $BASE_URL/images/edits

Request Body

{
  "model": "string",      // e.g., "openai/gpt-image-1", "openai/gpt-image-1-mini"
  "prompt": "string",     // e.g., "remove background people"
  "image": "string",      // URL format e.g., "https://example.com/image.jpg"
  "size": "string",       // Image size in pixels e.g., "1024x1024"
  "n": integer            // Number of images to generate (1-10)
}

Response

{
  "created": integer,        // Unix timestamp
  "data": 
    {
      "url": "string",          // URL to the edited image
      "revised_prompt": "string", // (optional) revised prompt
      "b64_json": "string"      // (optional) base64-encoded image data
    }
// Repeats this node for each edited image
  ,
  "usage": {
    "total_tokens": integer,
    "total_cost": integer,
    "currency": "string",       // e.g., "USD"
    "prompt_tokens_details": "string",     // object or null
    "completion_tokens_details": "string" // object or null
  }
}

cURL Sample

curl -X POST "$BASE_URL/images/edits" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-image-1",
    "prompt": "remove the ball",
    "image": "https://www.reuters.com/resizer/v2/X4XAFRTDTNLN7FCKZQY663TLUQ.jpg?auth=b33090e2931bc7bd4f74df13155afd9fdba9a6a41bea66da0726b9cdf4f24da0&width=960&quality=80",
    "size": "1024x1024",
    "n": 1
  }'

See Also

Last update: December 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant