# GPT Image Edit — JSON

Edit reference images with current GPT Image models using URL or data URL references.

- Source: https://www.unifyllm.com/docs/api-reference/gpt-image-edit-json/
- Language: en
- Updated: 2026-11-30

## Endpoint

```http
POST https://api.unifyllm.top/v1/images/edits
```

Use the authentication and headers shown in the request examples. Content-Type: application/json

## Current models and endpoints

Checked against the model square on 2026-11-30. Examples use gpt-image-2.6-flare-c; gpt-image-2.6-sunburst-c is also available. Use the complete public model name.

- Use https://api.unifyllm.top without channel prefixes.

- Use generations for text-to-image and edits for reference editing; Chat fits existing chat clients.

- Check the model square and key access for gpt-image-2-c and gpt-image-2-4k-c.

## Sizes, output, and references

- Images returns created, model, and data[].url, without b64_json or raw upstream usage. One output image per request.

- n=1, quality=high, and response_format=url are fixed; other controls such as mask are not guaranteed.

- Requested pixels do not prove native detail. The reference project tested 1024x1024 → 1254×1254 and 3840x2160 → 3840×2160 on 2026-11-30. Check actual public-route results.

| Item | Rule |
| --- | --- |
| size | auto or WIDTHxHEIGHT; multiples of 16, longest edge 3840, ratio up to 3:1 |
| Total pixels | 655,360–8,294,400 |
| References | Standard models: JSON or multipart, up to 10 references |
| Legacy 4K edit alias | gpt-image-2-4k-c edits require multipart file upload |

## Chat and streaming

- Include the prompt and references in the current user message, including the previous result when editing it.

- stream=false puts Markdown image links in choices[0].message.content; stream=true emits content after success and ends with stop and [DONE].

- The compatibility layer adds parameter summaries and completion text; 100% is not live progress.

- GPT-image Chat usage is estimated by the compatibility layer, not the supplier’s actual image-token bill. Missing Images usage does not mean free generation.

## Save images and troubleshoot

- Download the signed image URL without an API key, promptly and with the query string intact.

- A route may store the file before responding or cache it on the first full download. Save it promptly; storage is not permanent.

- For 400 check sizes, references, and model; 401 auth; 413 request size; 429 limit details. Keep request IDs for timeouts or 5xx.

- Do not automatically repeat uncertain paid generation requests. Retry the same URL first if download fails.

## Parameters

| Field | Location | Type | Required | Description | Allowed values | Example |
| --- | --- | --- | --- | --- | --- | --- |
| model | body | string | yes | Examples use gpt-image-2.6-flare-c; gpt-image-2.6-sunburst-c is also listed. Check the model square and key access for legacy aliases. | gpt-image-2.6-flare-c, gpt-image-2.6-sunburst-c, gpt-image-2.5-flare-c, gpt-image-2.5-sunburst-c, gpt-image-2-c, gpt-image-2-4k-c | gpt-image-2.6-flare-c |
| prompt | body | string | yes | Non-empty generation or edit instructions. |  |  |
| image | body | string | no | One public image URL or complete image data URL; mutually exclusive with images. |  |  |
| images | body | array | no | An ordered array of URL/data URL strings, up to 10. Provide either image or images. |  |  |
| size | body | string | no | auto or WIDTHxHEIGHT. Both dimensions must be multiples of 16; longest edge ≤3840, aspect ratio ≤3:1, total pixels 655,360–8,294,400. Actual pixels depend on the upstream. | auto, 1024x1024, 1536x1024, 1024x1536, 2048x1152, 3840x2160 | 1024x1024 |
| n / quality / response_format | body | fixed | no | Fixed to one image, high quality, and URL output; requesting b64_json does not enable Base64. Other generation controls are not guaranteed to be forwarded. |  |  |

## Reference URL

```json
{
  "model": "gpt-image-2.6-flare-c",
  "prompt": "Change the cup to green; preserve the background.",
  "image": "https://example.com/reference.jpg",
  "size": "1024x1024"
}
```

### cURL

```bash
curl --fail-with-body --max-time 300 'https://api.unifyllm.top/v1/images/edits' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-image-2.6-flare-c",
  "prompt": "Change the cup to green; preserve the background.",
  "image": "https://example.com/reference.jpg",
  "size": "1024x1024"
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/images/edits", {
  method: "POST",
  headers: {
  "Authorization": "Bearer <YOUR_API_KEY>",
  "Content-Type": "application/json"
},
  body: JSON.stringify({
  "model": "gpt-image-2.6-flare-c",
  "prompt": "Change the cup to green; preserve the background.",
  "image": "https://example.com/reference.jpg",
  "size": "1024x1024"
}),
  signal: AbortSignal.timeout(300_000),
});
if (!response.ok) throw new Error(await response.text());
const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

payload = json.loads("{\n  \"model\": \"gpt-image-2.6-flare-c\",\n  \"prompt\": \"Change the cup to green; preserve the background.\",\n  \"image\": \"https://example.com/reference.jpg\",\n  \"size\": \"1024x1024\"\n}")
response = requests.post(
    "https://api.unifyllm.top/v1/images/edits",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=payload,
    timeout=(10, 300),
)
response.raise_for_status()
print(response.json())
```

## Multiple references

```json
{
  "model": "gpt-image-2.6-flare-c",
  "prompt": "Use the shape from the first image and the colors from the second.",
  "images": [
    "https://example.com/shape.jpg",
    "https://example.com/color.jpg"
  ],
  "size": "1536x1024"
}
```

### cURL

```bash
curl --fail-with-body --max-time 300 'https://api.unifyllm.top/v1/images/edits' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-image-2.6-flare-c",
  "prompt": "Use the shape from the first image and the colors from the second.",
  "images": [
    "https://example.com/shape.jpg",
    "https://example.com/color.jpg"
  ],
  "size": "1536x1024"
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/images/edits", {
  method: "POST",
  headers: {
  "Authorization": "Bearer <YOUR_API_KEY>",
  "Content-Type": "application/json"
},
  body: JSON.stringify({
  "model": "gpt-image-2.6-flare-c",
  "prompt": "Use the shape from the first image and the colors from the second.",
  "images": [
    "https://example.com/shape.jpg",
    "https://example.com/color.jpg"
  ],
  "size": "1536x1024"
}),
  signal: AbortSignal.timeout(300_000),
});
if (!response.ok) throw new Error(await response.text());
const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

payload = json.loads("{\n  \"model\": \"gpt-image-2.6-flare-c\",\n  \"prompt\": \"Use the shape from the first image and the colors from the second.\",\n  \"images\": [\n    \"https://example.com/shape.jpg\",\n    \"https://example.com/color.jpg\"\n  ],\n  \"size\": \"1536x1024\"\n}")
response = requests.post(
    "https://api.unifyllm.top/v1/images/edits",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=payload,
    timeout=(10, 300),
)
response.raise_for_status()
print(response.json())
```

## Response examples

### Image URL — HTTP 200

```json
{
  "created": 1796000000,
  "model": "gpt-image-2.6-flare-c",
  "data": [
    {
      "url": "https://image.ezworkapi.top/oai-hc-img?u=EXAMPLE_IMAGE&sig=EXAMPLE_SIGNATURE"
    }
  ]
}
```

## Related endpoints

- [GPT Image 2.6 Edit — File Upload](https://www.unifyllm.com/docs/api-reference/edit-image-form-data/)
- [GPT Image 2.6 Generation](https://www.unifyllm.com/docs/api-reference/create-image/)
- [GPT Image — Chat Format](https://www.unifyllm.com/docs/api-reference/gpt-image-chat/)
