Skip to content
Trang này chưa có bản dịch sang ngôn ngữ của bạn, nên hiện đang được hiển thị bằng tiếng Anh.

GPT-Image-2.5 Image Generation

Choose between gpt-image-2.5-flare and gpt-image-2.5-sunburst

Toàn bộ tài liệu
POST/v1/images/generations
  • Asynchronous processing returns a task_id for status queries
  • Supports text-to-image and image editing with up to 16 reference images
  • Supports local inpainting with transparent PNG masks
  • Supports 15 aspect ratios, exact pixel dimensions, and 1K / 2K / 4K resolution tiers
  • Supports low / medium / high / xhigh / max quality levels

Note

Model selection: gpt-image-2.5-flare is faster and works well for everyday high-quality images, batch generation, and rapid prototyping. gpt-image-2.5-sunburst prioritizes editing precision for production assets, advertising creatives, and detailed multi-turn editing. Both models use the same pricing.

Ví dụ request

curl --request POST \
  --url https://api.apisea.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-image-2.5-flare",
    "prompt": "a cozy reading nook by a rainy window, warm lamp light, cinematic lighting",
    "size": "1:1",
    "resolution": "1k",
    "quality": "medium",
    "n": 1
  }'

Authentication

Authorizationstringrequired

All endpoints use Bearer Token authentication. Get your key from the API Key page.

text
Authorization: Bearer YOUR_API_KEY

Choose a model

ModelStrengthRecommended use
gpt-image-2.5-flareDefault option with faster generationSocial content, product images, visual search, rapid prototypes, and batch generation
gpt-image-2.5-sunburstPrioritizes editing precisionProduction product images, advertising creatives, and detailed multi-turn editing

The two models have identical token usage and pricing for the same parameters. Select one based on the speed-versus-quality tradeoff.

Compared with gpt-image-2, GPT-Image-2.5 adds the xhigh and max quality levels. Its medium and high levels use roughly one quarter of the output tokens of the previous generation's levels with the same names.

Request parameters

modelstringrequired

Image model name: gpt-image-2.5-flare or gpt-image-2.5-sunburst.

nsfw_checkbooleandefault: false

Whether to run content moderation before submitting the image task.

  • true: use omni-moderation-latest to review prompts and input images
  • false or omitted: do not send a moderation request, adding no moderation cost or latency (default)
promptstringrequired

Text description of the image to generate or edit. Describe the subject, scene, composition, style, lighting, and anything that must be preserved or changed.

sizestringdefault: auto

Output aspect ratio or exact pixel dimensions.

  • auto: let the model choose from the prompt or reference images
  • Aspect ratio: 1:1, 3:2, 2:3, 4:3, 3:4, 5:4, 4:5, 16:9, 9:16, 2:1, 1:2, 21:9, 9:21, 3:1, 1:3
  • Exact dimensions, such as 1600x1200

Tip

For image-to-image requests, omit size to let the service calculate dimensions from the input aspect ratio and resolution.

resolutionstringdefault: 1k

Resolution tier used with an aspect-ratio size: 1k, 2k, or 4k. This field is ignored for exact pixel dimensions.

qualitystringdefault: auto

Image quality: low, medium, high, xhigh, max, or auto.

Warning

xhigh and max are supported by GPT-Image-2.5 and GPT-Image-2.6. Sending them to gpt-image-2 returns HTTP 400; the request is not silently downgraded.

nintegerdefault: 1

Number of images to generate. Range: 1 to 4. Pass a number, not a string.

output_formatstringdefault: png

Output file format: png, jpeg, or webp.

output_compressioninteger

Compression level from 0 to 100. Only applies to jpeg and webp.

backgroundstring

Background mode: transparent, opaque, or auto.

Warning

background: "transparent" requires output_format: "png" or output_format: "webp". JPEG has no alpha channel.

moderationstringdefault: low

Content moderation level: auto or low. APISea explicitly sends low when omitted; an explicit auto value is passed through.

image_urlsstring[]

Reference image URLs for image-to-image generation or editing. Up to 16 images are accepted, and including this field activates editing mode.

Only publicly accessible HTTP(S) URLs are accepted. Upload local images with POST /v1/uploads/images, then use the returned url.

