How to Use GPT Image 2.5 Flare API
A step-by-step GPT Image 2.5 Flare API tutorial with Python, Node.js and cURL: submit a text to image job, poll it or receive a webhook, and download the image. The example below costs $0.013.
- Endpoints
- 2
- Text to Image · Image Edit
- Example request
- $0.013
- Text to Image
- Languages
- 3
- Python · Node.js · cURL
- Failed runs
- $0
- refunded automatically
Get an API key
Create an account, add credits (from $10) and create a key in Dashboard → API keys. Store it as CHEAPERGEN_API_KEY on your server. Every request sends it as a bearer token.
Choose a GPT Image 2.5 Flare endpoint
Each task has its own endpoint. All of them take a JSON body and return a generation you can poll.
| Task | Endpoint | Required | From |
|---|---|---|---|
| Text to Image | openai/gpt-image-2.5-flare/text-to-image | prompt | $0.0066/image |
| Image Edit | openai/gpt-image-2.5-flare/edit | prompt, image_urls | $0.0066/image |
Submit a text to image job
This program submits the job, polls every 3 seconds until it finishes and prints the image URL. Swap the prompt and settings for your own.
import os, time, requests
API = "https://cheapergen.com/api/v1"
headers = {"Authorization": f"Bearer {os.environ['CHEAPERGEN_API_KEY']}"}
# 1. Submit the job
job = requests.post(f"{API}/run/openai/gpt-image-2.5-flare/text-to-image", headers=headers, json={
"prompt": "A minimalist poster for a jazz night called “BLUE HOUR”, saxophone silhouette, deep blue and brass, clean typography",
"aspect_ratio": "1:1",
"resolution": "1K",
"quality": "medium"
}).json()
# 2. Poll until it finishes (or pass "webhook_url" and skip polling)
while job["status"] in ("queued", "running"):
time.sleep(3)
job = requests.get(f"{API}/generations/{job['id']}", headers=headers).json()
print(job["status"], job["output"]["images"][0]["url"] if job["status"] == "succeeded" else job["error"])Set the parameters that matter
The settings for openai/gpt-image-2.5-flare/text-to-image, with what each one does to the price.
| Parameter | Type · default | What it does | Price effect |
|---|---|---|---|
| aspect_ratio | string (enum) · 1:1 | Output image shape. 1:1 · 3:2 · 2:3 · 4:3 · 3:4 · 5:4 · 4:5 · 16:9 · 9:16 · 21:9 · 9:21 | Yes |
| resolution | string (enum) · 1K | Output size tier: 1K (≈1 MP), 2K (≈4 MP) or 4K (≈8 MP, experimental). 1K · 2K · 4K | 1K: $0.0066/image 2K: $0.0118/image |
| quality | string (enum) · medium | Rendering effort. Higher quality uses more output tokens and costs more; xhigh and max are for final assets. low · medium · high · xhigh · max | Low: $0.0066/image Medium: $0.013/image High: $0.048/image |
Other GPT Image 2.5 Flare endpoints take the same shape with their own inputs:
POST /api/v1/run/openai/gpt-image-2.5-flare/edit
{
"prompt": "Keep the product and its label exactly; replace the background with a soft off-white studio sweep and add a natural shadow",
"image_urls": [
"https://cdn.cheapergen.com/samples/portrait.jpg"
],
"aspect_ratio": "1:1",
"resolution": "1K",
"quality": "medium"
}Get the result
A job moves from queued to running to succeeded, failed or canceled. Poll GET /api/v1/generations/{id}, or pass webhook_url and we POST the result to you. Download the output and store it yourself.
{
"id": "gen_8c2QmX1nq0k4",
"object": "generation",
"model": "openai/gpt-image-2.5-flare",
"endpoint": "openai/gpt-image-2.5-flare/text-to-image",
"mode": "text-to-image",
"status": "succeeded",
"input": {
"prompt": "A minimalist poster for a jazz night called “BLUE HOUR”, saxophone silhouette, deep blue and brass, clean typography",
"aspect_ratio": "1:1",
"resolution": "1K",
"quality": "medium"
},
"output": {
"images": [
{
"url": "https://cdn.cheapergen.com/outputs/gen_8c2Q-0.png",
"content_type": "image/png",
"width": 2048,
"height": 2048
}
]
},
"error": null,
"cost": {
"amount_usd": 0.2255,
"currency": "usd",
"estimated": false,
"official_usd": 0.264,
"saved_usd": 0.0385
},
"source": "api",
"created_at": "2026-10-15T09:21:04Z",
"started_at": "2026-10-15T09:21:06Z",
"completed_at": "2026-10-15T09:22:31Z"
}Price a request before you run it
The quote endpoint is free and needs no key. It returns the price, the official price and your discount for exactly the input you send.
curl -X POST https://cheapergen.com/api/v1/quote/openai/gpt-image-2.5-flare/text-to-image \
-H "Content-Type: application/json" \
-d '{"prompt":"A minimalist poster for a jazz night called “BLUE HOUR”, saxophone silhouette, deep blue and brass, clean typography","aspect_ratio":"1:1","resolution":"1K","quality":"medium"}'| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | A parameter is missing or out of range — the message names it. |
| 401 | unauthorized | Missing, malformed or revoked API key. |
| 402 | insufficient_balance | Not enough credits for the quoted price; top up or enable auto top-up. |
| 429 | rate_limited | Too many requests or generations in progress; back off and retry. |
| 502 | upstream_error | The model provider failed; the hold is refunded and you can retry. |
| 503 | model_unavailable | No healthy route right now; retry later or pick another model. |
FAQ
