Flux Image Editing
Overview
- Method:
POST - Path:
/v1/images/edits - Content-Type:
multipart/form-data - Description: This endpoint uses FormData parameters, not JSON.
Supported sizes and ratios
| Size | Ratio |
|---|---|
| 1024x1024 | 1:1 |
| 512x1024 | 1:2 |
| 1024x512 | 2:1 |
| 768x512 | 3:2 |
| 512x768 | 2:3 |
| 960x1280 | 3:4 |
| 1280x960 | 4:3 |
| 720x1280 | 9:16 |
| 1280x720 | 16:9 |
| 576x1344 | 9:21 |
| 1344x576 | 21:9 |
Authentication
Authorization: Bearer sk-xxx(required)
Request Example
Header
| Header | Example | Required |
|---|---|---|
| Content-Type | multipart/form-data | Yes |
| Authorization | Bearer sk-xxxx | Yes |
Form Fields
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| image | file or array | Yes | @otter.png | Source image; up to 4 images; png/jpeg; <5MB |
| prompt | string | Yes | Change his clothes to pink | Prompt text; max 1000 chars |
| model | string | No | flux-kontext-pro | Model name, supports flux-kontext-pro/flux-kontext-max |
| output_format | string | No | png | Output format, png/jpeg |
| size | string | No | 9:16 | Target ratio, e.g., 1:1, 3:4 |
| seed | integer | No | 12345 | Random seed |
| prompt_upsampling | boolean | No | true | Whether to optimize prompt |
| safety_tolerance | integer | No | 6 | Safety tolerance, 0-6 |
curl Example
bash
curl -X POST "https://api.gpt.ge/v1/images/edits" \
-H "Authorization: Bearer sk-xxxx" \
-F "image=@otter.png" \
-F "prompt=A cute otter baby wearing a beret" \
-F "model=flux-kontext-pro" \
-F "size=1024x1024"Response Example (200)
json
{
"created": 1589478378,
"data": [
{ "url": "https://..." },
{ "url": "https://..." }
]
}