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

The image API allows you to generate one or several 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 Generates one or more images from a text prompt.

POST /images

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

Request

  • Method: POST
  • Path: $BASE_URL/image
  • Headers:
    Content-Type: application/json
    Authorization: Bearer $SAIA_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" (allowed values: 1024x1024, 1024x1536 or 1536x1024).
  "aspect_ratio": "string"   // Relationship between an image’s width and height (1:1, 9:16, 16:9, 3:4, 4:3). Optional.
}

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

Provider Model Supported Parameters Environment support
OpenAI openai/gpt-image-1 prompt
n: 1-10, default to 1
size
quality: 'low', 'medium' or 'high'
Beta, Production
OpenAI openai/dall-e-2 prompt
n: 1-10, default to 1
size
Beta, Production
OpenAI openai/dall-e-3 prompt
n: 1
size
quality: 'standard' or 'hd'
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
aspect_ratio
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" \
-H 'Authorization: Bearer $SAIA_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"
}'

See Also

OpenAI
Google Vertex AI
xAI

Availability

Since March 2025 release.

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