The Secret Trick to Generating Images Directly Within Claude Code

@beku_AI
JAPANESE2 days ago · Jul 21, 2026
449K
521
15
4
1.7K

TL;DR

This guide demonstrates how to integrate Codex CLI with Claude Code to generate images using GPT Image 2, allowing creators to produce visuals and text in a single terminal-based workflow.

You can now write both articles and social media posts using Claude Code.

Yet, many people still open a ChatGPT browser window just to generate images.

This is a huge waste of time.

"I'll just make the image over there."

Switching to a browser, typing a prompt, downloading the result, and moving it back to your project folder takes several minutes per image. This adds up every time you publish an article.

Even though the text is handled by AI, the image process remains a manual, old-school chore.

Actually, you can eliminate this back-and-forth entirely.

There is a way to complete your images without ever leaving Claude Code.

Does this sound familiar?

  • You finish your text in Claude Code but use a different tool for images.
  • You download images and manually move them into folders.
  • You wish you could finish everything on a single screen.

If any of these apply, this article is for you.

By the end, you'll know how to ask Claude Code to create images just by pasting a command, and how to set it up so a simple "generate image" command triggers the process.

You can use this in the Claude desktop app as shown below, and even generate multiple images at once. Bookmark this article and try it out.

ベク on X — cover

Quick announcement: I am currently giving away a set of 55 major bonuses, including textbooks on Claude Code and Codex, installation guides, and monetization methods for free. You can get them immediately from the link below if you haven't already.

https://utage-system.com/line/open/cwgwX1a35XDK?mtid=FNAamIuYaEet

Now, let's get to the main topic.

Why can you complete images using only Claude Code?

While we use Claude Code for the operation, we are actually using Codex behind the scenes.

Codex has image generation capabilities and uses the high-performance GPT Image 2 model, the same one used by ChatGPT.

In other words, if you call Codex from Claude Code, you can create images without leaving the conversation.

Some might wonder, "Is that really possible?" It's actually quite simple.

Once you set it up, there's no need to switch browsers or download files. The save destination will be the folder you are currently working in from the start.

Preparation in Just 2 Steps

① First, install the Codex CLI. If you already have it, you can skip this.

Just open your terminal and run the following command:

npm i -g @openai/codex

If you use Homebrew, brew install --cask codex also works.

② Next, log in via the terminal:

codex login

Follow the prompt to log in with your ChatGPT account. Since it uses your ChatGPT account, there is no extra cost, no need for API keys, and no need to worry about pay-as-you-go billing.

What to Actually Do

There is only one thing to do.

Just ask Claude Code in plain language like this:

text
1Use codex exec to generate an image with GPT Image 2.
2Content: [Description of the image you want to create]

You don't need to write the command or the English prompt yourself. Claude Code will assemble everything for you. Once you give the instruction, just wait a few minutes.

How to Make It Even Easier

If you plan to use the same request repeatedly, you should turn it into a "skill."

It's easy: after a successful generation, just tell Claude Code, "Turn the current method into a skill."

Even if you don't know how to write skills, Claude Code will use its internal skill-creator to build it for you. From then on, the same procedure will run with just the words "generate image."

You won't even need to remember the command.

Advanced Use Cases

Claude's Fable 5 model has a great sense for creativity.

Depending on your preference, rather than letting Codex handle everything, it often works better to let Claude Code brainstorm what kind of image to generate and then have it delegate the actual generation to Codex.

Since many people use Claude Code for writing, you can have it suggest illustrations that match your article and then send those ideas to Codex.

You can also reflect your preferences—such as specific tastes or design styles—into the skill so that you get consistent assets every time.

Furthermore, you aren't limited to one image at a time. If you ask, "Create 5 illustrations for this article at once," it can generate multiple images in a batch. This is great for building a stock of assets or choosing from multiple candidates.

From Note thumbnails and X article covers to document illustrations, your entire content production workflow can be completed within Claude Code.

Summary

  • Calling Codex's GPT Image 2 from Claude Code allows you to complete images within the chat.
  • Preparation only requires installing the Codex CLI and logging in via terminal.
  • The request is as simple as "Use codex exec to generate an image." Once successful, turn it into a skill to call it with "generate image."

Every time you switch tools, your focus is slightly chipped away. It's better to consolidate your work into a single tool as much as possible.

You can stop opening your browser just for images starting today.

I regularly post the latest AI information and monetization methods using AI. If this article was helpful, please follow me.

Finally, I am giving away 55 major bonuses including Claude Code and Codex guides. If you haven't received them yet, please get them here.

https://utage-system.com/line/open/cwgwX1a35XDK?mtid=FNAamIuYaEet

ベク - inline image
Remix in YouMind

Turn one viral article into a full content workflow

Collect the source, decode the pattern, create assets, draft the story, and distribute from one AI workspace.

Explore YouMind
For creators

Turn your Markdown into a clean 𝕏 article

When you publish your own long-form writing, images, tables, and code blocks make 𝕏 formatting painful. YouMind turns a full Markdown draft into a clean, ready-to-post 𝕏 article.

Try Markdown to 𝕏

More patterns to decode

Recent viral articles

Explore more viral articles