CLI tool
Backends & troubleshooting
One subscription meters two buckets; which you spend depends on where the image is made. The default auto prefers sparing Codex-usage.
Two backends
- web (default, no Codex-usage) — drives your logged-in ChatGPT browser like a normal chat, deleted afterwards. Needs a signed-in Chrome + chrome-use.
- codex (fallback, bills Codex-usage) — headless POST to the Codex endpoint. Needs
codex login.
auto uses web when a logged-in browser is reachable, else falls back to codex — a laptop with Chrome open uses web, a headless server uses codex. Force with --backend web/codex.
chatgpt-imagegen doctor first to see which backend is ready. web reaches a browser two ways: relay (your already-open Chrome — needs the chrome-use extension connected) and profile launch (copies a logged-in profile into its own window). Fixes: ① chrome-use extension install and connect the relay (best, no Codex-usage); ② fully quit Chrome and rerun; ③ --backend codex as a headless fallback.Concurrency
web runs serialized (1 at a time — shared Chrome, hard page rate-limit); codex runs up to 4 in parallel. Firing more is safe — excess queues. Quota is shared with the ChatGPT app; don't sustain >10 images/min.
When NOT to use this
For true quality=high, native transparent backgrounds, deterministic per-call billing, a public-facing service (powering one with a personal subscription violates OpenAI's ToS), or sustained high volume — use the official /v1/images/generations API with an OPENAI_API_KEY.
by 郭立 · Guo Li · leeguoo · Blog · GitHub