mask_urlstring

Mask image for local inpainting. It only takes effect when image_urls is also provided. Both gpt-image-2.5-flare and gpt-image-2.5-sunburst support this parameter.

Pass a single string in either format:

  • An HTTP(S) image URL that the server can download directly
  • A PNG Data URL in the form data:image/png;base64,...

Mask requirements:

  • Use a PNG with an alpha channel; PNG is also recommended for the source image
  • Its pixel dimensions must exactly match image_urls[0]. Match the first input image, not the output size
  • Fully transparent pixels (alpha=0) mark the area to edit; the remaining area is used for preservation
  • Send one mask per request. With multiple reference images, the mask only applies to the first input image
  • The general file-size guide says under 50 MB, while the mask parameter reference says under 4 MB. Until verified, use the stricter 4 MB limit

Warning

A plain black-and-white image without an alpha channel cannot be used directly as a mask. APISea does not add an alpha channel and currently does not prevalidate that the mask dimensions match the source image; the caller must ensure both.

Note

An HTTP(S) URL must work without cookies or additional authorization headers. Signed URLs should remain valid throughout queueing and execution. The default download limit is 20 MB with a 60-second timeout; a deployment may override these defaults.

The mask guides editing, but the model does not guarantee that pixels outside the mask boundary remain completely unchanged.

Size rules

Exact pixel dimensions must satisfy all of these constraints:

  • Width and height are both multiples of 16
  • Neither side exceeds 3840 pixels
  • Long-side to short-side ratio is at most 3:1
  • Total pixel count is between 655,360 and 8,294,400

Warning

Resolutions above 2560×1440 are experimental and may be less stable than common sizes.

Aspect ratio and resolution mapping

size1k2k4k
1:11024×10242048×20482880×2880
3:21536×10242048×13603520×2336
2:31024×15361360×20482336×3520
4:31024×7682048×15363312×2480
3:4768×10241536×20482480×3312
5:41280×10242560×20483216×2576
4:51024×12802048×25602576×3216
16:91536×8642048×11523840×2160
9:16864×15361152×20482160×3840
2:12048×10242688×13443840×1920
1:21024×20481344×26881920×3840
21:92016×8642688×11523840×1648
9:21864×20161152×26881648×3840
3:11536×5123072×10243840×1280
1:3512×15361024×30721280×3840

You may also pass any exact dimensions that satisfy the size rules; they do not need to appear in this table.

Usage examples

Text to image

json
{
  "model": "gpt-image-2.5-flare",
  "prompt": "a sky garden in a futuristic city, morning mist, architectural photography",
  "size": "16:9",
  "resolution": "2k",
  "quality": "high",
  "n": 1
}

Precision editing with Sunburst

json
{
  "model": "gpt-image-2.5-sunburst",
  "prompt": "preserve the product and package text, replace the background with a soft off-white studio, and add a natural shadow",
  "image_urls": ["https://example.com/product.png"],
  "resolution": "2k",
  "quality": "xhigh"
}

Local inpainting with a mask

This example edits only the fully transparent area of the mask. The mask dimensions must match product.png:

json
{
  "model": "gpt-image-2.5-sunburst",
  "prompt": "replace only the area covered by the transparent mask with a gold ribbon, preserving the product and the rest of the background",
  "image_urls": [
    "https://example.com/product.png"
  ],
  "mask_url": "https://example.com/product-mask.png",
  "quality": "xhigh"
}

Transparent background

json
{
  "model": "gpt-image-2.5-flare",
  "prompt": "e-commerce product photo of white sneakers, complete subject, transparent background",
  "size": "1:1",
  "resolution": "2k",
  "quality": "high",
  "background": "transparent",
  "output_format": "png"
}

Submission and task query

Successful submission immediately returns an asynchronous task ID. data is an array; read data[0].task_id.

Call the task status endpoint with the returned ID. Poll every 2–5 seconds until the status becomes completed or failed. Use POST /v1/tasks/batch to query multiple tasks.

