Skip to main content
POST
GPT-Image-2.6 · Image-to-image

Introduction

GPT-Image-2.6 Flare and Sunburst both edit reference images from text instructions. This page covers POST /v1/images/edits for recoloring, background replacement, restyling, inpainting, and blending multiple references. Provide reference images and describe both what should change and what should stay in prompt. Guide local edits with either a mask or a transparent markup overlay, never both. You can also generate a GIF from still references. Requests accept JSON image references or multipart file uploads, as shown below. Use Flare for quick iterations and Sunburst for detail, layout, and edit accuracy. Adjust rendering with quality and planning with the independent complexity setting. For focused edits, start with lower complexity and check that surrounding content remains as intended.

Choose a model

Both models use the endpoints, parameters, and response structure documented here. Examples use Flare; switch to Sunburst by replacing model. Set other fields for your workload.

Authentication

string
required
Bearer $GRAVITEX_API_KEY
string
required
application/json / multipart/form-data

Request parameters

images / markup / mask

For JSON, use images: [{"image_url": "https://..."}] or base64 data URIs. For multipart, upload files as image[]. According to the platform integration note, the gateway converts JSON edits to multipart and does not support OpenAI file_id references. Use a transparent PNG markup layer matching the first input image after orientation. Include transparent pixels. JSON uses markup.image_url; multipart uploads a markup file. Cannot be combined with mask. Use mask to identify the edit region, or markup, never both. JSON accepts image_url; multipart accepts a file.

Request examples

Examples read the platform token from GRAVITEX_API_KEY in your terminal environment. For uploads, curl -F generates Content-Type and boundary automatically; do not manually set a bare multipart/form-data header.
JSON examples use the official OpenAI kitchen image; the markup example uses its matching official transparent overlay. Copy the JSON bodies directly. The multipart example downloads the same image before uploading it. The gateway does not support file_id; testing returned HTTP 500 (convert_request_failed), so do not assume HTTP 400.

JSON

multipart/form-data

Markup-guided editing

Animated GIF

user is deprecated and retained for compatibility. Use safety_identifier; a non-empty value takes precedence, otherwise the API falls back to user.

Mask-guided inpainting

Streaming

Limits and notes

GIF size describes each frame. Frame count, n, and model pixel budgets jointly constrain it. Prefer auto; reduce frames or dimensions if limits are exceeded. The official Images API accepts 1–16 JSON edit references in PNG, JPEG, or WebP, each under 50MB. A mask is a PNG with an alpha channel matching the first reference. Transparent areas guide editing; masks do not guarantee a pixel-exact hard boundary. Lack of gateway validation does not remove upstream limits. SVG output is not provided by this edit endpoint. Use the generation endpoint for SVG. GIF requires preview access. Omit mask, stream, partial_images, and custom output_compression. Frame count, frame dimensions, and n share the request pixel budget; reduce them or use size=auto if limits are exceeded. Complexity has no separate fee, but can affect latency and results. Lower complexity does not guarantee a fixed response time or per-image cost.

Response example

This is a schematic non-streaming response. Image data and token counts are illustrative, not an actual generation. Decode b64_json to the selected file format; do not save the Base64 text directly as an image.
With stream=true, read SSE events for previews and the final image. Do not parse the entire response as one JSON object.

Response and billing

Non-streaming examples return image bytes as b64_json. Do not request response_format=url expecting a hosted image URL. Equal token rates do not imply equal cost per image; use actual usage. Decode data[].b64_json into the selected file format. usage reports token consumption. Prices below are OpenAI standard rates, not a GravitexAI quote; platform billing follows the console.

Official references