How to Use Nano Banana 2 in Claude Code (Game Changer)

· Updated March 31, 2026 · AI Tutorials, Claude Code

The following guide shows how to use Nano Banana 2 in Claude Code for generating high quality AI images. This is one of the most practical image generation setups right now in Claude Code. Here's how you can get it working.

How Nano Banana 2 in Claude Code Works

Most people using Claude Code for content work are still copy-pasting prompts into Midjourney or firing up a separate image tool. That adds friction. Nano Banana 2 removes it. Nano Banana 2 is Google's latest AI image model. It runs roughly 6-7 cents per image versus 13-14 cents for its predecessor, Nano Banana Pro. That gap adds up fast when you're generating thumbnails, social graphics, or client assets at scale. The setup runs through the API, not the Gemini web app. Two paths exist: Google AI Studio (free, direct) or OpenRouter (what I use). OpenRouter consolidates every model under one API key. Google, Anthropic, OpenAI -- one key, one dashboard, one place to track costs.

Getting Your API Key Set Up

You've probably heard "just get an API key" before. Here's the actual process so you don't have to figure it out. For OpenRouter, sign up at openrouter.ai (free). Add $5-10 in credits. Go to API Keys, click Create, name it something like "claude-code," and copy the key. Back in Claude Code, paste this:
Store this API key from OpenRouter to generate images with Google's Nano Banana 2 AI image model. [paste your key]. Here's the OpenRouter documentation for Nano Banana 2 for more context. [paste the model page URL]
The model page is the Nano Banana 2 listing on OpenRouter. Copy that page and include it as context. More context means better output. If you already have an OpenRouter key in an APIs.env file, Claude Code updates it automatically. If not, it creates a new file. Either way, the key gets stored. To test it, prompt: "Generate a realistic image of [location] using Nano Banana 2. Use my OpenRouter API key." That explicit reference matters on the first run. After that, Claude Code knows. The result saves as an image file in your workspace.
Nano Banana Claude Code Google AI Studio API Keys dashboard showing where to create your key
Google AI Studio's API Keys page -- where you create the key that connects Claude Code to Nano Banana 2.

Using Claude Skills to Generate Thumbnails with Nano Banana

Asking Claude Code to "make me a thumbnail" in a chat gives you a generic result. That's not a knock on the model. It's a prompt problem. Skills solve this. A skill is a Markdown file that gives Claude Code persistent context, rules, and instructions for a specific task. Two skills drive the thumbnail workflow I showed in the video: a Nano Banana API best practices skill and a YouTube thumbnail designer skill. My Claude Code Skills Stack has 20+ skills I use daily to automate marketing and content creation with a one time fee and lifetime updates. The Nano Banana skill was built fast. I pulled the official Nano Banana API documentation, copied it as Markdown, and said: "Make me a skill file with best practices for generating images with Nano Banana." Done. The thumbnail designer skill took more work. It holds years of knowledge about what makes a thumbnail drive clicks. Both skills are available inside my AI Marketing Insiders community if you want the shortcut. Here's the actual prompt structure I used in the video:
I need you to design a YouTube thumbnail using the YouTube Thumbnail Designer skill. Take the thumbnail from [reference video URL] and make the following changes: change the text from "unstoppable" to "game changer" and remove the headshot. Keep everything else the same, including image dimensions. Use Google Nano Banana 2 through the OpenRouter API. Use the Nano Banana API best practices skill.
Claude Code ran Opus for this one. It generated three output files -- original, draft, and final. The result matched the brief exactly: text updated, headshot removed, dimensions intact.

The Headshot Problem (And the Real Workflow)

Here's the honest take on AI image models and headshots: they're not reliable yet. I tested adding my headshot inside Claude Code. The model placed it, but it covered the text. Positioning was off. That's where these models still fall short for compositing real faces onto designed layouts. My actual workflow: generate the thumbnail without a headshot. Leave clean space on the right side. Export it. Drop it into Canva or Photoshop, drag in your PNG cutout, and save. Adds 30-60 seconds. Keeps quality high.
Nano Banana Claude Code OpenRouter Logs showing image generation cost at $0.0679 per image
OpenRouter Logs showing a Nano Banana 2 image generation at $0.0679 -- significantly cheaper than the previous Nano Banana Pro model.
The bigger point here is the feedback loop. Every time you adjust a thumbnail, Claude Code can update the skill file based on that conversation. You'd say: "Update my YouTube thumbnail designer skill based on this chat." Over time, the skill gets smarter and your prompts get shorter. That's the actual power of this system.

Ryan's Final Thoughts

How to use Nano Banana 2 in Claude Code comes down to three things: store your API key, build the right skills, and use reference inputs instead of vague prompts. The cost is low. The output is solid. When Google releases the next image model, update the skill file and move on. The system stays intact. Start with a simple test image. Build your skills. Let Claude Code handle generation while you focus on content.

Nano Banana Claude Code FAQs

What is Nano Banana 2 in Claude Code?

Nano Banana 2 is Google's AI image model (the successor to Nano Banana Pro) that you can access inside Claude Code via the API. You store an API key from Google AI Studio or OpenRouter, then prompt Claude Code to generate images using that key. It costs roughly 6-7 cents per image through OpenRouter.

How do I set up Nano Banana 2 in Claude Code?

Get an API key from Google AI Studio or OpenRouter. In Claude Code, paste a prompt that stores the key and includes the model documentation as context. Test with a simple image prompt referencing your API key. Claude Code saves it locally and uses it for all future image generation.

What is the difference between Nano Banana 2 and Nano Banana Pro?

Nano Banana 2 is cheaper (6-7 cents per image vs. 13-14 cents for Pro) and produces better output quality. Nano Banana Pro is the older version. For standard workflows, Nano Banana 2 is the better pick.

Can I use Nano Banana 2 without coding skills?

Yes. Claude Code handles all the API calls. You write plain-English prompts. The only technical step is getting an API key and pasting a setup prompt. If you use Claude Code skills (pre-built Markdown files), you reduce the prompt work even further.

How do I use Claude Code skills with Nano Banana 2?

Create a Markdown file with your image generation rules and best practices. Save it as a skill in your Claude Code workspace. Call it by name in your prompt. For thumbnails, I run two skills together: a Nano Banana API best practices skill and a YouTube thumbnail designer skill. That combination produces consistent, brief-accurate results every time.

40+ Claude Code skills that run my business. One purchase, lifetime updates.

Get instant access

Free AI Marketing Guide

Get the free AI Marketing Guide

The exact AI tools and Claude Code skills I use to run my agency solo.

No spam. Unsubscribe anytime. Privacy policy.