Edit Image
Edit or extend images with GPT Image 2.5 and other models, with complete parameters, response fields, and streaming examples.
Creates an edited or extended image from one or more source images and a text prompt. The endpoint supports GPT Image models and dall-e-2.
Endpoint
| Item | Value |
|---|---|
| Method | POST |
| URL | https://api.tokenhub.belivestudios.com/v1/images/edits |
| Authentication | Authorization: Bearer sk-your-belive-studios-key |
| Content-Type | application/json or multipart/form-data |
Model Selection
Model categories
The platform provides per-use models and official models, with different values for the model parameter.
| Per-use model | Official model |
|---|---|
gpt-image-2 | gpt-image-2-2026-04-21 |
gpt-image-2.5-sunburst | gpt-image-2.5-sunburst-2026-09-08 |
gpt-image-2.5-flare | gpt-image-2.5-flare-2026-09-08 |
The examples below use per-use models. To use an official model, replace the request's model value.
Examples
Edit Using an Image URL
Pass the source image in the images array:
curl https://api.tokenhub.belivestudios.com/v1/images/edits \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-belive-studios-key" \
-d '{
"images": [
{
"image_url": "https://example.com/source-image.png"
}
],
"prompt": "Add a watercolor effect to this image",
"model": "gpt-image-2.5-sunburst",
"quality": "high",
"size": "1024x1024"
}'Response
{
"created": 0,
"background": "transparent",
"data": [
{
"b64_json": "b64_json",
"revised_prompt": "revised_prompt",
"url": "https://example.com"
}
],
"output_format": "png",
"quality": "low",
"size": "1024x1024",
"usage": {
"input_tokens": 0,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 0
},
"output_tokens": 0,
"total_tokens": 0,
"output_tokens_details": {
"image_tokens": 0,
"text_tokens": 0
}
}
}Request Parameters
Input and Model
images
Type: object[], required
Input image references to edit. GPT Image models accept up to 16 images. Each object supports:
| Field | Type | Description |
|---|---|---|
file_id | string | File API ID of an uploaded image, optional |
image_url | string | Fully qualified URL or base64-encoded data URL, optional |
For multipart/form-data uploads, pass one or more files using the image[] field.
prompt
Type: string, required
A text description of the desired edit, from 1 to 32,000 characters.
background
Type: "transparent" | "opaque" | "auto" | null, optional
Sets the output background. gpt-image-2.5-sunburst, gpt-image-2.5-flare, and their 2026-09-08 snapshots support opaque and transparent backgrounds. Transparent backgrounds are also available for other supported GPT Image models. Support for gpt-image-2 and gpt-image-2-2026-04-21 is in preview. When using transparent, set output_format to png or webp.
input_fidelity
Type: "high" | "low" | null, optional
Controls fidelity to the original input images.
mask
Type: object | null, optional
References a mask by URL or uploaded file ID. Provide exactly one of image_url or file_id.
| Field | Type | Description |
|---|---|---|
file_id | string | File API ID of an uploaded mask, optional |
image_url | string | Fully qualified URL or base64-encoded data URL, optional |
model
Type: string | null, optional
The image-editing model. Platform model names are grouped as follows:
- Per-use models:
gpt-image-2,gpt-image-2.5-sunburst, andgpt-image-2.5-flare - Official models:
gpt-image-2-2026-04-21,gpt-image-2.5-sunburst-2026-09-08, andgpt-image-2.5-flare-2026-09-08
Output and Streaming Controls
moderation
Type: "low" | "auto" | null, optional
Sets the moderation level for GPT Image models.
n
Type: number | null, optional
The number of edited images to generate, from 1 to 10.
output_compression
Type: number | null, optional
Compression level for jpeg or webp output, from 0 to 100.
output_format
Type: "png" | "jpeg" | "webp" | null, optional
The output image format. Supported by GPT Image models.
partial_images
Type: number | null, optional
The number of partial images to generate in a streaming response, from 0 to 3. When set to 0, the response sends only the final image in one event. The final image may arrive before all requested partial images if it is generated sooner.
quality
Type: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | null, optional
Output quality for GPT Image models. Defaults to auto. All GPT Image models support low, medium, and high; gpt-image-2.5-sunburst, gpt-image-2.5-flare, and their 2026-09-08 snapshots also support xhigh and max.
size
Type: string | "auto" | null, optional
GPT Image models support the standard sizes 1024x1024, 1536x1024, and 1024x1536; models that allow automatic sizing also support auto.
gpt-image-2, gpt-image-2-2026-04-21, both GPT Image 2.5 models, and their 2026-09-08 snapshots support arbitrary WIDTHxHEIGHT resolutions, such as 1536x864. Both dimensions must be divisible by 16, the aspect ratio must be between 1:3 and 3:1, and the request must meet the model's current pixel and edge limits. Resolutions above 2560x1440 are experimental; the maximum is 3840x2160.
stream
Type: boolean | null, optional
Streams partial image results as events.
user
Type: string, optional
A unique identifier for the end user that can help monitor and detect abuse.
Response
The endpoint returns an ImagesResponse object.
| Field | Type | Description |
|---|---|---|
created | number | Unix timestamp, in seconds, when the image was created |
background | transparent | opaque | Background used for the image edit, if present |
data | Image[] | Generated images, if present |
output_format | png | webp | jpeg | Output image format, if present |
quality | low | medium | high | xhigh | max | Generated image quality, if present |
size | string | Image dimensions in WIDTHxHEIGHT format, for example 1536x864, if present |
usage | object | Token usage; the official reference identifies this field for gpt-image-1, if present |
data Fields
| Field | Type | Description |
|---|---|---|
b64_json | string | Base64-encoded image; returned by default for GPT Image models and for DALL·E when response_format=b64_json |
revised_prompt | string | Returned only by dall-e-3; because this edit endpoint does not support dall-e-3, this field is not normally returned here |
url | string | Image URL returned by dall-e-2 when response_format=url; unsupported by GPT Image models |
usage Fields
| Field | Type | Description |
|---|---|---|
input_tokens | number | Image and text tokens in the input |
input_tokens_details.image_tokens | number | Image tokens in the input |
input_tokens_details.text_tokens | number | Text tokens in the input |
output_tokens | number | Output tokens generated by the model |
total_tokens | number | Total image and text tokens used |
output_tokens_details.image_tokens | number | Image tokens in the output, if present |
output_tokens_details.text_tokens | number | Text tokens in the output, if present |