Skip to content

Images

This section covers endpoints to create images, edit images with a mask, and generate variations, following the same patterns as OpenAI’s Images API.


POST https://api.aifoundryhub.com/v1/images/generations

Generates one or more images from a text prompt.

Terminal window
curl -X POST "https://api.aifoundryhub.com/v1/images/generations" \
-H "Authorization: Bearer $AI_FOUNDRY_HUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux.1-pro",
"prompt": "A cozy reading nook with warm morning light, cinematic, high detail",
"size": "1024x1024",
"n": 1
}'

An images response object with one entry per generated image.

{
"created": 1714569952,
"data": [
{ "url": "https://cdn.example.com/ai/abc123.png" }
]
}
{
"created": 1714569952,
"data": [
{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }
]
}

POST https://api.aifoundryhub.com/v1/images/edits

Edits an existing image based on a mask, infilling the masked regions according to the prompt.

Terminal window
curl -X POST "https://api.aifoundryhub.com/v1/images/edits" \
-H "Authorization: Bearer $AI_FOUNDRY_HUB_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F model=flux.1-pro \
-F image=@/path/to/original.png \
-F mask=@/path/to/mask.png \
-F prompt='Add a steaming cup of coffee on the table' \
-F size=1024x1024

An images response object with one entry per edited image.


POST https://api.aifoundryhub.com/v1/images/variations

Generates one or more new images based on the style and content of an input image.

Terminal window
curl -X POST "https://api.aifoundryhub.com/v1/images/variations" \
-H "Authorization: Bearer $AI_FOUNDRY_HUB_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F model=flux.1-pro \
-F image=@/path/to/source.png \
-F n=2 \
-F size=512x512

An images response object with one entry per variation.