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 Glob.AI OS API Reference for generic variables needed to use the API.
| Method |
Path |
Description |
| POST |
/images/generations |
Generates one or more images from a text prompt. |
| POST |
/images/edits |
Edits an image using a prompt. |
Generates images from a text description using the selected model and rendering settings.
- Method: POST
- Path: $BASE_URL/images/generations
- Headers:
- Content-Type: application/json
- Authorization: Bearer $GEAI_APITOKEN
- response-file-format: Default (no header, returns the uploaded file metadata, including the repository file ID); url (returns the generated file URL stored in the S3 repository); binary (returns the generated file as binary data).
{
"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.
"background": "string", // transparent or opaque
}
The supported models and their accepted parameters are listed in the following table.
| Provider |
Model |
Supported Parameters |
Environment support |
| OpenAI |
openai/gpt-image-2 |
prompt n: 1-10, default to 1 size: '1024x1024', '1024x1536' or '1536x1024' quality: 'low', 'medium' or 'high' |
Beta, Production |
| OpenAI |
openai/gpt-image-1.5 |
prompt n: 1-10, default to 1 size: '1024x1024', '1024x1536' or '1536x1024' quality: 'low', 'medium' or 'high' background: 'transparent' or 'opaque' |
Beta, Production |
| OpenAI |
openai/gpt-image-1 |
prompt n: 1-10, default to 1 size: '1024x1024', '1024x1536' or '1536x1024' quality: 'low', 'medium' or 'high' background: 'transparent' or 'opaque' |
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' background: 'transparent' or 'opaque' |
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' background: 'transparent' or 'opaque' |
Beta, Production |
| Azure OpenAI |
azure/gpt-image-1-mini |
prompt n: 1-10, default to 1 size: '1024x1024', '1024x1536' or '1536x1024' quality: 'low', 'medium' or 'high' background: 'transparent' or 'opaque' |
Beta, Production |
| Microsoft Foundry |
azure_ai_foundry/gpt-image-2 |
prompt n: 1-10, default to 1 size: '1024x1024', '1024x1536' or '1536x1024' quality: 'low', 'medium' or 'high' |
Beta, Production |
| Vertex AI |
vertex_ai/gemini-3.1-flash-image (Nano Banana 2) |
prompt aspectRatio: '1:1', '3:2', '2:3', '3:4', '4:1', '4:3', '4:5', '5:4', '8:1', '9:16', '16:9', '21:9' n: 1 |
Beta, Production |
| Vertex AI |
vertex_ai/gemini-2.5-flash-image (Nano Banana) |
prompt aspectRatio: '1:1', '9:16', '16:9', '3:4', '4:3', '4:5' |
Beta, Production |
| Vertex AI |
vertex_ai/gemini-3-pro-image (Nano Banana Pro) |
prompt aspectRatio: '1:1', '3:2', '2:3', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9' |
Beta, Production |
| xAI |
xai/grok-imagine-image |
prompt n: 1-10, default to 1 |
Beta, Production |
| Azure AI Foundry |
azure_ai_foundry/FLUX.2-pro |
prompt n: 1 size: '1024x1024', '1024x1536', '1536x1024' or '2048x2048' aspectRatio: '21:9', '16:9', '4:3', '1:1', '3:4', '9:16', '9:21' |
Beta |
| Azure AI Foundry |
azure_ai_foundry/FLUX-1.1-pro |
prompt n: 1 size: '1024x1024', '1024x1440' or '1440x1024' aspectRatio: '21:9', '16:9', '4:3', '1:1', '3:4', '9:16', '9:21' |
Beta |
| Azure AI Foundry |
azure_ai_foundry/FLUX.1-Kontext-pro |
prompt n: 1 size: '1024x1024', '1024x1440' or '1440x1024' aspectRatio: '21:9', '16:9', '4:3', '1:1', '3:4', '9:16', '9:21' |
Beta |
{
200 OK - Download File as Binary
}
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"
}'
curl -X POST "$BASE_URL/images/generations" \
-H "Authorization: Bearer $GEAI_APITOKEN" \
-H 'Content-Type: application/json' \
-H "response-file-fornat: binary" \
-d '{
"model": "openai/gpt-image-1",
"prompt": "generate a lovely bath basket with attractive items in it",
"n": 1,
"quality": "high",
"size": "1024x1024"
}'
curl -X POST "$BASE_URL/images/edits" \
-H "Authorization: Bearer $GEAI_APITOKEN" \
-H "Content-Type: application/json" \
-H "response-file-fornat: binary" \
-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
}'
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.
- Method: POST
- Path: $BASE_URL/images/edits
- Headers:
- Content-Type: application/json
- Authorization: Bearer $GEAI_APITOKEN
- response-file-format: Default (no header, returns the uploaded file metadata, including the repository file ID); url (returns the generated file URL stored in the S3 repository); binary (returns the generated file as binary data).
{
"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)
}
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, Production |
| 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 |
| Vertex AI |
vertex_ai/gemini-2.5-flash-image |
prompt aspectRatio: '1:1', '9:16', '16:9', '3:4', '4:3', '4:5' |
Beta, Production |
| Vertex AI |
vertex_ai/gemini-3-pro-image |
prompt aspectRatio: '1:1', '3:2', '2:3', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9' |
Beta, Production |
| Azure AI Foundry |
azure_ai_foundry/FLUX.2-pro |
prompt n: 1 size: '1024x1024', '1024x1536', '1536x1024' or '2048x2048' aspectRatio: '21:9', '16:9', '4:3', '1:1', '3:4', '9:16', '9:21' |
Beta |
{
200 OK - Download File as Binary
}
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
}'
curl -X POST "$BASE_URL/images/edits" \
-H "Authorization: Bearer $GEAI_APITOKEN" \
-H "Content-Type: application/json" \
-H "response-file-fornat: url" \
-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
}'
curl -X POST "$BASE_URL/images/edits" \
-H "Authorization: Bearer $GEAI_APITOKEN" \
-H "Content-Type: application/json" \
-H "response-file-fornat: binary" \
-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
}'