GPT-Image-2.5 · Text-to-image
curl --request POST \
--url https://api.gravitex.ai/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>'import requests
url = "https://api.gravitex.ai/v1/images/generations"
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/generations', 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/generations",
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/generations"
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/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gravitex.ai/v1/images/generations")
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.5
GPT-Image-2.5 · Text-to-image
GPT-Image-2.5 Flare / Sunburst · POST /v1/images/generations
POST
/
v1
/
images
/
generations
GPT-Image-2.5 · Text-to-image
curl --request POST \
--url https://api.gravitex.ai/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>'import requests
url = "https://api.gravitex.ai/v1/images/generations"
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/generations', 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/generations",
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/generations"
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/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gravitex.ai/v1/images/generations")
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.5 includes Flare for fast everyday generation and Sunburst for detailed visual work. UsePOST /v1/images/generations to turn text descriptions into posters, product visuals, illustrations, icons, and infographics.
Both models support auto, low, medium, high, xhigh, and max quality, with PNG, JPEG, and WebP output. Adjust quality, size, and background for your task. Use PNG or WebP for transparent backgrounds.
Choose a model
| Model ID | Best suited for |
|---|---|
gpt-image-2.5-flare | Fast iteration and interactive generation |
gpt-image-2.5-sunburst | Detailed visual work and complex layouts |
Authentication
string
required
Bearer $GRAVITEX_API_KEY
string
required
application/json
Request parameters
| Parameter | Type | Description |
|---|---|---|
model | string | Required: gpt-image-2.5-flare or gpt-image-2.5-sunburst |
prompt | string | Required description of the image to generate; up to 32,000 characters |
quality | string | auto / low / medium / high / xhigh / max; default auto |
size | string | auto or WxH with dimensions divisible by 16; model size and pixel budgets apply |
n | integer | 1–10 |
background | string | auto / opaque / transparent; use png or webp for transparent raster output |
output_format | string | png / jpeg / webp; default png |
output_compression | integer | 0–100, default 100; JPEG / WebP only |
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 |
partial_images | integer | Raster streaming only: 0–3, default 0. Requested preview count; fewer previews may arrive |
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.Basic generation
curl https://api.gravitex.ai/v1/images/generations \
-H "Authorization: Bearer $GRAVITEX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.5-flare",
"prompt": "A clean botanical poster with precise typography",
"quality": "medium",
"size": "1024x1024"
}'
Transparent background
curl https://api.gravitex.ai/v1/images/generations \
-H "Authorization: Bearer $GRAVITEX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.5-flare",
"prompt": "A single green botanical icon, isolated on a transparent background",
"quality": "medium",
"size": "1024x1024",
"background": "transparent",
"output_format": "png"
}'
Streaming
curl --no-buffer https://api.gravitex.ai/v1/images/generations \
-H "Authorization: Bearer $GRAVITEX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.5-flare",
"prompt": "A simple green botanical illustration",
"quality": "medium",
"size": "1024x1024",
"stream": true,
"partial_images": 1
}'
Limits and notes
The default size is auto. Explicit WxH dimensions must be multiples of 16, with aspect ratios between 1:3 and 3:1. The image-2 guide specifies a maximum edge of 3840px and 655,360–8,294,400 pixels; the 2.5 reference also requires model-specific edge and pixel limits. Confirm the actual 2.6 budget, especially for GIF, rather than assuming older limits. This page includes explicitly documented GPT-Image-2.5 workflows. It does not assume the 2.6-specific complexity, GIF, or SVG guidance applies to 2.5. A field in a shared API schema does not guarantee support on every model or channel.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. Returns data[].b64_json and usage. Decode Base64 before saving images. The following are OpenAI standard rates, not a GravitexAI quote. Cached rates are official reference rates. For GPT Image 2 / 2.5, the guide limits cached input discounts to the Responses image tool; they do not apply to direct Images API calls, including edits. 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 |
