Edit Image
Upload an image and edit or extend it with a text prompt.
Request Conventions
| Item | Value |
|---|---|
| Base URL | https://token.wdcloud.ai |
| Authentication header | Authorization: Bearer <API_KEY> |
Endpoint
POST /v1/images/edits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
image | file | Yes | Source image to edit |
prompt | string | Yes | Text description of the requested edit |
mask | file | No | Mask that identifies the editable area |
model | string | No | Image editing model ID |
n | integer | No | Number of images to generate |
size | string | No | Output dimensions; supported 1K dimensions are listed below |
response_format | string | No | Return format |
Supported size Values
| Aspect ratio | 1K |
|---|---|
1:1 | 1024x1024 |
5:4 | 1040x832 |
9:16 | 720x1280 |
16:9 | 1280x720 |
4:3 | 1024x768 |
3:2 | 1008x672 |
4:5 | 832x1040 |
3:4 | 768x1024 |
2:3 | 672x1008 |
21:9 | 1344x576 |
Example
bash
curl -X POST "https://token.wdcloud.ai/v1/images/edits" \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx" \
-F "model=YOUR_MODEL_ID" \
-F "image=@./input.png" \
-F "prompt=Add a small sailboat near the horizon."