gpt-image-2 API — Access via an AI API Gateway
Key facts (price checked 2026-11-14): gpt-image-2 is billed $0.009 per image, same price at 1K / 2K / 4K. Text-to-image:
POST /v1/images/generations; image editing:POST /v1/images/edits(up to 6 reference images, ≤8 MB each). Use a token in themedia / media-gengroup.
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 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.009 (same price at 1K / 2K / 4K), so you only pay for what you use, and image requests that fail are generally not charged — if you think a failed request was billed, contact support with the request details.
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 · 2K · 4K | ≤6 | Per image | $0.009 / 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.
- Image requests that fail are generally not billed; if you think you were charged for a failed request, contact support with the request details.
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 6, 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 6 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 supports 1K / 2K / 4K at the same price, e.g. "1024x1024" (1:1), "2048x2048" (2K). Defaults to 1:1 if omitted | |
image | Image-to-image | ✅ | Reference image file field, repeatable; up to 6, 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.009/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.
- Failed requests generally not charged — image requests that aren't processed successfully are generally not billed; if you think one was, contact support with the request details.
- Multi-reference image-to-image —
/v1/images/editssupports multiple reference images per request (up to 6 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) and the other image models. - Pay-as-you-go, no subscription — top up with USDT or Alipay and pay only for what you use.
Related Links
- 🛒 Wholesale media API — image pricing — all media models, posted per-unit prices
- 🖼 Image API pricing compared — gpt-image-2 vs gpt-image-2.5 and the Nano Banana models, with official list prices
- Full Image Generation Guide — all image models, resolutions, and reference-image limits
- Calling via API (Image) — 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.009 per image (same price at 1K / 2K / 4K) — 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 image requests that fail are generally not charged — if you think a failed request was billed, contact support with the request details.
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 6, 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 6 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 models, all billed transparently by usage.
Is OpenAI shutting down gpt-image-2?
The OpenAI Deprecations page marked gpt-image-2 (and gpt-image-2-2026-04-21) as deprecated on 2026-11-10, with a shutdown date of 2027-02-10 on the official API. The listed replacements are gpt-image-2.6-sunburst or gpt-image-2.6-flare (checked 2026-11-14). gpt-image-2 currently works as usual on byesu; this page will be updated with what happens around the shutdown date. Source: OpenAI Deprecations.