GPT Image 2.5 Sunburst
GPT Image 2.5 Sunburst creates images from text prompts. Supports custom sizes, extended quality levels and transparent backgrounds; the manufacturer also highlights editing fidelity.
- Ailoot · Images
POST /v1/images/generationsgpt-image-2.5-sunburst - Ailoot · Images
POST /v1/images/generationsgpt-image - Ailoot · Images
POST /v1/images/generationsgpt-image-2.5 - Ailoot · Images
POST /v1/images/generationsgpt-image-2.5-latest - Ailoot · Images
POST /v1/images/generationsgpt-image-latest
About the model
This description covers the model’s capabilities. Available in Ailoot inputs, outputs and options are listed for the selected method below.
Generation and work with images
GPT Image 2.5 Sunburst is an OpenAI model for creating images. The manufacturer pays particular attention to fidelity when editing source material. The model supports text prompts and visual source material in the operations provided for that purpose.
The current Ailoot card presents image creation from text. The scene, composition, style and details of a future result can be specified. OpenAI-described reference workflows, editing and changes to a masked region require separate image-input support; text-to-image generation does not confirm that support.
Quality and frame shape
low, medium, high, xhigh, max and auto are available. Quality selection controls how an image is formed. It differs from compositional dimensions and compression of the received file.
Size can be square, landscape, portrait, selected automatically or specified manually. For custom sizes, each dimension is a multiple of 16 pixels and does not exceed 3840 pixels. Area must lie between 655,360 and 8,294,400 pixels, and the ratio of the longer dimension to the shorter must not exceed 3:1. All conditions apply simultaneously.
The manufacturer designates resolutions above 2560x1440 as experimental. A large frame allows suitable compositional space to be selected, but does not remove the need to check text and object placement.
Output formats and background
PNG is the default; JPEG and WebP are also provided. Compression can be adjusted in JPEG and WebP. A transparent background requires PNG or WebP because JPEG does not retain an alpha channel. Opaque backgrounds and automatic selection are provided alongside transparency.
Size, quality, format and background address different aspects of the result. Image style is specified through a text description alongside scene content. Support for particular settings needs to be considered separately from the manufacturer's general capabilities.
Edit accuracy and image checking
According to OpenAI, a complex prompt may take up to two minutes to process. This describes generation with the manufacturer, not a guarantee of total result-delivery time in a particular application.
In a separately supported editing operation, a mask guides changes to the selected region. It does not guarantee strict conformity of the result to the boundary, so a promise of a precise local edit would be too strong. This mode requires the appropriate way of supplying source material.
During generation, the model may also place text or details incorrectly or change a character's appearance between individual images. Checking text, composition and consistency belongs to inspection of the finished file. Even a detailed prompt does not make these properties guaranteed.
Ailoot · Images POST /v1/images/generations gpt-image-2.5-sunburst
gpt-image-2.5-sunburstgpt-image-2.5-sunburstgpt-imagegpt-image-2.5gpt-image-2.5-latestgpt-image-latest
Overview
GPT Image 2.5 Sunburst creates images from text prompts. Supports custom sizes, extended quality levels and transparent backgrounds; the manufacturer also highlights editing fidelity.
- Accepted inputs
- Text
- Results
- Images
Available in Ailoot · inputs & methods
Ailoot · Images POST /v1/images/generations
- Input types
text- Output types
image- Output format
- Image file
| Field | Type | Requirement | Values & limits | Default |
|---|---|---|---|---|
Fieldmodel | Typestring | RequirementRequired | Values & limits gpt-image-2.5-sunburst | Default— |
Fieldprompt | Typestring | RequirementRequired | Values & limits Minimum length: 1 | Default— |
Fieldn | Typeinteger | RequirementOptional | Values & limits Minimum: 1 | Default1 |
Fieldresponse_format | Typestring | RequirementOptional | Values & limits url, b64_json | Default— |
Fieldstream | Typeboolean | RequirementOptional | Values & limits | Defaultfalse |
Fieldsize | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldquality | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldbackground | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldoutput_format | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldoutput_compression | Typeinteger | RequirementOptional | Values & limits Model-specific | Default— |
Fieldmoderation | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldinput_fidelity | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldstyle | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldpartial_images | Typeinteger | RequirementOptional | Values & limits Model-specific | Default— |
Input material combinations
Text to image · Required: prompt
Method parameters and lifecycle
| Parameter | Contract |
|---|---|
Parametermaterial_types | Contracttext |
Parameterrequired | Contractmodel, prompt |
Parameteroptional_controls | Contractnull |
Parametercontent_type | Contractapplication/json |
Lifecycle: synchronous_result_then_owned_library
GET /v1/media/tasks/{task_id} · actual returned task_id or media library record
GET /v1/media/assets/{asset_id}/content
GET /v1/media/assets
GET /v1/media/assets/{asset_id}
Method shapes and IDs are exact; supplier capability is separate from admission.
Pricing
Ailoot method rates
POST /v1/images/generations- Text input
- $0.005 / 1K
- Image input
- $0.008 / 1K tokens
- Image output
- $0.03 / 1K tokens
Ailoot reserves an estimated amount before a request. After the result, it settles the final charge from measured usage. Streaming settlement uses the final usage record. How reservation and settlement work →
Example requests
Ailoot · Images
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
export AILOOT_API_KEY
: "${AILOOT_PROMPT_FILE:?Set your actual UTF-8 image brief}"
export AILOOT_PROMPT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gpt-image-2.5-sunburst", "prompt": ""}')
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 brief")
p['prompt']=f.read_text(encoding="utf-8")
if not p['prompt'].strip():raise SystemExit("Brief must contain text")
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
-H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
--data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
from openai import OpenAI
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Set your actual UTF-8 image brief file")
request={'model': 'gpt-image-2.5-sunburst', 'prompt': ''}
request["prompt"]=f.read_text(encoding="utf-8")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.images.generate(**request)
Path("sdk-result.txt").write_text(str(result),encoding="utf-8")
save_images([{"b64_json":getattr(item,"b64_json",None),"url":getattr(item,"url",None)} for item in result.data])
import OpenAI from "openai";
import { readFileSync, writeFileSync } from "node:fs";
const key=process.env.AILOOT_API_KEY;
if(!key) throw new Error("Set your actual Ailoot API key");
const client=new OpenAI({baseURL:"https://api.ailoot.ai/v1",apiKey:key,maxRetries:0});
const request={"model": "gpt-image-2.5-sunburst", "prompt": ""};
if(!process.env.AILOOT_PROMPT_FILE)throw new Error("Set your actual UTF-8 image brief file");
request.prompt=readFileSync(process.env.AILOOT_PROMPT_FILE,"utf8");
const result=await client.images.generate(request);
writeFileSync("sdk-result.json",JSON.stringify(result,null,2));
if(!result.data?.length) throw new Error("No completed images");
for(let index=0;index<result.data.length;index++) {
const item=result.data[index];let encoded=item.b64_json,uri=item.url||"",raw;
if(!encoded && uri.startsWith("data:image/")) {
const comma=uri.indexOf(",");if(comma<0 || !uri.slice(0,comma).includes(";base64")) throw new Error("Unsupported image data URI");
encoded=uri.slice(comma+1);
}
if(encoded) {
if(encoded.length%4!==0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) throw new Error("Invalid Base64");
raw=Buffer.from(encoded,"base64");
} else if(uri) {
const u=new URL(uri,"https://api.ailoot.ai");
if(u.protocol!=="https:" || u.username || u.password) throw new Error("Invalid returned URL");
const owned=u.origin==="https://api.ailoot.ai" && u.pathname.startsWith("/v1/media/assets/") && u.pathname.endsWith("/content");
const response=await fetch(u,{headers:owned?{Authorization:"Bearer "+key}:{},redirect:"manual"});
if(!response.ok) throw new Error("Image content download failed: "+response.status);
raw=Buffer.from(await response.arrayBuffer());
} else throw new Error("Image has neither bytes nor URL");
if(!raw.length) throw new Error("Empty image result");
const ext=raw.subarray(0,4).equals(Buffer.from([137,80,78,71]))?"png":raw[0]===255&&raw[1]===216?"jpg":raw.toString("ascii",0,4)==="RIFF"&&raw.toString("ascii",8,12)==="WEBP"?"webp":raw.toString("utf8").trimStart().startsWith("<svg")||raw.toString("utf8").trimStart().startsWith("<?xml")?"svg":"bin";
writeFileSync(`image-${index}.${ext}`,raw);
}
console.log("Every returned image saved; sdk-result.json retains complete metadata");
Receive and save results
Ailoot · Images
Download each returned image or save its Base64 contents
GET /v1/media/tasks/{task_id}GET /v1/media/assets/{asset_id}/contentGET /v1/media/assetsGET /v1/media/assets/{asset_id}
Keep all completed results
Save every completed image; retrieve each returned URL or decode its Base64 contents.
Save every data item. Decode each b64_json or fetch every returned signed URL. Select a filename extension from the actual MIME/bytes.
If the original response needs checking
If an image generation or edit result requires a check, keep the original operation_id/X-Client-Request-ID and returned result information. Recover existing owned results through the media library using actual task_id or asset_id values. Do not resubmit the generation/edit request or construct a polling URL from operation_id.
Response fields
| Field | Type |
|---|---|
Fieldcreated | Typeinteger |
Fielddata[].url | Typestring |
Fielddata[].b64_json | Typebase64 string |
Fieldusage | Typeobject |
Errors and next steps
| Response | Condition | Next step |
|---|---|---|
Response400 · invalid_request_error | ConditionInvalid required fields, material representation or parameter value | Next stepCorrect the indicated fields before a new creation request. |
Responseserver_error | ConditionThe returned response says the operation or result requires a check | Next stepKeep the original returned operation/task ID, request headers and response; continue supported reads of that original operation. Do not resubmit the creation request. |
Aliases
Model aliases
Ailoot gpt-image-2.5-sunburst, gpt-image, gpt-image-2.5, gpt-image-2.5-latest, gpt-image-latest
Method path aliases
Use the method paths shown above.
Related caller IDs
gpt-image-2.5-sunburst, gpt-image, gpt-image-2.5, gpt-image-2.5-latest, gpt-image-latest
Ailoot · Images POST /v1/images/generations gpt-image
gpt-imagegpt-image-2.5-sunburstgpt-imagegpt-image-2.5gpt-image-2.5-latestgpt-image-latest
Overview
GPT Image 2.5 Sunburst creates images from text prompts. Supports custom sizes, extended quality levels and transparent backgrounds; the manufacturer also highlights editing fidelity.
- Accepted inputs
- Text
- Results
- Images
Available in Ailoot · inputs & methods
Ailoot · Images POST /v1/images/generations
- Input types
text- Output types
image- Output format
- Image file
| Field | Type | Requirement | Values & limits | Default |
|---|---|---|---|---|
Fieldmodel | Typestring | RequirementRequired | Values & limits gpt-image | Default— |
Fieldprompt | Typestring | RequirementRequired | Values & limits Minimum length: 1 | Default— |
Fieldn | Typeinteger | RequirementOptional | Values & limits Minimum: 1 | Default1 |
Fieldresponse_format | Typestring | RequirementOptional | Values & limits url, b64_json | Default— |
Fieldstream | Typeboolean | RequirementOptional | Values & limits | Defaultfalse |
Fieldsize | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldquality | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldbackground | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldoutput_format | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldoutput_compression | Typeinteger | RequirementOptional | Values & limits Model-specific | Default— |
Fieldmoderation | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldinput_fidelity | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldstyle | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldpartial_images | Typeinteger | RequirementOptional | Values & limits Model-specific | Default— |
Input material combinations
Text to image · Required: prompt
Method parameters and lifecycle
| Parameter | Contract |
|---|---|
Parametermaterial_types | Contracttext |
Parameterrequired | Contractmodel, prompt |
Parameteroptional_controls | Contractnull |
Parametercontent_type | Contractapplication/json |
Lifecycle: synchronous_result_then_owned_library
GET /v1/media/tasks/{task_id} · actual returned task_id or media library record
GET /v1/media/assets/{asset_id}/content
GET /v1/media/assets
GET /v1/media/assets/{asset_id}
Method shapes and IDs are exact; supplier capability is separate from admission.
Pricing
Ailoot method rates
POST /v1/images/generations- Text input
- $0.005 / 1K
- Image input
- $0.008 / 1K tokens
- Image output
- $0.03 / 1K tokens
Ailoot reserves an estimated amount before a request. After the result, it settles the final charge from measured usage. Streaming settlement uses the final usage record. How reservation and settlement work →
Example requests
Ailoot · Images
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
export AILOOT_API_KEY
: "${AILOOT_PROMPT_FILE:?Set your actual UTF-8 image brief}"
export AILOOT_PROMPT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gpt-image", "prompt": ""}')
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 brief")
p['prompt']=f.read_text(encoding="utf-8")
if not p['prompt'].strip():raise SystemExit("Brief must contain text")
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
-H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
--data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
from openai import OpenAI
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Set your actual UTF-8 image brief file")
request={'model': 'gpt-image', 'prompt': ''}
request["prompt"]=f.read_text(encoding="utf-8")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.images.generate(**request)
Path("sdk-result.txt").write_text(str(result),encoding="utf-8")
save_images([{"b64_json":getattr(item,"b64_json",None),"url":getattr(item,"url",None)} for item in result.data])
import OpenAI from "openai";
import { readFileSync, writeFileSync } from "node:fs";
const key=process.env.AILOOT_API_KEY;
if(!key) throw new Error("Set your actual Ailoot API key");
const client=new OpenAI({baseURL:"https://api.ailoot.ai/v1",apiKey:key,maxRetries:0});
const request={"model": "gpt-image", "prompt": ""};
if(!process.env.AILOOT_PROMPT_FILE)throw new Error("Set your actual UTF-8 image brief file");
request.prompt=readFileSync(process.env.AILOOT_PROMPT_FILE,"utf8");
const result=await client.images.generate(request);
writeFileSync("sdk-result.json",JSON.stringify(result,null,2));
if(!result.data?.length) throw new Error("No completed images");
for(let index=0;index<result.data.length;index++) {
const item=result.data[index];let encoded=item.b64_json,uri=item.url||"",raw;
if(!encoded && uri.startsWith("data:image/")) {
const comma=uri.indexOf(",");if(comma<0 || !uri.slice(0,comma).includes(";base64")) throw new Error("Unsupported image data URI");
encoded=uri.slice(comma+1);
}
if(encoded) {
if(encoded.length%4!==0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) throw new Error("Invalid Base64");
raw=Buffer.from(encoded,"base64");
} else if(uri) {
const u=new URL(uri,"https://api.ailoot.ai");
if(u.protocol!=="https:" || u.username || u.password) throw new Error("Invalid returned URL");
const owned=u.origin==="https://api.ailoot.ai" && u.pathname.startsWith("/v1/media/assets/") && u.pathname.endsWith("/content");
const response=await fetch(u,{headers:owned?{Authorization:"Bearer "+key}:{},redirect:"manual"});
if(!response.ok) throw new Error("Image content download failed: "+response.status);
raw=Buffer.from(await response.arrayBuffer());
} else throw new Error("Image has neither bytes nor URL");
if(!raw.length) throw new Error("Empty image result");
const ext=raw.subarray(0,4).equals(Buffer.from([137,80,78,71]))?"png":raw[0]===255&&raw[1]===216?"jpg":raw.toString("ascii",0,4)==="RIFF"&&raw.toString("ascii",8,12)==="WEBP"?"webp":raw.toString("utf8").trimStart().startsWith("<svg")||raw.toString("utf8").trimStart().startsWith("<?xml")?"svg":"bin";
writeFileSync(`image-${index}.${ext}`,raw);
}
console.log("Every returned image saved; sdk-result.json retains complete metadata");
Receive and save results
Ailoot · Images
Download each returned image or save its Base64 contents
GET /v1/media/tasks/{task_id}GET /v1/media/assets/{asset_id}/contentGET /v1/media/assetsGET /v1/media/assets/{asset_id}
Keep all completed results
Save every completed image; retrieve each returned URL or decode its Base64 contents.
Save every data item. Decode each b64_json or fetch every returned signed URL. Select a filename extension from the actual MIME/bytes.
If the original response needs checking
If an image generation or edit result requires a check, keep the original operation_id/X-Client-Request-ID and returned result information. Recover existing owned results through the media library using actual task_id or asset_id values. Do not resubmit the generation/edit request or construct a polling URL from operation_id.
Response fields
| Field | Type |
|---|---|
Fieldcreated | Typeinteger |
Fielddata[].url | Typestring |
Fielddata[].b64_json | Typebase64 string |
Fieldusage | Typeobject |
Errors and next steps
| Response | Condition | Next step |
|---|---|---|
Response400 · invalid_request_error | ConditionInvalid required fields, material representation or parameter value | Next stepCorrect the indicated fields before a new creation request. |
Responseserver_error | ConditionThe returned response says the operation or result requires a check | Next stepKeep the original returned operation/task ID, request headers and response; continue supported reads of that original operation. Do not resubmit the creation request. |
Aliases
Model aliases
Ailoot gpt-image-2.5-sunburst, gpt-image, gpt-image-2.5, gpt-image-2.5-latest, gpt-image-latest
Method path aliases
Use the method paths shown above.
Related caller IDs
gpt-image-2.5-sunburst, gpt-image, gpt-image-2.5, gpt-image-2.5-latest, gpt-image-latest
Ailoot · Images POST /v1/images/generations gpt-image-2.5
gpt-image-2.5gpt-image-2.5-sunburstgpt-imagegpt-image-2.5gpt-image-2.5-latestgpt-image-latest
Overview
GPT Image 2.5 Sunburst creates images from text prompts. Supports custom sizes, extended quality levels and transparent backgrounds; the manufacturer also highlights editing fidelity.
- Accepted inputs
- Text
- Results
- Images
Available in Ailoot · inputs & methods
Ailoot · Images POST /v1/images/generations
- Input types
text- Output types
image- Output format
- Image file
| Field | Type | Requirement | Values & limits | Default |
|---|---|---|---|---|
Fieldmodel | Typestring | RequirementRequired | Values & limits gpt-image-2.5 | Default— |
Fieldprompt | Typestring | RequirementRequired | Values & limits Minimum length: 1 | Default— |
Fieldn | Typeinteger | RequirementOptional | Values & limits Minimum: 1 | Default1 |
Fieldresponse_format | Typestring | RequirementOptional | Values & limits url, b64_json | Default— |
Fieldstream | Typeboolean | RequirementOptional | Values & limits | Defaultfalse |
Fieldsize | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldquality | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldbackground | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldoutput_format | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldoutput_compression | Typeinteger | RequirementOptional | Values & limits Model-specific | Default— |
Fieldmoderation | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldinput_fidelity | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldstyle | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldpartial_images | Typeinteger | RequirementOptional | Values & limits Model-specific | Default— |
Input material combinations
Text to image · Required: prompt
Method parameters and lifecycle
| Parameter | Contract |
|---|---|
Parametermaterial_types | Contracttext |
Parameterrequired | Contractmodel, prompt |
Parameteroptional_controls | Contractnull |
Parametercontent_type | Contractapplication/json |
Lifecycle: synchronous_result_then_owned_library
GET /v1/media/tasks/{task_id} · actual returned task_id or media library record
GET /v1/media/assets/{asset_id}/content
GET /v1/media/assets
GET /v1/media/assets/{asset_id}
Method shapes and IDs are exact; supplier capability is separate from admission.
Pricing
Ailoot method rates
POST /v1/images/generations- Text input
- $0.005 / 1K
- Image input
- $0.008 / 1K tokens
- Image output
- $0.03 / 1K tokens
Ailoot reserves an estimated amount before a request. After the result, it settles the final charge from measured usage. Streaming settlement uses the final usage record. How reservation and settlement work →
Example requests
Ailoot · Images
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
export AILOOT_API_KEY
: "${AILOOT_PROMPT_FILE:?Set your actual UTF-8 image brief}"
export AILOOT_PROMPT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gpt-image-2.5", "prompt": ""}')
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 brief")
p['prompt']=f.read_text(encoding="utf-8")
if not p['prompt'].strip():raise SystemExit("Brief must contain text")
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
-H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
--data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
from openai import OpenAI
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Set your actual UTF-8 image brief file")
request={'model': 'gpt-image-2.5', 'prompt': ''}
request["prompt"]=f.read_text(encoding="utf-8")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.images.generate(**request)
Path("sdk-result.txt").write_text(str(result),encoding="utf-8")
save_images([{"b64_json":getattr(item,"b64_json",None),"url":getattr(item,"url",None)} for item in result.data])
import OpenAI from "openai";
import { readFileSync, writeFileSync } from "node:fs";
const key=process.env.AILOOT_API_KEY;
if(!key) throw new Error("Set your actual Ailoot API key");
const client=new OpenAI({baseURL:"https://api.ailoot.ai/v1",apiKey:key,maxRetries:0});
const request={"model": "gpt-image-2.5", "prompt": ""};
if(!process.env.AILOOT_PROMPT_FILE)throw new Error("Set your actual UTF-8 image brief file");
request.prompt=readFileSync(process.env.AILOOT_PROMPT_FILE,"utf8");
const result=await client.images.generate(request);
writeFileSync("sdk-result.json",JSON.stringify(result,null,2));
if(!result.data?.length) throw new Error("No completed images");
for(let index=0;index<result.data.length;index++) {
const item=result.data[index];let encoded=item.b64_json,uri=item.url||"",raw;
if(!encoded && uri.startsWith("data:image/")) {
const comma=uri.indexOf(",");if(comma<0 || !uri.slice(0,comma).includes(";base64")) throw new Error("Unsupported image data URI");
encoded=uri.slice(comma+1);
}
if(encoded) {
if(encoded.length%4!==0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) throw new Error("Invalid Base64");
raw=Buffer.from(encoded,"base64");
} else if(uri) {
const u=new URL(uri,"https://api.ailoot.ai");
if(u.protocol!=="https:" || u.username || u.password) throw new Error("Invalid returned URL");
const owned=u.origin==="https://api.ailoot.ai" && u.pathname.startsWith("/v1/media/assets/") && u.pathname.endsWith("/content");
const response=await fetch(u,{headers:owned?{Authorization:"Bearer "+key}:{},redirect:"manual"});
if(!response.ok) throw new Error("Image content download failed: "+response.status);
raw=Buffer.from(await response.arrayBuffer());
} else throw new Error("Image has neither bytes nor URL");
if(!raw.length) throw new Error("Empty image result");
const ext=raw.subarray(0,4).equals(Buffer.from([137,80,78,71]))?"png":raw[0]===255&&raw[1]===216?"jpg":raw.toString("ascii",0,4)==="RIFF"&&raw.toString("ascii",8,12)==="WEBP"?"webp":raw.toString("utf8").trimStart().startsWith("<svg")||raw.toString("utf8").trimStart().startsWith("<?xml")?"svg":"bin";
writeFileSync(`image-${index}.${ext}`,raw);
}
console.log("Every returned image saved; sdk-result.json retains complete metadata");
Receive and save results
Ailoot · Images
Download each returned image or save its Base64 contents
GET /v1/media/tasks/{task_id}GET /v1/media/assets/{asset_id}/contentGET /v1/media/assetsGET /v1/media/assets/{asset_id}
Keep all completed results
Save every completed image; retrieve each returned URL or decode its Base64 contents.
Save every data item. Decode each b64_json or fetch every returned signed URL. Select a filename extension from the actual MIME/bytes.
If the original response needs checking
If an image generation or edit result requires a check, keep the original operation_id/X-Client-Request-ID and returned result information. Recover existing owned results through the media library using actual task_id or asset_id values. Do not resubmit the generation/edit request or construct a polling URL from operation_id.
Response fields
| Field | Type |
|---|---|
Fieldcreated | Typeinteger |
Fielddata[].url | Typestring |
Fielddata[].b64_json | Typebase64 string |
Fieldusage | Typeobject |
Errors and next steps
| Response | Condition | Next step |
|---|---|---|
Response400 · invalid_request_error | ConditionInvalid required fields, material representation or parameter value | Next stepCorrect the indicated fields before a new creation request. |
Responseserver_error | ConditionThe returned response says the operation or result requires a check | Next stepKeep the original returned operation/task ID, request headers and response; continue supported reads of that original operation. Do not resubmit the creation request. |
Aliases
Model aliases
Ailoot gpt-image-2.5-sunburst, gpt-image, gpt-image-2.5, gpt-image-2.5-latest, gpt-image-latest
Method path aliases
Use the method paths shown above.
Related caller IDs
gpt-image-2.5-sunburst, gpt-image, gpt-image-2.5, gpt-image-2.5-latest, gpt-image-latest
Ailoot · Images POST /v1/images/generations gpt-image-2.5-latest
gpt-image-2.5-latestgpt-image-2.5-sunburstgpt-imagegpt-image-2.5gpt-image-2.5-latestgpt-image-latest
Overview
GPT Image 2.5 Sunburst creates images from text prompts. Supports custom sizes, extended quality levels and transparent backgrounds; the manufacturer also highlights editing fidelity.
- Accepted inputs
- Text
- Results
- Images
Available in Ailoot · inputs & methods
Ailoot · Images POST /v1/images/generations
- Input types
text- Output types
image- Output format
- Image file
| Field | Type | Requirement | Values & limits | Default |
|---|---|---|---|---|
Fieldmodel | Typestring | RequirementRequired | Values & limits gpt-image-2.5-latest | Default— |
Fieldprompt | Typestring | RequirementRequired | Values & limits Minimum length: 1 | Default— |
Fieldn | Typeinteger | RequirementOptional | Values & limits Minimum: 1 | Default1 |
Fieldresponse_format | Typestring | RequirementOptional | Values & limits url, b64_json | Default— |
Fieldstream | Typeboolean | RequirementOptional | Values & limits | Defaultfalse |
Fieldsize | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldquality | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldbackground | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldoutput_format | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldoutput_compression | Typeinteger | RequirementOptional | Values & limits Model-specific | Default— |
Fieldmoderation | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldinput_fidelity | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldstyle | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldpartial_images | Typeinteger | RequirementOptional | Values & limits Model-specific | Default— |
Input material combinations
Text to image · Required: prompt
Method parameters and lifecycle
| Parameter | Contract |
|---|---|
Parametermaterial_types | Contracttext |
Parameterrequired | Contractmodel, prompt |
Parameteroptional_controls | Contractnull |
Parametercontent_type | Contractapplication/json |
Lifecycle: synchronous_result_then_owned_library
GET /v1/media/tasks/{task_id} · actual returned task_id or media library record
GET /v1/media/assets/{asset_id}/content
GET /v1/media/assets
GET /v1/media/assets/{asset_id}
Method shapes and IDs are exact; supplier capability is separate from admission.
Pricing
Ailoot method rates
POST /v1/images/generations- Text input
- $0.005 / 1K
- Image input
- $0.008 / 1K tokens
- Image output
- $0.03 / 1K tokens
Ailoot reserves an estimated amount before a request. After the result, it settles the final charge from measured usage. Streaming settlement uses the final usage record. How reservation and settlement work →
Example requests
Ailoot · Images
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
export AILOOT_API_KEY
: "${AILOOT_PROMPT_FILE:?Set your actual UTF-8 image brief}"
export AILOOT_PROMPT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gpt-image-2.5-latest", "prompt": ""}')
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 brief")
p['prompt']=f.read_text(encoding="utf-8")
if not p['prompt'].strip():raise SystemExit("Brief must contain text")
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
-H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
--data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
from openai import OpenAI
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Set your actual UTF-8 image brief file")
request={'model': 'gpt-image-2.5-latest', 'prompt': ''}
request["prompt"]=f.read_text(encoding="utf-8")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.images.generate(**request)
Path("sdk-result.txt").write_text(str(result),encoding="utf-8")
save_images([{"b64_json":getattr(item,"b64_json",None),"url":getattr(item,"url",None)} for item in result.data])
import OpenAI from "openai";
import { readFileSync, writeFileSync } from "node:fs";
const key=process.env.AILOOT_API_KEY;
if(!key) throw new Error("Set your actual Ailoot API key");
const client=new OpenAI({baseURL:"https://api.ailoot.ai/v1",apiKey:key,maxRetries:0});
const request={"model": "gpt-image-2.5-latest", "prompt": ""};
if(!process.env.AILOOT_PROMPT_FILE)throw new Error("Set your actual UTF-8 image brief file");
request.prompt=readFileSync(process.env.AILOOT_PROMPT_FILE,"utf8");
const result=await client.images.generate(request);
writeFileSync("sdk-result.json",JSON.stringify(result,null,2));
if(!result.data?.length) throw new Error("No completed images");
for(let index=0;index<result.data.length;index++) {
const item=result.data[index];let encoded=item.b64_json,uri=item.url||"",raw;
if(!encoded && uri.startsWith("data:image/")) {
const comma=uri.indexOf(",");if(comma<0 || !uri.slice(0,comma).includes(";base64")) throw new Error("Unsupported image data URI");
encoded=uri.slice(comma+1);
}
if(encoded) {
if(encoded.length%4!==0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) throw new Error("Invalid Base64");
raw=Buffer.from(encoded,"base64");
} else if(uri) {
const u=new URL(uri,"https://api.ailoot.ai");
if(u.protocol!=="https:" || u.username || u.password) throw new Error("Invalid returned URL");
const owned=u.origin==="https://api.ailoot.ai" && u.pathname.startsWith("/v1/media/assets/") && u.pathname.endsWith("/content");
const response=await fetch(u,{headers:owned?{Authorization:"Bearer "+key}:{},redirect:"manual"});
if(!response.ok) throw new Error("Image content download failed: "+response.status);
raw=Buffer.from(await response.arrayBuffer());
} else throw new Error("Image has neither bytes nor URL");
if(!raw.length) throw new Error("Empty image result");
const ext=raw.subarray(0,4).equals(Buffer.from([137,80,78,71]))?"png":raw[0]===255&&raw[1]===216?"jpg":raw.toString("ascii",0,4)==="RIFF"&&raw.toString("ascii",8,12)==="WEBP"?"webp":raw.toString("utf8").trimStart().startsWith("<svg")||raw.toString("utf8").trimStart().startsWith("<?xml")?"svg":"bin";
writeFileSync(`image-${index}.${ext}`,raw);
}
console.log("Every returned image saved; sdk-result.json retains complete metadata");
Receive and save results
Ailoot · Images
Download each returned image or save its Base64 contents
GET /v1/media/tasks/{task_id}GET /v1/media/assets/{asset_id}/contentGET /v1/media/assetsGET /v1/media/assets/{asset_id}
Keep all completed results
Save every completed image; retrieve each returned URL or decode its Base64 contents.
Save every data item. Decode each b64_json or fetch every returned signed URL. Select a filename extension from the actual MIME/bytes.
If the original response needs checking
If an image generation or edit result requires a check, keep the original operation_id/X-Client-Request-ID and returned result information. Recover existing owned results through the media library using actual task_id or asset_id values. Do not resubmit the generation/edit request or construct a polling URL from operation_id.
Response fields
| Field | Type |
|---|---|
Fieldcreated | Typeinteger |
Fielddata[].url | Typestring |
Fielddata[].b64_json | Typebase64 string |
Fieldusage | Typeobject |
Errors and next steps
| Response | Condition | Next step |
|---|---|---|
Response400 · invalid_request_error | ConditionInvalid required fields, material representation or parameter value | Next stepCorrect the indicated fields before a new creation request. |
Responseserver_error | ConditionThe returned response says the operation or result requires a check | Next stepKeep the original returned operation/task ID, request headers and response; continue supported reads of that original operation. Do not resubmit the creation request. |
Aliases
Model aliases
Ailoot gpt-image-2.5-sunburst, gpt-image, gpt-image-2.5, gpt-image-2.5-latest, gpt-image-latest
Method path aliases
Use the method paths shown above.
Related caller IDs
gpt-image-2.5-sunburst, gpt-image, gpt-image-2.5, gpt-image-2.5-latest, gpt-image-latest
Ailoot · Images POST /v1/images/generations gpt-image-latest
gpt-image-latestgpt-image-2.5-sunburstgpt-imagegpt-image-2.5gpt-image-2.5-latestgpt-image-latest
Overview
GPT Image 2.5 Sunburst creates images from text prompts. Supports custom sizes, extended quality levels and transparent backgrounds; the manufacturer also highlights editing fidelity.
- Accepted inputs
- Text
- Results
- Images
Available in Ailoot · inputs & methods
Ailoot · Images POST /v1/images/generations
- Input types
text- Output types
image- Output format
- Image file
| Field | Type | Requirement | Values & limits | Default |
|---|---|---|---|---|
Fieldmodel | Typestring | RequirementRequired | Values & limits gpt-image-latest | Default— |
Fieldprompt | Typestring | RequirementRequired | Values & limits Minimum length: 1 | Default— |
Fieldn | Typeinteger | RequirementOptional | Values & limits Minimum: 1 | Default1 |
Fieldresponse_format | Typestring | RequirementOptional | Values & limits url, b64_json | Default— |
Fieldstream | Typeboolean | RequirementOptional | Values & limits | Defaultfalse |
Fieldsize | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldquality | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldbackground | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldoutput_format | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldoutput_compression | Typeinteger | RequirementOptional | Values & limits Model-specific | Default— |
Fieldmoderation | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldinput_fidelity | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldstyle | Typestring | RequirementOptional | Values & limits Model-specific | Default— |
Fieldpartial_images | Typeinteger | RequirementOptional | Values & limits Model-specific | Default— |
Input material combinations
Text to image · Required: prompt
Method parameters and lifecycle
| Parameter | Contract |
|---|---|
Parametermaterial_types | Contracttext |
Parameterrequired | Contractmodel, prompt |
Parameteroptional_controls | Contractnull |
Parametercontent_type | Contractapplication/json |
Lifecycle: synchronous_result_then_owned_library
GET /v1/media/tasks/{task_id} · actual returned task_id or media library record
GET /v1/media/assets/{asset_id}/content
GET /v1/media/assets
GET /v1/media/assets/{asset_id}
Method shapes and IDs are exact; supplier capability is separate from admission.
Pricing
Ailoot method rates
POST /v1/images/generations- Text input
- $0.005 / 1K
- Image input
- $0.008 / 1K tokens
- Image output
- $0.03 / 1K tokens
Ailoot reserves an estimated amount before a request. After the result, it settles the final charge from measured usage. Streaming settlement uses the final usage record. How reservation and settlement work →
Example requests
Ailoot · Images
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
export AILOOT_API_KEY
: "${AILOOT_PROMPT_FILE:?Set your actual UTF-8 image brief}"
export AILOOT_PROMPT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gpt-image-latest", "prompt": ""}')
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 brief")
p['prompt']=f.read_text(encoding="utf-8")
if not p['prompt'].strip():raise SystemExit("Brief must contain text")
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
-H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
--data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
from openai import OpenAI
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Set your actual UTF-8 image brief file")
request={'model': 'gpt-image-latest', 'prompt': ''}
request["prompt"]=f.read_text(encoding="utf-8")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.images.generate(**request)
Path("sdk-result.txt").write_text(str(result),encoding="utf-8")
save_images([{"b64_json":getattr(item,"b64_json",None),"url":getattr(item,"url",None)} for item in result.data])
import OpenAI from "openai";
import { readFileSync, writeFileSync } from "node:fs";
const key=process.env.AILOOT_API_KEY;
if(!key) throw new Error("Set your actual Ailoot API key");
const client=new OpenAI({baseURL:"https://api.ailoot.ai/v1",apiKey:key,maxRetries:0});
const request={"model": "gpt-image-latest", "prompt": ""};
if(!process.env.AILOOT_PROMPT_FILE)throw new Error("Set your actual UTF-8 image brief file");
request.prompt=readFileSync(process.env.AILOOT_PROMPT_FILE,"utf8");
const result=await client.images.generate(request);
writeFileSync("sdk-result.json",JSON.stringify(result,null,2));
if(!result.data?.length) throw new Error("No completed images");
for(let index=0;index<result.data.length;index++) {
const item=result.data[index];let encoded=item.b64_json,uri=item.url||"",raw;
if(!encoded && uri.startsWith("data:image/")) {
const comma=uri.indexOf(",");if(comma<0 || !uri.slice(0,comma).includes(";base64")) throw new Error("Unsupported image data URI");
encoded=uri.slice(comma+1);
}
if(encoded) {
if(encoded.length%4!==0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) throw new Error("Invalid Base64");
raw=Buffer.from(encoded,"base64");
} else if(uri) {
const u=new URL(uri,"https://api.ailoot.ai");
if(u.protocol!=="https:" || u.username || u.password) throw new Error("Invalid returned URL");
const owned=u.origin==="https://api.ailoot.ai" && u.pathname.startsWith("/v1/media/assets/") && u.pathname.endsWith("/content");
const response=await fetch(u,{headers:owned?{Authorization:"Bearer "+key}:{},redirect:"manual"});
if(!response.ok) throw new Error("Image content download failed: "+response.status);
raw=Buffer.from(await response.arrayBuffer());
} else throw new Error("Image has neither bytes nor URL");
if(!raw.length) throw new Error("Empty image result");
const ext=raw.subarray(0,4).equals(Buffer.from([137,80,78,71]))?"png":raw[0]===255&&raw[1]===216?"jpg":raw.toString("ascii",0,4)==="RIFF"&&raw.toString("ascii",8,12)==="WEBP"?"webp":raw.toString("utf8").trimStart().startsWith("<svg")||raw.toString("utf8").trimStart().startsWith("<?xml")?"svg":"bin";
writeFileSync(`image-${index}.${ext}`,raw);
}
console.log("Every returned image saved; sdk-result.json retains complete metadata");
Receive and save results
Ailoot · Images
Download each returned image or save its Base64 contents
GET /v1/media/tasks/{task_id}GET /v1/media/assets/{asset_id}/contentGET /v1/media/assetsGET /v1/media/assets/{asset_id}
Keep all completed results
Save every completed image; retrieve each returned URL or decode its Base64 contents.
Save every data item. Decode each b64_json or fetch every returned signed URL. Select a filename extension from the actual MIME/bytes.
If the original response needs checking
If an image generation or edit result requires a check, keep the original operation_id/X-Client-Request-ID and returned result information. Recover existing owned results through the media library using actual task_id or asset_id values. Do not resubmit the generation/edit request or construct a polling URL from operation_id.
Response fields
| Field | Type |
|---|---|
Fieldcreated | Typeinteger |
Fielddata[].url | Typestring |
Fielddata[].b64_json | Typebase64 string |
Fieldusage | Typeobject |
Errors and next steps
| Response | Condition | Next step |
|---|---|---|
Response400 · invalid_request_error | ConditionInvalid required fields, material representation or parameter value | Next stepCorrect the indicated fields before a new creation request. |
Responseserver_error | ConditionThe returned response says the operation or result requires a check | Next stepKeep the original returned operation/task ID, request headers and response; continue supported reads of that original operation. Do not resubmit the creation request. |
Aliases
Model aliases
Ailoot gpt-image-2.5-sunburst, gpt-image, gpt-image-2.5, gpt-image-2.5-latest, gpt-image-latest
Method path aliases
Use the method paths shown above.
Related caller IDs
gpt-image-2.5-sunburst, gpt-image, gpt-image-2.5, gpt-image-2.5-latest, gpt-image-latest
FAQ · GPT Image 2.5 Sunburst
- What inputs and results are available?
POST /v1/images/generations·gpt-image-2.5-sunburst:text→imagePOST /v1/images/generations·gpt-image:text→imagePOST /v1/images/generations·gpt-image-2.5:text→imagePOST /v1/images/generations·gpt-image-2.5-latest:text→imagePOST /v1/images/generations·gpt-image-latest:text→image- Which fields does the request use?
POST /v1/images/generations·gpt-image-2.5-sunburst:model,prompt,n,response_format,streamPOST /v1/images/generations·gpt-image:model,prompt,n,response_format,streamPOST /v1/images/generations·gpt-image-2.5:model,prompt,n,response_format,streamPOST /v1/images/generations·gpt-image-2.5-latest:model,prompt,n,response_format,streamPOST /v1/images/generations·gpt-image-latest:model,prompt,n,response_format,stream- What limits apply?
POST /v1/images/generations·gpt-image-2.5-sunburst:n.minimum:1POST /v1/images/generations·gpt-image:n.minimum:1POST /v1/images/generations·gpt-image-2.5:n.minimum:1POST /v1/images/generations·gpt-image-2.5-latest:n.minimum:1POST /v1/images/generations·gpt-image-latest:n.minimum:1