GPT-Image-2.6 · Image-to-image
curl --request POST \
--url https://api.gravitex.ai/v1/images/edits \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>'import requests
url = "https://api.gravitex.ai/v1/images/edits"
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'}
};
fetch('https://api.gravitex.ai/v1/images/edits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gravitex.ai/v1/images/edits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.gravitex.ai/v1/images/edits"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gravitex.ai/v1/images/edits")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gravitex.ai/v1/images/edits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
response = http.request(request)
puts response.read_bodyimage-2.6
GPT-Image-2.6 · Image-to-image
GPT-Image-2.6 Flare / Sunburst · POST /v1/images/edits
POST
/
v1
/
images
/
edits
GPT-Image-2.6 · Image-to-image
curl --request POST \
--url https://api.gravitex.ai/v1/images/edits \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>'import requests
url = "https://api.gravitex.ai/v1/images/edits"
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'}
};
fetch('https://api.gravitex.ai/v1/images/edits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gravitex.ai/v1/images/edits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.gravitex.ai/v1/images/edits"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gravitex.ai/v1/images/edits")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gravitex.ai/v1/images/edits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
response = http.request(request)
puts response.read_bodyIntroduction
GPT-Image-2.6 Flare and Sunburst both edit reference images from text instructions. This page coversPOST /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
| Model ID | Best suited for |
|---|---|
gpt-image-2.6-flare | Fast iteration and interactive generation |
gpt-image-2.6-sunburst | Detailed visual work, complex layouts, and precise edits |
Authentication
string
required
Bearer $GRAVITEX_API_KEY
string
required
application/json / multipart/form-data
Request parameters
| Parameter | Type | Description |
|---|---|---|
model | string | Required: gpt-image-2.6-flare or gpt-image-2.6-sunburst |
prompt | string | Required description or edit instruction; up to 32,000 characters |
quality | string | auto / low / medium / high / xhigh / max; default auto |
complexity | string | low / medium / high; default high. Planning effort independent of quality |
size | string | auto or WxH with dimensions divisible by 16; model size and pixel budgets apply |
n | integer | 1–10; default 1 |
background | string | auto / opaque / transparent; use png or webp for transparent raster output |
output_format | string | png / jpeg / webp / gif |
output_compression | integer | 0–100 for jpeg/webp only; unavailable for GIF |
moderation | string | auto / low; default auto |
safety_identifier | string | Stable hashed end-user identifier, up to 128 characters; replaces user |
stream | boolean | Default false. When true, read SSE events instead of parsing a single JSON response. Unsupported for GIF |
partial_images | integer | Raster streaming only: 0–3, default 0. Requested preview count; fewer previews may arrive. Unsupported for GIF |
images / image[] | array / file | Required for JSON: at least one reference via images: [{"image_url": "HTTPS URL or base64 data URI"}]. Use image[] files for multipart |
markup | object / file | Optional transparent PNG overlay for the first reference image; mutually exclusive with mask |
mask | object / file | Optional PNG mask with the same dimensions as the first reference and an alpha channel. Fully transparent areas indicate the edit region. Applies to the first image only; incompatible with markup and GIF |
frame_count | integer | GIF only: 2–16; default 9 |
frame_duration_ms | integer | GIF only: default 200; guide recommends 20–2000ms rounded to 10ms |
images / markup / mask
For JSON, useimages: [{"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
curl https://api.gravitex.ai/v1/images/edits \
-H "Authorization: Bearer $GRAVITEX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.6-flare",
"prompt": "Change the vase to blue. Keep everything else unchanged.",
"quality": "medium",
"complexity": "low",
"size": "1024x1024",
"images": [
{
"image_url": "https://developers.openai.com/images/platform/guides/image-prompting/kitchen.webp"
}
]
}'
multipart/form-data
curl --fail --location "https://developers.openai.com/images/platform/guides/image-prompting/kitchen.webp" -o kitchen.webp
curl https://api.gravitex.ai/v1/images/edits \
-H "Authorization: Bearer $GRAVITEX_API_KEY" \
-F "model=gpt-image-2.6-flare" \
-F "prompt=Change the vase to blue. Keep everything else unchanged." \
-F "image[]=@kitchen.webp" \
-F "complexity=low"
Markup-guided editing
curl https://api.gravitex.ai/v1/images/edits \
-H "Authorization: Bearer $GRAVITEX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.6-flare",
"prompt": "Change the vase to blue. Keep everything else unchanged.",
"quality": "medium",
"complexity": "low",
"size": "1024x1024",
"images": [
{
"image_url": "https://developers.openai.com/images/platform/guides/image-prompting/kitchen.webp"
}
],
"markup": {
"image_url": "https://developers.openai.com/images/platform/guides/image-prompting/markup-vase-overlay-gpt-image-2-6.png"
}
}'
Animated GIF
curl https://api.gravitex.ai/v1/images/edits \
-H "Authorization: Bearer $GRAVITEX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.6-flare",
"prompt": "Animate the kitchen curtains gently moving in a breeze. Keep the camera still and make a seamless loop.",
"output_format": "gif",
"frame_count": 9,
"frame_duration_ms": 200,
"size": "auto",
"images": [
{
"image_url": "https://developers.openai.com/images/platform/guides/image-prompting/kitchen.webp"
}
]
}'
Mask-guided inpainting
curl https://api.gravitex.ai/v1/images/edits \
-H "Authorization: Bearer $GRAVITEX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.6-flare",
"prompt": "Add a pink flamingo float in the masked pool area. Keep the rest of the room unchanged.",
"images": [
{
"image_url": "https://cdn.openai.com/API/docs/images/sunlit_lounge.png"
}
],
"mask": {
"image_url": "https://cdn.openai.com/API/docs/images/mask.png"
},
"quality": "medium"
}'
Streaming
curl --no-buffer https://api.gravitex.ai/v1/images/edits \
-H "Authorization: Bearer $GRAVITEX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.6-flare",
"prompt": "Change the vase to blue. Keep everything else unchanged.",
"quality": "medium",
"size": "1024x1024",
"stream": true,
"partial_images": 1,
"images": [
{
"image_url": "https://developers.openai.com/images/platform/guides/image-prompting/kitchen.webp"
}
]
}'
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.{
"created": 1794268800,
"data": [
{
"b64_json": "<BASE64_IMAGE_DATA>"
}
],
"usage": {
"input_tokens": 100,
"output_tokens": 824,
"total_tokens": 924
}
}
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.| Type | USD / 1M tokens |
|---|---|
| Text input | $5.00 |
| Cached text input | $1.25 |
| Image input | $8.00 |
| Cached image input | $2.00 |
| Image output | $30.00 |
