Generating Images from the CLI Using ChatGPT's $20 Plan (Without Getting Blocked by Cloudflare)

How OpenAI's Codex CLI Quietly Unlocked Scriptable Image Generation for Paying Users

Most people using ChatGPT's $20-per-month plan think of it as a chat subscription. That's reasonable, because that's how it's marketed - but it undersells what's actually included by a significant margin. Buried inside that flat monthly fee is access to image generation compute that, priced out through any direct API or credits-based system, would cost most active users several times what they're paying. The problem is that getting that compute to do anything useful outside the browser - to slot into a script, a pipeline, a server-side workflow - has historically been an exercise in frustration, mostly because the chatgpt.com website sits behind Cloudflare's bot detection and actively resists automation. A recent, relatively quiet update to OpenAI's Codex tooling changes that picture considerably, and if you're someone who cares about programmatic access to AI capabilities without paying per-image rates, it's worth understanding what just became possible.

Table of Contents

The Hidden Ceiling Inside ChatGPT's Subscription

ChatGPT's $20-per-month subscription gives you higher usage limits, advanced reasoning models, more context etc. What's less obvious is that the plan also gives you access to image generation capabilities that, if you were to buy equivalent compute through a direct API or a pay-as-you-go credits model, would cost far more than $20 in any given month. The image generation quota alone (depending on how aggressively you use it) can represent hundreds, possibly thousands, of dollars in raw compute value.

For users who generate images routinely as part of a workflow - designers, researchers, developers building tools on top of AI output - the subscription starts to look less like a chat product and more like a remarkably cheap LLM compute allocation. The catch, as many of these same users eventually discover, is that getting that compute to play nicely with automated workflows turns out to be more complicated than it should be.

Why Browser Automation and ChatGPT.com Don't Mix (Ft. Cloudflare)

The obvious first instinct for anyone trying to automate ChatGPT is to reach for a browser automation tool - Playwright, Selenium, Puppeteer, or any of the other mature libraries that let you drive a browser programmatically. The instinct makes sense: if you can use ChatGPT through a browser manually, surely you can script that same interaction. What you run into almost immediately, though, is Cloudflare. The chatgpt.com website sits behind Cloudflare's bot detection layer, which is specifically designed to distinguish automated browser sessions from human ones, and it's quite good at it. Standard headless browser setups get caught quickly, login attempts fail silently or get blocked outright, and the usual tricks for making a headless browser look more human (custom user agents, realistic timing, mouse movement simulation) don't get you far enough. The result is that a workflow that feels like it should take an afternoon to build ends up consuming days or weeks, and even then the solution is fragile and breaks whenever Cloudflare updates its detection logic.

There are workarounds. Tools like CloakBrowser are designed specifically to make automated browser sessions look indistinguishable from real ones, and they can work - but the setup complexity is significant, particularly if you're operating in a headless server environment. Getting something like that running inside a command-line-only sandbox, where you might reach for xvfb to simulate a display server, adds another layer of configuration that's easy to get wrong and hard to debug. For most people, the juice stops being worth the squeeze somewhere in the middle of that setup process, and the workflow they wanted to build quietly gets shelved.

Why the Image Generation in Codex Matters More Than the Headlines Suggested

The interesting development from OpenAI's recent release of image generation support in the Codex interface - both the GUI app and the CLI - is not just the feature itself, but what it implies architecturally. When image generation moved into Codex, it also exposed a clean command-line interface for triggering it, which means the entire awkward browser automation problem dissolves. Instead of trying to impersonate a human navigating a webpage (against an actively hostile bot-detection layer), you're making a direct, authenticated CLI call. There's no Cloudflare checkpoint to clear, no headless browser to babysit, no fragile session state to maintain. For users on the $20 plan, this is the access path that actually works - the one that lets you treat image generation as a reliable, scriptable step in a larger workflow rather than something you have to coax out of a browser by hand.

The practical implications are meaningful for anyone building even modest automation around their ChatGPT subscription. Batch image generation pipelines become straightforward. Integration with other CLI tools or shell scripts becomes natural. Running generation tasks inside a CI environment, a remote server, or any headless context stops being a project in itself and becomes a one-liner.

What This Means in Practice (And What to Watch For)

A few things are worth keeping in mind before you build anything serious around this. The $20 plan's image generation quota is generous, but it isn't infinite - and the exact limits aren't always clearly documented, which means heavy usage patterns can hit unexpected ceilings. It's also worth noting that the CLI access is built on top of the same subscription entitlements as the web interface, so the two are sharing the same underlying quota. If you're running automated generation alongside regular manual usage, you'll want to track consumption more carefully than you might if you were just using the chat interface casually. Beyond the quota question, the CLI path is newer and (as with most newly-exposed interfaces) subject to change - command-line arguments that work today may be adjusted as OpenAI iterates on the Codex tooling, so treating the implementation as stable over a long time horizon without checking for updates would be optimistic.

That said, for the right use case - a developer or researcher who needs reliable, scriptable access to image generation without spinning up a full API integration or paying per-image rates - the current setup represents a genuinely useful tool that was much harder to reach just a few weeks ago. The fact that it arrived as a side effect of a different product launch (rather than as a deliberate power-user feature) is worth appreciating, because it's exactly the kind of capability that tends to get quietly useful before it gets widely known.

Without further ado, here is the command:

codex exec --skip-git-repo-check --enable image_generation -C "$PWD" 'Use the imagegen skill. Generate a raster image: A purple cat. Save/copy the final PNG into current working directory.'

Related post