Guide
How to Generate Images in Claude Code from the Terminal
Published By DreamClip
To generate images in Claude Code, register an image MCP server with the claude mcp add command and sign in once. DreamClip's server lives at https://dreamclip.ai/mcp; after the command and a browser sign-in, Claude Code can call generate_image on models such as GPT Image 2.5 Flare, Qwen Image 3 and Nano Banana 2, and get back links to finished images while you work in your project.
As of November 2026 Claude Code itself writes and runs code; it does not draw raster images from a prompt. What it does well is the glue: it knows your project, so it can write prompts that match the page you are building, ask for the right shape, and put the files where your code expects them.
The images are billed to your DreamClip account at studio prices, quoted before each run, and a run that fails costs nothing.
What the server adds to Claude Code
An MCP server is a set of tools Claude Code can call over the network. DreamClip's has ten. The ones you will use for images are list_models (every image model with its sizes, shapes and batch limit), estimate_cost (the exact price of a run), generate_image (queues the run) and get_generation (waits for it and returns the files). The same connection also makes video, speech and music, which matters if your project needs a demo clip or a voice line later.
Install it with one command
Run this in any terminal: "claude mcp add --transport http --scope user dreamclip https://dreamclip.ai/mcp". The transport flag says it is a remote server over HTTP, so there is nothing to install or keep running on your machine.
Keep --scope user. Leave the flag out and the registration is local: the server exists only in the directory where you typed the command, and other projects never see it.
How to generate images in Claude Code for a project
A typical session for a landing page:
- Ask: "Look at the hero section in this page and make a 16:9 background image that fits the copy, on GPT Image 2.5 Flare, at 2K."
- Claude Code reads the page, writes a prompt, and calls estimate_cost with the model, the size and the shape.
- It tells you the price. Approve the generate_image call when Claude Code asks for permission to use the tool.
- It waits with get_generation, up to 50 seconds per check, until the image is delivered.
- Ask it to download the file into your project, for example into the public folder, and wire it into the page.
The strength of doing this in the terminal is context. Claude Code has read your components, your color tokens and your copy, so a request as short as "make the missing illustration for the pricing empty state" can turn into a prompt that names the palette and the mood already in the code. Ask it to show you the prompt before it spends anything if you want a say in the wording, and to save the final prompt in a comment beside the image so the next version can start from it.
As of November 2026, Claude Code asks before it uses a tool or runs a command you have not allowed yet; its permission settings decide which ones it may use without asking. Check Anthropic's Claude Code documentation for the current options.
Prompts that fit development work
| Asset | Ask for | Model to try |
|---|---|---|
| Open Graph card | Ask for"A 16:9 share image with the words Launch Week in bold, clean flat colors" | Model to tryGPT Image 2.5 Flare |
| Empty state | Ask for"A small friendly illustration of an empty inbox, soft pastel, white background" | Model to tryKrea 2 |
| Product placeholder | Ask for"A photo of a matte black water bottle on a concrete plinth, studio light" | Model to trySeedream 5 Lite |
| Menu or sign mockup | Ask for"A chalkboard cafe menu with the prices legible" | Model to tryQwen Image 3 |
| Feature tiles | Ask for"Four square images of the same paper plane in different scenes" | Model to tryNano Banana 2 with count 4 |
Text inside an image is often where image models slip. Keep it short, put it in quotes in the prompt, and pick a model described for text and typography, such as GPT Image 2.5 Flare or Qwen Image 3. Fine print in a UI still belongs in your HTML, not in a picture.
Image models for UI and marketing assets
Every image model on sale in the Image studio is available to Claude Code. Five useful ones, with the table printed from our catalog:
| Model | Maker | Sizes | Edits a photo |
|---|---|---|---|
| GPT Image 2.5 Flare | MakerOpenAI | Sizes1K, 2K, 4K | Edits a photoYes |
| Qwen Image 3 | MakerAlibaba | Sizes1K, 2K | Edits a photoYes |
| Nano Banana 2 | MakerGoogle | Sizes0.5K, 1K, 2K, 4K | Edits a photoYes |
| Seedream 5 Lite | MakerByteDance | Sizes2K, 3K | Edits a photoYes |
| Krea 2 | MakerKrea | Sizes1K | Edits a photoNo |
Ask Claude Code to call list_models with kind image when you need the full list with every size and shape. For examples of what the families look like, the image generator page and the Nano Banana page are quick to scan, and the Nano Banana Pro prompt guide covers prompt structure.
Sizes, shapes and batches of four
- Size: left out, a run uses the model's smallest size. That is fine for a draft and too small for a hero image, so say 2K or 4K where the model offers it.
- Shape: name the aspect ratio, such as 16:9 for a banner, 1:1 for an avatar slot or 9:16 for a phone screen. Each model lists the shapes it takes.
- Batch: one run makes up to four images on today's image models. Ask for four variants in one call instead of four calls.
A wrong size or shape is refused before anything is charged, with a sentence naming what the model takes, so Claude Code can correct the call by itself.
Editing an image that is already in your repo
Most image models can edit or restyle one photo: Claude Code passes it as the photo to edit and describes the change. Grok Imagine 2.0 and Krea 2 make new images only. Send the photo as a link anyone can open over https, or embed it as a single data URL (the cap is 3 MB, one per call); PNG, JPEG and WebP are accepted. For a small file in your project, ask Claude Code to send it as a data URL; for a larger one, use a link where it is already hosted.
The image to image page shows the kind of edits the models handle, from a new background to a change of style.
Spending caps, retries and rate limits
- Give a ceiling per run, and Claude Code passes it as max_credits. A run priced above it does not start.
- Credits are held when a run is queued and taken only on delivery. A failed or cancelled run returns the hold.
- Each generate call can carry an idempotency key. If a call times out and is retried with the same key, the server answers with the first run instead of starting a second one.
- The server accepts 120 tool calls a minute on one account, 15 of them generations. A script that loops faster gets a plain refusal, not a charge.
Errors you may hit, and the fix
| Claude Code relays | Cause | Fix |
|---|---|---|
| "Connect DreamClip again: this connection is not signed in." | CauseThe sign-in lapsed or was revoked | FixAuthenticate again from /mcp |
| "This connection was not allowed to generate. Reconnect DreamClip and allow it." | CauseThe generate permission was not granted | FixReconnect and allow both permissions |
| "DreamClip could not fetch that image URL. Use a public https link." | CauseA private, local or broken link | FixHost the file publicly or send a small data URL |
| "That file is over 3 MB. Send it as a public https link instead." | CauseThe data URL is too large | FixUpload it somewhere public and pass the link |
| A sentence naming the sizes a model takes | CauseA size the model does not render | FixPick one of the sizes it lists |
Because every refusal is a plain sentence, Claude Code can usually repair the call itself: it reads that a size is not offered, picks one that is, and asks to run again. If the sign-in error keeps coming back, remove the server, run the add command again and authenticate once more.
Where the files live
Your Assets page keeps every image the session makes, and Claude Code's links are those stored copies. They keep working after the session, but for a production site it is better to download the file into your own repo or storage than to hotlink it. To compare models by eye, open the Image studio in a browser; the chat version of this guide is generating images in Claude.
To remove access, open "Connected agents" in your DreamClip account and press "Disconnect", or run Claude Code's own command to remove the server. Removing it on the Claude Code side alone lets the old sign-in live on for up to a month, 30 days at most.
Questions
Can Claude Code generate images by itself?
As of November 2026 it does not draw images from a prompt. With an image MCP server such as DreamClip's added, it can call image models and download the results into your project.
What is the command to add the server?
Run "claude mcp add --transport http --scope user dreamclip https://dreamclip.ai/mcp", then open /mcp in Claude Code to sign in.
Do I need an API key?
No. You sign in to your DreamClip account in the browser and choose Allow, and Claude Code keeps the token.
Can Claude Code use an image from my project as input?
Yes. Give it a link that is publicly reachable over https, or a data URL below 3 MB, and pick a model that edits photos.
How many images can one call make?
Up to four per run on today's image models. Ask for the count in the request.
Does a failed image cost anything?
No. The held credits go back to your balance and Claude Code gets a sentence saying nothing was charged.
Related
- GuideHow to Generate Video in Claude Code for Your ProjectsQueue clips on PixVerse V6, Kling or Seedance from Claude Code, keep a storyboard file in your repo, and download each delivered clip next to your code.
- GuideHow to Generate Images in Cursor with an MCP ServerInstall DreamClip's image server in Cursor with one link or three lines of JSON, then ask the agent for app icons, hero art and mockups on Nano Banana 2.
- GuideHow to Generate Images in Claude on Named Image ModelsMake pictures inside a Claude chat on Nano Banana Pro, Seedream or GPT Image 2.5 through the DreamClip connector: setup, requests, photo edits and cost.