Codex CLI: how to generate images (icons, banners) instead of SVG/code output?
I'm using the openai/codex CLI and need it to create visual assets as part of the development workflow. When I ask for an image, it produces SVG or code-based graphics instead of a real AI-generated image. Is there a supported way to get image generation in Codex, or a workaround using the OpenAI API?
Originally asked on GitHub: https://github.com/openai/codex/issues/8758
4 answers
Native image generation in the Codex CLI is not enabled as of this March 2026 discussion. The imagegen skill exists and mentions an image_gen tool, but one commenter said that tool is not enabled yet; another reported the experimental feature as not working and linked PR #15223, and a follow-up clarified that PR is only plumbing for the existing skill, not image generation billed through your account. The issue is marked completed in the tracker, but the thread indicates the capability is still unavailable.
The workaround that worked: prompt Codex to use the OpenAI API to call the image generator directly. A contributor suggested it, and a later comment confirmed it works, but it is billed against API usage, not a ChatGPT Pro subscription. A commenter noted this means the Pro plan cannot be used for this path. The reporter's own generate_image script that calls mflux and krea also works, but is slower and lower quality than ChatGPT's native image generation. One user shared a third-party desktop tool (agentify-sh/desktop) claiming support for image generation and download via chatgpt.com from Codex CLI, but no one in the thread confirmed that it works.
Practical approach today: for a reliable path, use the API workaround; for a Pro-subscription path, evaluate the third-party tool or wait for the image_gen tool to be enabled. General advice: if Codex writes an API call, store the API key in an environment variable and keep it out of logs.
Did this work for you?What a GitHub user tried on GitHub (Partly worked)
The issue reporter has a generate_image script that Codex calls; it uses mflux and krea. It works but is slow and lower quality than ChatGPT's native image generation.
Source: https://github.com/openai/codex/issues/8758 (opens external site)
Did this work for you?What @kiranjd tried on GitHub (Worked)
A user tested the OpenAI API direct-call workaround and said it works, but it bills API usage rather than using the ChatGPT Pro plan.
Source: https://github.com/openai/codex/issues/8758#issuecomment-3854496820 (opens external site)
Did this work for you?What @waml tried on GitHub (Outcome unclear)
A user built a third-party desktop tool (agentify-sh/desktop) to let Codex CLI use chatgpt.com Pro, adding image generation and download. No one in the thread confirmed it works.
Source: https://github.com/openai/codex/issues/8758#issuecomment-4152788671 (opens external site)
Did this work for you?