Can Codex CLI Generate Images? Here’s What You Need to Know

Codex CLI does not generate images. It reads code, writes code, and edits files. That’s what it was built for. But you can bolt on image generation through MCP, and when you do, it works well enough that you stop context-switching to Figma or a browser-based generator.

What Codex CLI Actually Does

Codex is OpenAI’s terminal-based coding agent. It reads your codebase, proposes changes, runs commands, and writes files. Its strengths are code generation, refactoring, and file manipulation. It has no built-in capability to produce visual assets: no image generation, no screenshots, no diagram rendering.

This is fine for pure backend work. It’s less fine when you’re building a frontend and need placeholder images, or scaffolding a project that requires a logo, or generating social media graphics as part of a content pipeline.

How MCP Fills the Gap

MCP (Model Context Protocol) lets you connect external tools to Codex. When you add an MCP server that provides image generation, Codex can call it mid-session the same way it calls any other tool. You describe what you want in plain language, the tool generates the image, and Codex can save the result to your project.

Here’s what this looks like in practice:

Generating a placeholder logo. You’re scaffolding a new app and need something in public/logo.png. Instead of opening a separate tool, you tell Codex: “Generate a minimal geometric logo for a developer tool called Stackr, dark background, bright accent color.” The image generation tool handles it.

Creating UI mockup assets. You’re building a component library and want reference images. Ask Codex to generate a card component illustration, a dashboard layout sketch, or an icon set. Each request goes through the MCP tool.

Producing social graphics. Your project needs Open Graph images or blog post thumbnails. Describe the style and content, and the tool generates them. Codex saves the files where you specify.

The key insight: Codex treats image generation like any other tool call. It decides when to use it based on your request, passes a text prompt to the tool, and handles the output. You stay in your terminal.

What Works and What Doesn’t

Image generation through MCP tools is good for:

  • Placeholder and prototype assets
  • Logos and brand marks (with iteration)
  • Illustrations and diagrams
  • Social media graphics

It’s less suited for:

  • Pixel-perfect design work (you still want Figma for that)
  • Photo editing or manipulation
  • Generating images that need to match an exact specification down to the pixel

The quality depends on the underlying model. Tools powered by Recraft produce strong results for illustrations, vector-style graphics, and realistic photos. You can iterate in the same session: ask Codex to regenerate with a different color scheme or layout, and it calls the tool again.

Adding Image Generation to Codex with AgentPatch

AgentPatch is an MCP marketplace that bundles image generation (via Recraft) along with dozens of other tools behind a single connection. You set it up once and Codex gets access to everything on the marketplace.

The AgentPatch CLI is designed for AI agents to use via shell access. Install it, and your agent can discover and invoke any tool on the marketplace.

Install (zero dependencies, Python 3.10+):

pip install agentpatch

Set your API key:

export AGENTPATCH_API_KEY=your_api_key

Example commands your agent will use:

ap search "web search"
ap run google-search --input '{"query": "test"}'

Get your API key from the AgentPatch dashboard.

Add AgentPatch to ~/.codex/config.toml:

[mcp_servers.agentpatch]
url = "https://agentpatch.ai/mcp"
bearer_token_env_var = "AGENTPATCH_API_KEY"

Then set your API key:

export AGENTPATCH_API_KEY=your_api_key

Replace your_api_key with your actual key from the AgentPatch dashboard. Codex discovers all AgentPatch tools automatically on next start.

Once connected, you can ask Codex to generate images as part of any coding session. No separate Recraft account, no API key management, no extra configuration.

Example Session

You’re building a landing page and need hero graphics:

“Generate a wide illustration of a developer workspace with floating code snippets and a terminal window. Modern, flat style, blue and purple tones. Save it to public/images/hero.png.”

Codex calls the image generation tool through AgentPatch, gets the result, and writes the file. You can follow up:

“Try a darker version with more contrast and fewer floating elements.”

Same tool, same session. The iteration loop stays tight.

Wrapping Up

Codex CLI can’t generate images on its own, but MCP support means you can add that capability in a few minutes. AgentPatch makes it easy to connect: one setup, and your Codex sessions gain image generation alongside web search, email, maps, and more. Check out agentpatch.ai to browse the full tool marketplace.