Skip to main content
On LaoZhang API, the token’s group and billing mode, not the model field, decide whether gpt-image-2 is billed per call or by tokens. This guide covers existing GPT Image 2 integrations; new projects should start with GPT Image 2.5.

Choose a token group

Route behind each row:
  • gpt-image-2 in default: standard per-call route
  • gpt-image-2-vip in default: VIP route
  • Sora2Official: official API forwarding, Azure OpenAI and OpenAI keys
  • GPTImage2 Sora2 Enterprise: official API forwarding, official keys only
No group has a platform limit on concurrency or throttling; a 429 comes from upstream capacity, see Concurrency and 429. Non-200 upstream responses aren’t charged. You set the billing mode when you create the token: Per-call (按次计费) or Usage-based (按量计费). Prices are public pricing as of September 24, 2026; see the model and pricing catalog. All four routes use POST /v1/images/generations for text-to-image and POST /v1/images/edits for image-to-image. Both models are also available in another image group (see the console for its name). GPT Image 2.5 adds the Flare and Sunburst variants and the xhigh and max quality tiers.
Don’t put a group name in the model field. You choose the group when you create the token, and the request body still uses model="gpt-image-2". Changing model can’t turn a Per-call token into a Usage-based one.

Which route should you use?

Official-forward pricing

In Sora2Official, gpt-image-2 is billed for actual token usage at OpenAI’s official rates: The GPTImage2 Sora2 Enterprise group costs the official price plus 20% (a 1.2× group multiplier on these rates). Check the multiplier for your token in the console, and contact support for enterprise quotes.

Parameters by route

gpt-image-2 in the default group

The standard per-call route and the simplest integration. It doesn’t accept size or quality, so omit both.

gpt-image-2-vip in the default group

Use it for per-call billing with control over image size and quality:
  • size: common values include 1024x1024, 2048x2048, and 3840x2160.
  • For portrait 4K, test size as 2160x3840 with your production prompt.
  • quality: low, medium, or high.
  • The response usually contains data[0].b64_json and occasionally an image link. Send response_format: "b64_json" to always get Base64, or url for a link that expires.
  • For edits, repeat the image[] field to send several reference images in one request.
  • mask isn’t supported: the model doesn’t reliably limit the edit to the masked area.
  • Transparent backgrounds aren’t supported, and background="transparent" returns a 400. For a transparent PNG, use the GPT Image 2.5 -vip models.
Higher quality takes longer, so use low or medium for previews and batch tests and high for final assets. For official-key routing and OpenAI’s full set of options, use an official-forward group instead.

gpt-image-2 in the official-forward groups

Sora2Official is an official-forward group billed at OpenAI’s official price, served by a mix of Azure OpenAI and OpenAI keys. GPTImage2 Sora2 Enterprise uses official keys only, costs the official price plus 20%, and suits production workloads that need higher route stability.
  1. Create a new Usage-based token in token management.
  2. Select Sora2Official, or GPTImage2 Sora2 Enterprise for official-key-only routing.
  3. Keep model="gpt-image-2" and your official request body. Replace only the base URL and API key.
Use OpenAI’s parameters, and check every field you send on the route you chose. Common values:

Set up

Export the key whose group matches your route, and the OpenAI-compatible base URL:
Keep the base URL at /v1; don’t append a model-specific path. The examples save each response to a JSON file and then extract the image with a small Python script.

Generate an image

Generate with gpt-image-2 (default group)

Don’t send size or quality:

Generate with gpt-image-2-vip

Pass size and quality in the request body:

Generate with official-forward gpt-image-2

Use a Usage-based token from Sora2Official or GPTImage2 Sora2 Enterprise:

Save the image

An Images API response returns each image in data[] in one of two fields:
  • b64_json: Base64 image data, which can start with a data:image/...;base64, prefix or be missing its = padding.
  • url: a download link for the image.
This script handles all of these cases; save it as save_images.py:
save_images.py
Run it on any of the responses above:
The script prints a line such as Saved mug-1.png. Open the image and check its dimensions, then confirm the model, group, and charge in call logs.

Edit an image

Put a local source.png in the current directory. Edits are multipart uploads: pass the file with -F and let cURL set the content type.

Edit with gpt-image-2 (default group)

Edit with gpt-image-2-vip

Edit with official-forward gpt-image-2

Official-forward edits use /v1/images/edits with OpenAI’s parameters:
Check both the requested change and the details that should stay the same in the saved image.

Frequently asked questions

Why does gpt-image-2 behave differently across groups?

The token’s group decides the route: gpt-image-2 is billed per call in default and by tokens through official API forwarding in Sora2Official and GPTImage2 Sora2 Enterprise. Choose a token group compares the routes. If a charge doesn’t match what you expected, check the group and charge of each request in call logs.

Can gpt-image-2 in the default group accept size?

No. Use gpt-image-2-vip for per-call billing with size control, or gpt-image-2 in an official-forward group for OpenAI’s size options.

Can gpt-image-2-vip output 4K images?

Yes. Landscape 4K sizes such as 3840x2160 work. For portrait 4K, test 2160x3840 with your production prompt and check the dimensions of the returned image.

How do I migrate official OpenAI code?

Keep the official request body and swap only the token and base URL:
  1. Create a Usage-based token in Sora2Official, or in GPTImage2 Sora2 Enterprise when you need official-key-only routing.
  2. Keep model="gpt-image-2" and change the base URL to https://api.laozhang.ai/v1.
  3. Use your LaoZhang API key.

Why do response_format and input_fidelity fail on official forwarding?

Remove both fields. Under OpenAI’s rules, GPT Image models always return Base64 image data and don’t support response_format, and gpt-image-2 processes every input image at high fidelity automatically, so input_fidelity can’t be changed. Code migrated from DALL·E or earlier GPT Image models often still sends them. If you need a link to the image, decode b64_json and upload the file to your own storage instead of expecting a URL from the API.

Why do official-forward edits cost more than generation?

Reference images are billed too. gpt-image-2 always processes input images at high fidelity and bills them as image input tokens, so an edit with reference images can use noticeably more input tokens than text-to-image, and each extra reference adds more. Size and quality still set the output tokens. Estimate your budget from usage in a few representative edit requests, and check the actual charge in call logs. Per-call routes aren’t affected by reference images and keep their per-call price.

Why does b64_json decoding fail?

The value often starts with a data:image/png;base64, prefix or is missing its = padding. The script in Save the image handles both. If decoding still fails, check whether the response is actually an error JSON.

Should I move to GPT Image 2.5?

Existing GPT Image 2 integrations can keep running. For new work, use GPT Image 2.5: the -vip models use the same per-call integration as gpt-image-2-vip, and the official-forward models use the same groups and Images API requests as official-forward gpt-image-2. On the official-forward route, the same quality value can use a different number of tokens and take a different time on 2.5, so test your production prompts before switching. See the GPT Image 2.5 guide and its FAQ for model IDs and options.

Sources