Skip to main content
POST
/
v1
/
images
/
edits
Edit an existing image
curl --request POST \
  --url https://api.infery.ai/v1/images/edits \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "image_base64": "<string>",
  "image_mime_type": "image/png",
  "mask_base64": "<string>",
  "mask_mime_type": "image/png",
  "n": 1,
  "size": "1024x1024",
  "response_format": "url"
}
'
{
  "created": 1713204900,
  "data": [
    {
      "url": "/samples/image.png"
    }
  ],
  "credits_used": 40
}
Models like Nano Banana (Gemini Image) support edits — provide a source image + prompt:
curl https://api.infery.ai/v1/images/edits \
  -H "Authorization: Bearer $INFERY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2-5-flash-image",
    "prompt": "Replace the background with a tropical beach",
    "image_base64": "<base64 of source image>"
  }'

Sample output

Source image before edit
Image after edit
Image-edit output format matches image generation.

Supported models

Image-edit capability is model-dependent. Check capabilities.imageEdit: true via GET /v1/models/{slug} or see Models catalog.

Authorizations

Authorization
string
header
required

API key in format: Bearer inf_***

Body

application/json
model
string
required
prompt
string
required

Edit instruction

image_base64
string
required

Base64-encoded source image

image_mime_type
string
default:image/png
mask_base64
string

Base64-encoded mask (transparent area = edit region)

mask_mime_type
string
default:image/png
n
integer
default:1
size
enum<string>
default:1024x1024
Available options:
256x256,
512x512,
1024x1024,
1792x1024,
1024x1792
response_format
enum<string>
default:url
Available options:
url,
b64_json

Response

Image edit result

created
integer
Example:

1713204900

data
object[]
Example:
[{ "url": "/samples/image.png" }]
credits_used
integer
Example:

40