json
{
  "code": 200,
  "data": {
    "id": "task_01KXXXXXXXXXXXXXXX",
    "status": "completed",
    "progress": 100,
    "cost": 0.01325,
    "credits_cost": 0.1325,
    "result": {
      "images": [
        {
          "url": ["https://cdn.example.com/f/image/example.png"],
          "expires_at": 1789000000
        }
      ]
    },
    "usage": {
      "input_tokens": 16,
      "output_tokens": 439,
      "total_tokens": 455
    }
  }
}

Image URLs are located at data.result.images[].url[]. Download and store them promptly instead of relying on temporary URLs.

StatusMeaning
submittedTask submitted
processingGeneration in progress
completedGeneration succeeded; result.images is available
failedGeneration failed; check error.message; reserved funds are refunded

Billing

GPT-Image-2.5 is billed by actual token usage. Flare and Sunburst use identical rates. Check the pricing page or /api/pricing for current account pricing.

ItemPrice per 1M tokens
Image output$30.00
Image input$8.00
Cached image input$2.00
Text input$5.00
Cached text input$1.25

1024×1024 output token reference

qualityOutput tokensOfficial output cost
low196$0.00588
medium439$0.01317
high1756$0.05268
xhigh3122$0.09366
max7024$0.21072

Warning

With quality: "auto", the model chooses the actual level at runtime. The service reserves funds using the max level for the selected size and settles against actual usage when the task finishes. Specify quality when available balance matters.

For n > 1, the reservation scales linearly with the requested image count. Final billing uses the number of images actually generated, and failed tasks are refunded automatically.

Output token reference

Values are per generated image. Actual billing also includes prompt and reference-image input tokens.

SizePixelslowmediumhighxhighmax
1:11024×1024196439175631227024
3:21536×1024158343137224595488
2:31024×1536158343137224595488
4:31024×768134301120421404815
3:4768×1024134301120421404815
5:41280×1024173378151027026119
4:51024×1280173378151027026119
16:91536×864120280107819174312
9:16864×1536120280107819174312
2:12048×1024132295118020984720
1:21024×2048132295118020984720
21:92016×86410522594316173682
9:21864×201610522594316173682
3:11536×512561345359372140
1:3512×1536561345359372140
1:1@2k2048×20483978923568634314272
3:2@2k2048×1360211460183832167351
2:3@2k1360×2048211460183832167351
4:3@2k2048×1536247556222339528892
3:4@2k1536×2048247556222339528892
5:4@2k2560×20483778263303591113385
4:5@2k2048×25603778263303591113385
16:9@2k2048×1152157367141325115650
9:16@2k1152×2048157367141325115650
2:1@2k2688×1344180405161728746466
1:2@2k1344×2688180405161728746466
21:9@2k2688×1152143306128522025016
9:21@2k1152×2688143306128522025016
3:1@2k3072×102410324798817293952
1:3@2k1024×307210324798817293952
1:1@4k2880×2880659148359301054223719
3:2@4k3520×23364509823926687015703
2:3@4k2336×35204509823926687015703
4:3@4k3312×248049111044413784517650
3:4@4k2480×331249111044413784517650
5:4@4k3216×257653511734690839319006
4:5@4k2576×321653511734690839319006
16:9@4k3840×21603718653336593013342
9:16@4k2160×38403718653336593013342
2:1@4k3840×19203006752700479910798
1:2@4k1920×38403006752700479910798
21:9@4k3840×1648234500209935988196
9:21@4k1648×3840234500209935988196
3:1@4k3840×1280139332132823245311
1:3@4k1280×3840139332132823245311

Limits and common errors

ItemLimit or handling
Images per request (n)1–4
Reference imagesUp to 16
Output formatPNG / JPEG / WebP
Transparent backgroundPNG / WebP only
Partial streaming imagesNot supported
Unsupported qualityxhigh / max require GPT-Image-2.5 or GPT-Image-2.6
Invalid exact dimensionsUse multiples of 16 within the pixel and aspect-ratio limits

Response

codeinteger

Response status code; 200 when submission succeeds.

dataarray

Submission response data.

Array item

statusstring

Initially submitted.

task_idstring

Unique task ID used to query generation status and results.

Phản hồi

{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KXXXXXXXXXXXXXXX"
    }
  ]
}

Phát hiện lỗi trong tài liệu này? Gửi email đến support@apisea.ai.