Skip to main content

Start With the Token Group

For GPT Image 2, the token group decides which route your request uses. The same gpt-image-2 model name maps to different routes in the default group, the Sora2Official group, and the GPTImage2 Enterprise group.

Default Group: Legacy Routes

Per-call billing. gpt-image-2 is the default standard route, gpt-image-2-vip is the size-enhanced route, and both are $0.03/call.

Sora2Official: Mixed Official Transit

Mixed AZ + official-key group. The model name is still gpt-image-2, and the request shape matches the official Images API.

GPTImage2 Enterprise: Pure Official Key

Pure official-key routing, billed at official pricing +20% to cover tax and operating cost, not profit markup.
Check the token group first, then the model name. Default-group gpt-image-2, Sora2Official gpt-image-2, and GPTImage2 Enterprise gpt-image-2 share the same model name but have different routing, billing, and stability positioning.

Online Test

You can test the output first at yingtu.ai, then move the prompt into your API integration.

Route Matrix

Token groupModel nameRouteBillingsizequalityAvailable endpoints
Default groupgpt-image-2Default standard route$0.03/callNot supportedNot supportedImages generation, Images edits
Default groupgpt-image-2-vipSize-enhanced route$0.03/call30 explicit 1K/2K/4K sizesNot supportedImages generation, Images edits
Sora2Officialgpt-image-2Mixed AZ + official-key APISame as official pricingSupportedSupportedImages generation, Images edits
GPTImage2 Enterprisegpt-image-2Pure official-key APIOfficial pricing +20%SupportedSupportedImages generation, Images edits

Which Route Should You Use?

NeedUse
Quick access without size controlDefault-group gpt-image-2
Default-group route with explicit 1K/2K/4K image size controlDefault-group gpt-image-2-vip
Existing official OpenAI GPT Image 2 code with full parameter compatibilitySora2Official or GPTImage2 Enterprise gpt-image-2
quality or more official parametersSora2Official or GPTImage2 Enterprise gpt-image-2
Production workloads that prioritize stable pure official-key routingGPTImage2 Enterprise gpt-image-2

Base Configuration

All routes use the same OpenAI-compatible gateway URL:
export LAOZHANG_API_KEY="sk-your-token"
export BASE_URL="https://api.laozhang.ai/v1"
Do not set the base URL to a model-specific path. The actual route is determined by the token group and the model field.

Parameter Support

Default-group gpt-image-2

Default-group gpt-image-2 is the legacy ChatGPT web route. Use it when you want the simplest integration and do not need size control.
  • size: not supported
  • quality: not supported
  • Price: $0.03/call

Default-group gpt-image-2-vip

Default-group gpt-image-2-vip is the size-enhanced route. Use it when you need an explicit output size on the default group.
  • size: supported for 1K, 2K, and 4K outputs, with 30 explicit pixel values
  • quality: not supported; do not include quality in the request body
  • Price: $0.03/call
For gpt-image-2-vip, pass an explicit pixel value in size; do not use auto. Common defaults are 2048x2048, 2048x1152, and 1152x2048; use the 4K tier for final large assets.
Ratio1K size2K size4K size
1:11280x12802048x20482880x2880
2:3848x12801360x20482336x3520
3:21280x8482048x13603520x2336
3:4960x12801536x20482480x3312
4:31280x9602048x15363312x2480
4:51024x12801632x20482560x3216
5:41280x10242048x16323216x2560
9:16720x12801152x20482160x3840
16:91280x7202048x11523840x2160
21:91280x5442048x8643840x1632
gpt-image-2-vip supports 4K size values, but it is still a default-group route, not the official GPT Image 2 API. Use gpt-image-2 under the Sora2Official or GPTImage2 Enterprise group when you need quality, full official parameter compatibility, or a request body that exactly matches official OpenAI code.

Sora2Official-group gpt-image-2

Sora2Official gpt-image-2 is the mixed AZ + official-key official API forwarding API route. Billing is usage-based with the same pricing as the official OpenAI GPT Image 2 API.

GPTImage2 Enterprise-group gpt-image-2

GPTImage2 Enterprise gpt-image-2 is the pure official-key API route, suitable for production calls that need higher route stability and official API compatibility. Billing is official pricing +20% to cover tax and operating cost, not profit markup.

Shared Parameters for Official-Compatible Groups

Setup:
  1. Create a new token in the console.
  2. Select Sora2Official for the mixed official route, or GPTImage2 Enterprise when you want the pure official-key route.
  3. Keep model="gpt-image-2" in the request body.
  4. Keep the official request body and replace only the base URL and API key.
