Skip to content

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.

ItemValue
Base URLhttps://ai.flashapi.top/v1
AuthAuthorization: Bearer YOUR_API_KEY
Modelsgpt-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
BillingPer call

Models and pricing ​

ModelFamilyReference price
gpt-image-2-countGPT Image 2$0.011 / image
gpt-image-2.5-sunburst-countGPT Image 2.5$0.014 / image
gpt-image-2.5-flare-countGPT Image 2.5$0.014 / image
gpt-image-2.6-sunburst-countGPT Image 2.6 (GIF support)$0.014 / image
gpt-image-2.6-flare-countGPT 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 ​

http
POST /v1/images/generations
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
bash
curl 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 ​

ParameterTypeRequiredDescription
modelstringYesOne of the full model names, e.g. gpt-image-2-count, gpt-image-2.5-flare-count, gpt-image-2.6-flare-count
promptstringYesImage prompt
sizestringNo1024x1024, 1024x1536, 1536x1024, 2048x2048, 3840x2160, or auto
qualitystringNolow, medium, or high
nintegerNoNumber of images. Defaults to 1
response_formatstringNourl (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.

json
{
  "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.

http
POST /v1/images/edits
Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-data
bash
curl 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:

bash
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"
ParameterTypeRequiredDescription
modelstringYesOne of the full model names, e.g. gpt-image-2-count, gpt-image-2.5-flare-count, gpt-image-2.6-flare-count
imagefileYesSource image, 1 max
promptstringYesThe edit you want
maskfileNoSame dimensions as the source image; transparent pixels mark the area to edit
sizestringNoOutput size
qualitystringNolow, medium, or high
nintegerNoNumber 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:

bash
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:

json
{
  "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 url you get a .gif link that's valid for 24 hours, so download it soon. With b64_json, the decoded bytes are the GIF file (they start with GIF89a). Pick the file extension from the actual format; don't hard-code .png.
  • The model picks the size and frame count; size has 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 ​

python
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 ​

SymptomFix
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 outSet your client timeout to 300 seconds or more
The mask doesn't apply as expectedCheck that the mask matches the source image dimensions and the area to edit is transparent
The response format isn't what you expectedSet response_format explicitly: url for a link, b64_json for base64
You asked for a GIF but got a still imageUse a 2.6 model, ask for an animated GIF in the prompt, and don't send output_format

Next steps ​

One base URL for GPT, Claude and Gemini