GPT Image generation
$0.011 an image. Flat. gpt-image-2-count bills per call, not per token, so you know the cost before you hit send. It speaks the OpenAI Images API, so your existing code only needs a new base URL and API key, and it renders up to 3840x2160 (4K).
Flash API serves the GPT Image models (gpt-image-2, gpt-image-2.5, gpt-image-2.6) through an OpenAI Images API–compatible endpoint for text-to-image and image editing. GPT Image 2.6 can also return animated GIFs. Each model has its own flat per-call price.
How it compares
The official reference price for GPT Image 2 in our catalog is $0.04 per image. Here it's $0.011, roughly 72% less. Same API shape, same model, a quarter of the bill. Cheap, sure. We still show our math.
Before you start
Use the dedicated group
When you create the API key, pick the Image & Video group (图片视频专用分组). GPT Image models are billed per call, so always use the full model name from the table below. Don't drop the -count suffix.
| Item | Value |
|---|---|
| Base URL | https://ai.flashapi.top/v1 |
| Auth | Authorization: Bearer YOUR_API_KEY |
| Models | gpt-image-2-count, gpt-image-2.5-sunburst-count, gpt-image-2.5-flare-count, gpt-image-2.6-sunburst-count, gpt-image-2.6-flare-count |
| Billing | Per call |
Models and pricing
| Model | Family | Reference price |
|---|---|---|
gpt-image-2-count | GPT Image 2 | $0.011 / image |
gpt-image-2.5-sunburst-count | GPT Image 2.5 | $0.014 / image |
gpt-image-2.5-flare-count | GPT Image 2.5 | $0.014 / image |
gpt-image-2.6-sunburst-count | GPT Image 2.6 (GIF support) | $0.014 / image |
gpt-image-2.6-flare-count | GPT Image 2.6 (GIF support) | $0.014 / image |
Models and prices may change. The console and live pricing are the source of truth.
Text-to-image
Create an image
POST /v1/images/generations
Content-Type: application/json
Authorization: Bearer YOUR_API_KEYcurl https://ai.flashapi.top/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2-count",
"prompt": "An orange cat sitting on a windowsill, golden sunset, cinematic",
"size": "1024x1024",
"quality": "low",
"n": 1
}'Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | One of the full model names, e.g. gpt-image-2-count, gpt-image-2.5-flare-count, gpt-image-2.6-flare-count |
prompt | string | Yes | Image prompt |
size | string | No | 1024x1024, 1024x1536, 1536x1024, 2048x2048, 3840x2160, or auto |
quality | string | No | low, medium, or high |
n | integer | No | Number of images. Defaults to 1 |
response_format | string | No | url (default, returns an image link) or b64_json (returns base64) |
Response format
By default you get an image url, valid for 24 hours, so download it soon. Send "response_format": "b64_json" to get base64 instead; decode it and save to a file.
{
"created": 1713772800,
"data": [
{
"url": "https://gpt-image-2.flashapi.top/images/xxxx.png"
}
]
}Image editing
Upload the source image as multipart/form-data. Optionally add a mask to edit only the transparent area.
POST /v1/images/edits
Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-datacurl https://ai.flashapi.top/v1/images/edits \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gpt-image-2-count" \
-F "prompt=Replace the background with a starry night sky" \
-F "size=1024x1024" \
-F "quality=low" \
-F "image=@input.png"For a local edit, add a mask:
curl https://ai.flashapi.top/v1/images/edits \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gpt-image-2-count" \
-F "prompt=Add an orange cat in the transparent area" \
-F "size=1024x1024" \
-F "quality=low" \
-F "image=@input.png" \
-F "mask=@mask.png"| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | One of the full model names, e.g. gpt-image-2-count, gpt-image-2.5-flare-count, gpt-image-2.6-flare-count |
image | file | Yes | Source image, 1 max |
prompt | string | Yes | The edit you want |
mask | file | No | Same dimensions as the source image; transparent pixels mark the area to edit |
size | string | No | Output size |
quality | string | No | low, medium, or high |
n | integer | No | Number of outputs. Defaults to 1 |
The response format matches the text-to-image endpoint.
GIF animations (GPT Image 2.6)
gpt-image-2.6-flare-count and gpt-image-2.6-sunburst-count can return an animated GIF, for both text-to-image and image editing.
1. Prompt: Ask for a GIF in the prompt and describe the motion, e.g. "Generate an animated GIF: an orange cat waving, looping". Don't send output_format=gif; that returns 400.
2. Generate:
curl https://ai.flashapi.top/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
--max-time 300 \
-d '{
"model": "gpt-image-2.6-flare-count",
"prompt": "Generate an animated GIF: an orange cat waving, looping",
"response_format": "url"
}'3. Receive the result:
{
"data": [{ "url": "https://gpt-image-2.flashapi.top/images/xxxx.gif", "width": 439, "height": 390 }],
"output_format": "gif",
"size": "439x390"
}"output_format": "gif"in the response means you got an animation.- With
urlyou get a.giflink that's valid for 24 hours, so download it soon. Withb64_json, the decoded bytes are the GIF file (they start withGIF89a). Pick the file extension from the actual format; don't hard-code.png. - The model picks the size and frame count;
sizehas no effect on GIFs. Expect roughly 200–900 px per side and 8–16 frames. - GIFs take longer than stills, usually 30–150 seconds. Set your client timeout to 300 seconds or more.
- A GIF bills as one image, same price as a still.
Python example
import base64
import os
import requests
api_key = os.environ["FLASH_API_KEY"]
response = requests.post(
"https://ai.flashapi.top/v1/images/generations",
headers={"Authorization": f"Bearer {api_key}"},
json={
"model": "gpt-image-2-count",
"prompt": "A futuristic city at dawn, crisp architectural detail",
"size": "1024x1024",
"quality": "low",
"n": 1,
"response_format": "b64_json",
},
timeout=300,
)
response.raise_for_status()
image_bytes = base64.b64decode(response.json()["data"][0]["b64_json"])
with open("output.png", "wb") as file:
file.write(image_bytes)Troubleshooting
| Symptom | Fix |
|---|---|
model_not_found or "no available channel" | Make sure the model name is complete with the -count suffix, and that the API key belongs to the Image & Video group |
| High-resolution requests time out | Set your client timeout to 300 seconds or more |
| The mask doesn't apply as expected | Check that the mask matches the source image dimensions and the area to edit is transparent |
| The response format isn't what you expected | Set response_format explicitly: url for a link, b64_json for base64 |
| You asked for a GIF but got a still image | Use a 2.6 model, ask for an animated GIF in the prompt, and don't send output_format |