FIM Gate Docs
API Reference

Images API

OpenAI-compatible endpoints for image generation, editing, and variations.

FIM Gate provides an OpenAI-compatible Images API with three endpoints:

EndpointMethodPurpose
/v1/images/generationsPOSTText-to-image
/v1/images/editsPOSTLocalized edits based on a source image and mask
/v1/images/variationsPOSTGenerate variations of a source image

Basics

ItemValue
Base URLhttps://api.gate.fim.ai/v1
AuthenticationAuthorization: Bearer $FIM_API_KEY header

Generate images (generations)

POST /v1/images/generations, with a JSON request body.

Request parameters

ParameterTypeRequiredDescription
modelstringYesModel ID, e.g. dall-e-3
promptstringYesText description of the image
nintegerNoNumber of images to generate, defaults to 1
sizestringNoDimensions, e.g. 1024x1024
qualitystringNoQuality tier (model-dependent)
response_formatstringNourl 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.

ParameterTypeRequiredDescription
imagefileYesThe source image
maskfileNoMask image; transparent areas mark the editable region
promptstringYesDescription of the desired edit result
nintegerNoNumber of images to generate
sizestringNoOutput 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=1024x1024

Image variations (variations)

POST /v1/images/variations, with a multipart/form-data request body; no prompt is needed.

ParameterTypeRequiredDescription
imagefileYesThe source image
nintegerNoNumber of images to generate
sizestringNoOutput dimensions
curl https://api.gate.fim.ai/v1/images/variations \
  -H "Authorization: Bearer $FIM_API_KEY" \
  -F image=@./logo.png \
  -F n=2

Tips

  • The exact fields supported by edits and variations vary by model — confirm the target model's capabilities before calling.
  • Returned image URLs typically expire, so download and store the images promptly after generation.