Skip to content

Image to Image

Image-to-Image generation is very similar to image generation. Key differences:

  • Instead of JSON, encode your request as multipart/form-data
  • Specify input image(s)
  • If needed, specify edit mask

For Image-to-Image models, see the list of models with Edit label, or filter for Image-to-Image models.

Terminal window
curl -X POST "https://api.imagerouter.io/v1/openai/images/edits" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "prompt=YOUR_PROMPT" \
-F "model=openai/gpt-image-1" \
-F "image[]=@your_image1.webp" \
-F "image[]=@your_image2.webp" \
-F "mask[]=@your_mask.webp"

note: /v1/openai/images/generations and /v1/openai/images/edits are the same, we have both for compatibility reasons.

Parameters: