gpt-image-2 API — Access via an AI API Gateway
Generate images with OpenAI's gpt-image-2 through byesu — an AI API gateway with OpenAI-compatible and Anthropic-native endpoints, one key for Claude / GPT-5.6 / Grok / Gemini plus image and video models, billed pay-as-you-go with no subscription. gpt-image-2 handles both text-to-image and, using reference images, image-to-image workflows (retouching, style transfer, multi-image compositing). It is billed per image at $0.01 (1K resolution), so you only pay for what you use, and failed media tasks are refunded automatically.
byesu uses official routing (no reverse-engineering, no mirrors, no cracked clients), so models are not degraded and pricing is transparent. gpt-image-2 speaks the standard OpenAI image interface, so your existing image generation code needs almost no changes — just a new base URL and key.
Pricing
| Model | Resolution | Reference Images | Billing | Price |
|---|---|---|---|---|
gpt-image-2 | 1K | ≤3 | Per image | $0.01 / image |
- Billed per image: you're charged for each image generated, and nothing when none is generated.
- The console shows a live comparison of the actual billed price against the official list price, so the multiplier is transparent and price changes are tracked automatically.
- If a media task (image / video) fails, you're refunded automatically — no wasted charges.
How to Call
Base URL: https://byesu.com/v1 · Auth header: Authorization: Bearer sk-your-token
Your token must use the media group
Image models are only available under the media / media-gen group. Go to Console → Tokens and create a new token with that group, otherwise you'll get a "no available channel" error.
Text-to-Image · curl
Call POST /v1/images/generations. It synchronously returns the image as base64 (in data[0].b64_json):
curl https://byesu.com/v1/images/generations \
-H "Authorization: Bearer sk-YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A golden retriever running through a golden wheat field at dusk, cinematic, shallow depth of field",
"size": "1024x1024"
}'Response:
{ "data": [ { "b64_json": "<base64 string>" } ] }Text-to-Image · Python
import base64, requests
resp = requests.post(
"https://byesu.com/v1/images/generations",
headers={"Authorization": "Bearer sk-YOUR_TOKEN"},
json={
"model": "gpt-image-2",
"prompt": "Cyberpunk city at night, neon reflections on wet streets, rainy, photorealistic",
"size": "1024x1024",
},
).json()
# Save image (base64 returned synchronously)
img = base64.b64decode(resp["data"][0]["b64_json"])
open("out.png", "wb").write(img)Image-to-Image (Reference Images) · curl
Call POST /v1/images/edits with multipart/form-data. Reference images are uploaded as files (field name image, repeatable to send multiple; gpt-image-2 accepts up to 3, each ≤8MB):
curl https://byesu.com/v1/images/edits \
-H "Authorization: Bearer sk-YOUR_TOKEN" \
-F model="gpt-image-2" \
-F prompt="Blend these two photos into a watercolor painting" \
-F size="1024x1024" \
-F image=@ref1.png \
-F image=@ref2.pngImage-to-Image · Python
import base64, requests
resp = requests.post(
"https://byesu.com/v1/images/edits",
headers={"Authorization": "Bearer sk-YOUR_TOKEN"},
data={
"model": "gpt-image-2",
"prompt": "Turn this photo into a watercolor painting style",
"size": "1024x1024",
},
files=[
("image", ("ref1.png", open("ref1.png", "rb"), "image/png")),
# up to 3 reference images
],
).json()
open("edited.png", "wb").write(base64.b64decode(resp["data"][0]["b64_json"]))The response format is the same as text-to-image.
Key Parameters
| Field | Endpoint | Required | Notes |
|---|---|---|---|
model | Both | ✅ | Always gpt-image-2; case and hyphens must match the console exactly |
prompt | Both | ✅ | The text prompt; being specific (subject + scene + style + lighting) gives better results |
size | Both | Width×height in pixels, which sets the aspect ratio; gpt-image-2 is 1K-tier, e.g. "1024x1024" (1:1). Defaults to 1:1 if omitted | |
image | Image-to-image | ✅ | Reference image file field, repeatable; up to 3, each ≤8MB |
Common aspect ratios
1:1 (1024x1024), 16:9, 9:16, 4:3, 3:4, and so on — just express the width/height in pixels via size.
Why Use byesu for gpt-image-2
- Official routing, no quality degradation — requests reach the real gpt-image-2, not a reverse-engineered or mirrored stand-in, so image quality matches the official service.
- One gateway endpoint — request
https://byesu.com/v1directly with yoursk-token; no extra infrastructure to run or maintain. - Transparent per-image billing — $0.01/image, pay-as-you-go; the console shows the actual billed price against the official list price in real time, with the multiplier out in the open.
- Auto-refund on failure — failed media tasks aren't charged; the platform takes on the risk.
- Multi-reference image-to-image —
/v1/images/editssupports multiple reference images per request (up to 3 for gpt-image-2) for compositing, retouching, and style transfer. - OpenAI-compatible — standard interface format; existing OpenAI image generation code just needs a new
base_urland key to run. - One key, whole platform — the same token also works with text models (
/v1/chat/completions; Claude additionally supports Anthropic's native/v1/messages), video models, and more. - Pay-as-you-go, no subscription — top up with USDT, Alipay or WeChat Pay and pay only for what you use.
Related Links
- Full Image Generation Guide — all image models, resolutions, and reference-image limits
- Calling via API (Image / Video) — endpoints, parameters, and response formats in detail
- Quickstart (3 Steps) — get a key, set the address, pick a model
- Choosing a Group — why image models need
media / media-gen - Console · Sign Up and Create a Token — after logging in, go to "Tokens" and create a media-group token
- Online Generation Playground — no code, generate images right in your browser
FAQ
How do I get gpt-image-2 API access?
Sign up at the byesu console, create a token in the media / media-gen group, and call gpt-image-2 through the OpenAI-compatible /v1/images/generations (text-to-image) and /v1/images/edits (image-to-image) endpoints. One key also covers Claude, GPT-5.6, Grok and Gemini, billed pay-as-you-go with no subscription. A token from the wrong group triggers a "no available channel" error.
How much does the gpt-image-2 API cost per image?
On byesu, gpt-image-2 is billed per image at $0.01 per image (1K resolution) — you are charged for each image generated and nothing when none is. The console shows your live billed price next to the official list price, and failed media tasks are refunded automatically.
How do I call gpt-image-2, and which endpoints does it use?
Two OpenAI-compatible endpoints: text-to-image uses POST /v1/images/generations (JSON, synchronously returns base64 in data[0].b64_json); image-to-image uses POST /v1/images/edits (multipart, reference images go in the image file field, up to 3, each ≤8MB). This page has ready-to-run curl and Python examples.
How many reference images does gpt-image-2 support?
gpt-image-2 image-to-image supports up to 3 reference images, each no larger than 8MB. Upload them by repeating the image file field on /v1/images/edits — useful for image compositing, retouching, and style transfer.
Can I use byesu models in Claude Code or other client apps?
Image models are called via the API. For text and coding workloads, byesu works as a drop-in gateway: set base_url to https://byesu.com/v1 (OpenAI-compatible) or https://byesu.com (Anthropic-native, e.g. ANTHROPIC_BASE_URL for Claude Code), then paste your sk- token. Cherry Studio, Codex, and Claude Code are all supported — see docs.byesu.com/guide/quickstart.
Is gpt-image-2 on byesu the official model?
Yes. byesu uses official routing — not reverse-engineered, not a mirror, not a cracked client — so image quality matches the official service. The same token can also call text and video models, all billed transparently by usage.
