Adding AI Image Generation to Your Codex Workflow

Codex CLI handles code well, but real projects often require more than code. Assets, diagrams, and placeholder graphics show up constantly. Without image generation built into your Codex workflow, those tasks require switching tools. AgentPatch changes that.

Why This Matters

When image generation is accessible through the same MCP connection that Codex uses for other tools, it stops being an interruption and becomes part of the workflow. You describe what you’re building, you describe what visual you need, and Codex handles both.

AgentPatch provides Recraft image generation through MCP. Recraft produces quality output across styles — photorealistic, illustrative, vector — making it practical for the range of image needs that come up in development work.

Setup

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.

Example

You’re building an open-source CLI tool and preparing for launch. You ask Codex:

“I need a README hero image for this project. It should show a stylized terminal window with a command being typed, on a dark background. Clean and professional.”

Codex calls the Recraft tool through AgentPatch and generates the image. You ask it to save the output to assets/hero.png and Codex writes the file.

In the same session:

“Also generate a smaller icon version — just a simplified terminal symbol, square format, for use as a GitHub repo social preview.”

Codex calls Recraft again with the new description. Two images, same session, no switching tools.

You can tie it into larger workflows:

“Search for what other CLI tools in this space use for README visuals, then generate something that matches the aesthetic but is distinct.”

Codex calls Google Search through AgentPatch for reference, then generates the image through Recraft. Both tools available, same connection.

Wrapping Up

Image generation integrates cleanly into Codex workflows when it’s part of the same tool connection you’re already using. AgentPatch covers search, news, email, maps, and more alongside it. One setup, everything available. Visit agentpatch.ai.