This route supports official parameters, including size, quality, and other parameters supported by the official API. Common size values:
  • 1024x1024
  • 1536x1024
  • 1024x1536
  • 2048x2048
  • 2048x1152
  • 3840x2160
  • 2160x3840
  • auto
Available quality values:
  • low
  • medium
  • high
  • auto

Endpoint Support

This page documents only the Images API integration path: use /v1/images/generations for text-to-image and /v1/images/edits for image-to-image. In SDKs, these correspond to images.generate and images.edit.
NeedEndpointNotes
Text-to-image/v1/images/generationsReturns data[0].b64_json by default, or data[0].url
Image-to-image/v1/images/editsMultipart local image upload
The Sora2Official and GPTImage2 Enterprise official-compatible routes must use official-style Images API endpoints:
NeedEndpointNotes
Text-to-image/v1/images/generationsMatches the official Images generation endpoint
Image-to-image/v1/images/editsMatches the official Images edit endpoint
For the default-group route, gpt-image-2-vip, and the Sora2Official / GPTImage2 Enterprise official-compatible routes, this guide keeps only Images generation and Images edits as the documented integration methods.

Text-to-Image Examples

Default-group gpt-image-2

Do not pass size or quality.
curl "$BASE_URL/images/generations" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LAOZHANG_API_KEY" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "Create a clean product render of a white ceramic mug on a gray desk, soft natural light, minimal background"
  }'

Default-group gpt-image-2-vip

Pass size only. Do not pass quality. The example below requests a 4K landscape image.
curl "$BASE_URL/images/generations" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LAOZHANG_API_KEY" \
  -d '{
    "model": "gpt-image-2-vip",
    "prompt": "Create a clean product render of a white ceramic mug on a gray desk, soft natural light, minimal background",
    "size": "3840x2160"
  }'

Sora2Official / GPTImage2 Enterprise-group gpt-image-2

Use the official-style Images generation endpoint. You can pass size and quality.
curl "$BASE_URL/images/generations" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LAOZHANG_API_KEY" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "Create a clean product render of a white ceramic mug on a gray desk, soft natural light, minimal background",
    "size": "1536x1024",
    "quality": "high"
  }'

Image-to-Image Examples

Default-group Images Edits

curl "$BASE_URL/images/edits" \
  -H "Authorization: Bearer $LAOZHANG_API_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=Use the provided image as the source. Keep the subject, composition, and text. Only change the sticker to red and add a very thin gold rim to the mug." \
  -F "image=@source.png"

Default-group gpt-image-2-vip Images Edits

curl "$BASE_URL/images/edits" \
  -H "Authorization: Bearer $LAOZHANG_API_KEY" \
  -F "model=gpt-image-2-vip" \
  -F "prompt=Use the provided image as the source. Keep the subject, composition, and text. Only change the sticker to blue." \
  -F "image=@source.png" \
  -F "size=2048x2048"

Sora2Official / GPTImage2 Enterprise-group Images Edits

Official-compatible image editing must use /v1/images/edits, with official-style parameters.
curl "$BASE_URL/images/edits" \
  -H "Authorization: Bearer $LAOZHANG_API_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=Use the provided image as the source. Keep the subject, composition, and text. Only change the sticker to green." \
  -F "image=@source.png" \
  -F "size=1024x1024" \
  -F "quality=high"

Parse Responses

Save Images API b64_json

import base64

value = response["data"][0]["b64_json"]
if value.startswith("data:"):
    value = value.split(",", 1)[1]

value += "=" * ((4 - len(value) % 4) % 4)

with open("output.png", "wb") as f:
    f.write(base64.b64decode(value))

Read an Images API URL

image_url = response["data"][0]["url"]

FAQ

The token group decides the route. Default-group gpt-image-2 is the legacy ChatGPT web route. Sora2Official gpt-image-2 is the mixed AZ + official-key API route. GPTImage2 Enterprise gpt-image-2 is the pure official-key API route.
No. Use gpt-image-2-vip in the default group when you need size control.
No. gpt-image-2-vip supports size, but it does not support quality. Use gpt-image-2 in the Sora2Official or GPTImage2 Enterprise group when you need quality.
Yes. gpt-image-2-vip supports 4K-tier size values, including 3840x2160, 2160x3840, 2880x2880, and 3840x1632. It still does not support quality.
This page keeps only the Images API integration path: use /v1/images/generations for generation and /v1/images/edits for edits.
Create a token under the Sora2Official or GPTImage2 Enterprise group, keep the official request body, replace the base URL with https://api.laozhang.ai/v1, and replace the API key with your LaoZhang API token. Choose GPTImage2 Enterprise when you need the pure official-key route.
The value may include a data:image/png;base64, prefix, or it may need padding at the end. Remove the prefix first, then pad with = before decoding.