API Reference
Images API
OpenAI-compatible endpoints for image generation, editing, and variations.
FIM Gate provides an OpenAI-compatible Images API with three endpoints:
| Endpoint | Method | Purpose |
|---|---|---|
/v1/images/generations | POST | Text-to-image |
/v1/images/edits | POST | Localized edits based on a source image and mask |
/v1/images/variations | POST | Generate variations of a source image |
Basics
| Item | Value |
|---|---|
| Base URL | https://api.gate.fim.ai/v1 |
| Authentication | Authorization: Bearer $FIM_API_KEY header |
Generate images (generations)
POST /v1/images/generations, with a JSON request body.
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID, e.g. dall-e-3 |
prompt | string | Yes | Text description of the image |
n | integer | No | Number of images to generate, defaults to 1 |
size | string | No | Dimensions, e.g. 1024x1024 |
quality | string | No | Quality tier (model-dependent) |
response_format | string | No | url or b64_json |
Currently available image models: dall-e-2, dall-e-3, gpt-image-1, gemini-2.5-flash-image, gemini-3-pro-image-preview, gemini-3.1-flash-image-preview. See gate.fim.ai/pricing for the full list.
Example request
curl https://api.gate.fim.ai/v1/images/generations \
-H "Authorization: Bearer $FIM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "A classical garden after snowfall, ink wash painting style",
"n": 1,
"size": "1024x1024"
}'Example response
{
"created": 1718000000,
"data": [
{ "url": "https://example.com/generated/xxxx.png" }
]
}Edit images (edits)
POST /v1/images/edits, with a multipart/form-data request body.
| Parameter | Type | Required | Description |
|---|---|---|---|
image | file | Yes | The source image |
mask | file | No | Mask image; transparent areas mark the editable region |
prompt | string | Yes | Description of the desired edit result |
n | integer | No | Number of images to generate |
size | string | No | Output dimensions |
curl https://api.gate.fim.ai/v1/images/edits \
-H "Authorization: Bearer $FIM_API_KEY" \
-F image=@./room.png \
-F mask=@./room-mask.png \
-F prompt="Replace the sky outside the window with a sunset glow" \
-F n=1 \
-F size=1024x1024Image variations (variations)
POST /v1/images/variations, with a multipart/form-data request body; no prompt is needed.
| Parameter | Type | Required | Description |
|---|---|---|---|
image | file | Yes | The source image |
n | integer | No | Number of images to generate |
size | string | No | Output dimensions |
curl https://api.gate.fim.ai/v1/images/variations \
-H "Authorization: Bearer $FIM_API_KEY" \
-F image=@./logo.png \
-F n=2Tips
- The exact fields supported by
editsandvariationsvary by model — confirm the target model's capabilities before calling. - Returned image URLs typically expire, so download and store the images promptly after generation.