# Create once per new generation operation; keep the original value when retrying.
IDEMPOTENCY_KEY="$(uuidgen)"
curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-APIMart-Response-Version: 2026-07-27' \
--header "Idempotency-Key: ${IDEMPOTENCY_KEY}" \
--data '{
"model": "gpt-image-2.5-ext",
"version": "flare",
"prompt": "A cozy reading nook beside a window on a rainy day, a warm table lamp, cinematic lighting",
"size": "1:1",
"resolution": "1K",
"n": 1
}'
import uuid
import requests
# Create once per new generation operation; reuse the original headers and payload when retrying.
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
"X-APIMart-Response-Version": "2026-07-27",
"Idempotency-Key": str(uuid.uuid4()),
}
payload = {
"model": "gpt-image-2.5-ext",
"version": "flare",
"prompt": "A cozy reading nook beside a window on a rainy day, a warm table lamp, cinematic lighting",
"size": "1:1",
"resolution": "1K",
"n": 1,
}
response = requests.post(
"https://api.apimart.ai/v1/images/generations",
headers=headers,
json=payload,
)
print(response.status_code, response.json())
// Create once per new generation operation; reuse the original headers and body when retrying.
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
"X-APIMart-Response-Version": "2026-07-27",
"Idempotency-Key": crypto.randomUUID(),
};
const body = JSON.stringify({
model: "gpt-image-2.5-ext",
version: "flare",
prompt: "A cozy reading nook beside a window on a rainy day, a warm table lamp, cinematic lighting",
size: "1:1",
resolution: "1K",
n: 1,
});
const response = await fetch(
"https://api.apimart.ai/v1/images/generations",
{ method: "POST", headers, body },
);
console.log(response.status, await response.json());
{
"code": 202,
"request_id": "req_example",
"data": {
"id": "task_01EXAMPLE",
"object": "generation.task",
"type": "image",
"status": "pending",
"progress": 0,
"poll_url": "/v1/tasks/task_01EXAMPLE"
}
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01EXAMPLE"
}
]
}
{
"error": {
"message": "n must be an integer between 1 and 4",
"type": "invalid_request_error",
"param": "",
"code": "invalid_request_error"
}
}
GPT-Image-2.5 Ext
GPT-Image-2.5 Ext Image Generation
- Use gpt-image-2.5-ext and select Flare or Sunburst with version
- Asynchronous processing: query results using the task ID after submission
- Supports text-to-image and image-to-image with up to 16 reference images
- Supports 10 aspect ratios and auto, with 1K / 2K / 4K resolution tiers
- Generate 1–4 images per request, billed by version, resolution, and the number of images actually delivered
POST
/
v1
/
images
/
generations
# Create once per new generation operation; keep the original value when retrying.
IDEMPOTENCY_KEY="$(uuidgen)"
curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-APIMart-Response-Version: 2026-07-27' \
--header "Idempotency-Key: ${IDEMPOTENCY_KEY}" \
--data '{
"model": "gpt-image-2.5-ext",
"version": "flare",
"prompt": "A cozy reading nook beside a window on a rainy day, a warm table lamp, cinematic lighting",
"size": "1:1",
"resolution": "1K",
"n": 1
}'
import uuid
import requests
# Create once per new generation operation; reuse the original headers and payload when retrying.
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
"X-APIMart-Response-Version": "2026-07-27",
"Idempotency-Key": str(uuid.uuid4()),
}
payload = {
"model": "gpt-image-2.5-ext",
"version": "flare",
"prompt": "A cozy reading nook beside a window on a rainy day, a warm table lamp, cinematic lighting",
"size": "1:1",
"resolution": "1K",
"n": 1,
}
response = requests.post(
"https://api.apimart.ai/v1/images/generations",
headers=headers,
json=payload,
)
print(response.status_code, response.json())
// Create once per new generation operation; reuse the original headers and body when retrying.
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
"X-APIMart-Response-Version": "2026-07-27",
"Idempotency-Key": crypto.randomUUID(),
};
const body = JSON.stringify({
model: "gpt-image-2.5-ext",
version: "flare",
prompt: "A cozy reading nook beside a window on a rainy day, a warm table lamp, cinematic lighting",
size: "1:1",
resolution: "1K",
n: 1,
});
const response = await fetch(
"https://api.apimart.ai/v1/images/generations",
{ method: "POST", headers, body },
);
console.log(response.status, await response.json());
{
"code": 202,
"request_id": "req_example",
"data": {
"id": "task_01EXAMPLE",
"object": "generation.task",
"type": "image",
"status": "pending",
"progress": 0,
"poll_url": "/v1/tasks/task_01EXAMPLE"
}
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01EXAMPLE"
}
]
}
{
"error": {
"message": "n must be an integer between 1 and 4",
"type": "invalid_request_error",
"param": "",
"code": "invalid_request_error"
}
}
# Create once per new generation operation; keep the original value when retrying.
IDEMPOTENCY_KEY="$(uuidgen)"
curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-APIMart-Response-Version: 2026-07-27' \
--header "Idempotency-Key: ${IDEMPOTENCY_KEY}" \
--data '{
"model": "gpt-image-2.5-ext",
"version": "flare",
"prompt": "A cozy reading nook beside a window on a rainy day, a warm table lamp, cinematic lighting",
"size": "1:1",
"resolution": "1K",
"n": 1
}'
import uuid
import requests
# Create once per new generation operation; reuse the original headers and payload when retrying.
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
"X-APIMart-Response-Version": "2026-07-27",
"Idempotency-Key": str(uuid.uuid4()),
}
payload = {
"model": "gpt-image-2.5-ext",
"version": "flare",
"prompt": "A cozy reading nook beside a window on a rainy day, a warm table lamp, cinematic lighting",
"size": "1:1",
"resolution": "1K",
"n": 1,
}
response = requests.post(
"https://api.apimart.ai/v1/images/generations",
headers=headers,
json=payload,
)
print(response.status_code, response.json())
// Create once per new generation operation; reuse the original headers and body when retrying.
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
"X-APIMart-Response-Version": "2026-07-27",
"Idempotency-Key": crypto.randomUUID(),
};
const body = JSON.stringify({
model: "gpt-image-2.5-ext",
version: "flare",
prompt: "A cozy reading nook beside a window on a rainy day, a warm table lamp, cinematic lighting",
size: "1:1",
resolution: "1K",
n: 1,
});
const response = await fetch(
"https://api.apimart.ai/v1/images/generations",
{ method: "POST", headers, body },
);
console.log(response.status, await response.json());
{
"code": 202,
"request_id": "req_example",
"data": {
"id": "task_01EXAMPLE",
"object": "generation.task",
"type": "image",
"status": "pending",
"progress": 0,
"poll_url": "/v1/tasks/task_01EXAMPLE"
}
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01EXAMPLE"
}
]
}
{
"error": {
"message": "n must be an integer between 1 and 4",
"type": "invalid_request_error",
"param": "",
"code": "invalid_request_error"
}
}
Authentication and headers
string
required
The generation and task query endpoints use a platform API Key for Bearer Token authentication. Get a key from the API Key management page.Query the task using an API Key belonging to the same platform user.
Authorization: Bearer YOUR_API_KEY
string
required
Use
application/json for submission. Both text-to-image and image-to-image use a JSON request body.Version selection
| Display name | model | version |
|---|---|---|
| Flare (default) | gpt-image-2.5-ext | flare |
| Sunburst | gpt-image-2.5-ext | sunburst |
Request parameters
string
required
Fixed value:
gpt-image-2.5-ext.string
default:"flare"
Model version. Options:
flare, sunburst.string
required
The prompt for image generation or editing. It must not be empty after trimming leading and trailing whitespace.For image-to-image, describe what to preserve and what to change in the reference images.
string
default:"1K"
Output resolution tier. Options:
1K, 2K, 4K.string
default:"auto"
Output aspect ratio. Choose
auto or one of the following 10 ratios:1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 5:4, 4:5, 21:9.integer
default:"1"
The number of images to generate per request. Must be an integer from
1 to 4.string[]
An array of up to
16 reference images. Omit reference images for text-to-image; include them for image-to-image. Reference images incur no additional charge.Supported input formats:- Accessible image URLs
- Data URL:
data:image/...;base64,...
Usage examples
The following are JSON request bodies forPOST /v1/images/generations. Use the authentication and recommended headers described above. Replace the reference image placeholders with real, accessible image URLs.
Text-to-image
{
"model": "gpt-image-2.5-ext",
"version": "flare",
"prompt": "A sky garden in a futuristic city, early morning mist, architectural photography",
"size": "16:9",
"resolution": "2K",
"n": 1
}
Image-to-image with Sunburst
{
"model": "gpt-image-2.5-ext",
"version": "sunburst",
"prompt": "Preserve the product and packaging text, replace the background with a soft off-white studio setting, and add a natural cast shadow",
"size": "1:1",
"resolution": "2K",
"n": 1,
"image_urls": [
"https://example.com/product.png"
]
}
Multiple reference images and outputs
{
"model": "gpt-image-2.5-ext",
"version": "sunburst",
"prompt": "Use the product in the first image as the subject, take inspiration from the setting in the second image, and create a landscape advertisement",
"size": "16:9",
"resolution": "2K",
"n": 2,
"image_urls": [
"https://example.com/product.png",
"https://example.com/set.jpg"
]
}
Automatic aspect ratio and 4K resolution
{
"model": "gpt-image-2.5-ext",
"version": "flare",
"prompt": "A minimalist key visual for a product launch, choosing a suitable aspect ratio based on the image content",
"size": "auto",
"resolution": "4K",
"n": 1
}
Query task results
Use the task ID to call the task query endpoint:curl --request GET \
--url https://api.apimart.ai/v1/tasks/task_01EXAMPLE \
--header 'Authorization: Bearer <token>'
Successful task
The task ID, timestamps, URLs, and amounts below illustrate the response structure only. They do not represent a real task or actual prices.{
"code": 200,
"data": {
"id": "task_01EXAMPLE",
"status": "completed",
"progress": 100,
"created": 1788912000,
"completed": 1788912045,
"actual_time": 45,
"estimated_time": 300,
"cost": 0.2,
"credits_cost": 2,
"result": {
"images": [
{
"url": [
"https://example.com/output-1.png",
"https://example.com/output-2.png"
],
"expires_at": 1788998445
}
]
}
}
}
Response
integer
Response status code. A successful submission in the unified format returns
200.string
The identifier for this request, used for troubleshooting.
object
The accepted asynchronous task.
Show Task fields
Show Task fields
string
The unique task identifier, used to query task status and image results.
string
Object type. The value is
generation.task.string
Task type. The value is
image.string
The initial status is
pending, indicating that the task has been accepted.integer
Current progress, initially
0.string
The relative path for querying the task, such as
/v1/tasks/task_01EXAMPLE.