# 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 uuidimport 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());
{ "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 uuidimport 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());
{ "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 uuidimport 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());
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.
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:
The following are JSON request bodies for POST /v1/images/generations. Use the authentication and recommended headers described above. Replace the reference image placeholders with real, accessible image URLs.
{ "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}
{ "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" ]}
{ "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" ]}
{ "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}