Show HN: Generate images from the CLI with a ChatGPT subscription (no API key) A new open-source Python CLI tool called chatgpt-imagegen allows users to generate images from the command line using a ChatGPT subscription without needing an API key. The tool supports two backends—one driving a logged-in Chrome browser and another using the Codex CLI—and works with free-tier accounts. It provides a zero-dependency, single-file solution for developers and AI agents. English | 中文 /leeguooooo/chatgpt-imagegen/blob/main/README.zh-CN.md Generate images using your ChatGPT subscription — no OPENAI API KEY needed. A tiny, zero-dependency Python CLI and AI-agent skill — one file, stdlib only — that generates images with your ChatGPT account, on the command line and for any AI agent. ✨ Works on a free ChatGPT account too.The default web backend just drives the normal ChatGPT web chat, whereeven free-tier users get image generation— so no paid plan, no API key, and no Codex required subject to the free tier's daily image limit . Paid plans simply get higher limits. php chatgpt-imagegen "a watercolor cat sitting on a windowsill" -o cat.png - saved: cat.png 812,344 bytes size=1024x1024 quality=medium OpenAI offers image generation in two completely separate ways: | Path | What you pay | How | |---|---|---| Direct API /v1/images/generations | per-image, on top of an OPENAI API KEY | curl / OpenAI SDK / etc. | ChatGPT subscription Plus / Pro / Team | flat monthly fee | ChatGPT web/desktop app, or the Codex CLI's built-in image gen | The subscription path is invisible to people who don't use the Codex CLI. It runs on ChatGPT's internal backend-api/codex/responses endpoint as a Responses-API tool, authenticated by the OAuth token written into ~/.codex/auth.json when you run codex login . chatgpt-imagegen exposes that capability on the command line and to any AI agent — with two backends that hit different parts of your subscription. The same subscription meters two separate buckets, and which one you spend depends on where the image is generated: | Backend | How it generates | Bucket spent | Needs | |---|---|---|---| web | Drives your already-logged-in ChatGPT browser via chrome-use | ChatGPT conversation — does not touch your metered Codex-usage limit. | Any logged-in chatgpt.com browser free tier works + chrome-use . | codex | Headless POST to backend-api/codex/responses , reusing ~/.codex/auth.json . | Codex-usage the metered bucket . | codex login . | Default auto tries web first to spare Codex-usage and falls back to codex when no logged-in browser is reachable. Force one with --backend web / --backend codex or CHATGPT IMAGEGEN BACKEND . Laptop / desktop Chrome open + signed in → web — no Codex-usage spent. Server / headless agent box → codex — no browser there, so auto falls back on its own. web generates under whatever account that browser is logged into , which may differ from ~/.codex/auth.json — sign the browser into the account whose bucket you want. You need Python 3.10+, a ChatGPT subscription, and at least one backend auto uses whichever is set up, preferring web : codex backend — npm i -g @openai/codex then codex login writes ~/.codex/auth.json . web backend — formerly https://github.com/leeguooooo/chrome-use chrome-use agent-browser-stealth ; it drives your real logged-in Chrome via an extension, which is what passes Cloudflare + ChatGPT's anti-bot check connected to a Chrome signed in to chatgpt.com: curl -fsSL https://raw.githubusercontent.com/leeguooooo/chrome-use/main/install.sh | sh chrome-use extension install then: add the Chrome extension → restart Chrome → sign in to chatgpt.com Extension: Chrome Web Store https://chromewebstore.google.com/detail/agent-browser-stealth/knfcmbamhjmaonkfnjhldjedeobeafmk . Older installs exposing the binary as agent-browser / abs keep working — the CLI accepts both names. No chrome-use ? Nothing breaks and nothing gets installed behind your back: auto mode falls back to codex and prints a one-line tip that installing chrome-use makes generation cost no Codex-usage. Install via skills.sh https://www.skills.sh — works with Claude Code, Codex Agent, Cursor, OpenClaw, etc.: npx skills add leeguooooo/chatgpt-imagegen -g This drops both the agent instructions SKILL.md and the CLI itself into your agent's skill directory. Just ask any compatible agent: "画一张 xxx" / "generate a hero banner for the README" . git clone https://github.com/leeguooooo/chatgpt-imagegen cd chatgpt-imagegen chmod +x chatgpt-imagegen ./chatgpt-imagegen "a tiny pixel-art mushroom" Or put it on your $PATH : sudo install chatgpt-imagegen /usr/local/bin/chatgpt-imagegen That's the entire setup. No pip install , no virtualenv, no daemon. chatgpt-imagegen "