Edit images

Modify or extend an existing image with a prompt and an optional mask.

POSThttps://your-instance.com/v1/images/edits

Takes multipart form data rather than JSON. Supply the source image and a prompt describing the change; supply a mask as well to confine the edit to part of the frame.

  • modelstringrequired

    Image model to use.

  • imagefilerequired

    The image to edit.

  • promptstringrequired

    What the edited image should look like.

  • maskfile

    Transparent areas mark where the edit applies. Must match the source dimensions.

  • nintegerdefault: 1

    How many variations to produce.

  • sizestringdefault: "1024x1024"

    Output dimensions.

curl
curl https://your-instance.com/v1/images/edits \
  -H "Authorization: Bearer $CLAWROUTER_API_KEY" \
  -F model="gpt-image-2" \
  -F image="@room.png" \
  -F mask="@wall-mask.png" \
  -F prompt="Repaint the wall deep green"