# GPT Image 2 Edit Image

Edit an image with an instruction.

`POST /api/v1/images/edits`

## Overview

Edit applies a natural-language instruction to an existing image, optionally guided by a mask, and preserves the untouched regions.

## Parameters

- `model` (string) — required: Model ID, e.g. gpt-image-2.5-edit-image.
- `image_url` (string) — required: Image to edit.
- `prompt` (string) — required: Instruction describing the change.
- `mask_url` (string): Optional mask restricting the edit area.

## Example

```bash
curl -X POST https://capi.minapp.xin/api/v1/images/edits \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.5-edit-image",
    "image_url": "https://file.capi.minapp.xin/images/out-1.png",
    "prompt": "swap the background to a snowy street"
  }'
```

## Response

```json
{
  "data": [
    { "url": "https://file.capi.minapp.xin/images/edited-1.png" }
  ],
  "cost": { "amount": 0.06, "currency": "USD" }
}
```
