April 16, 2026
How I Automated AI Image Creation Using Claude + KIE.io's Nano Banana 2
A step-by-step guide to setting up Claude Code and KIE.io's Nano Banana 2 for automated AI image generation — including account setup, API key whitelisting, skill building, style reference folders, and why KIE costs half what Google Gemini does.
If you've been following me for a while, you know I love finding ways to automate repetitive creative work. Recently I put together a workflow that lets me generate AI images directly from my terminal using Claude Code and KIE.io's Nano Banana 2 model — and honestly, once it was set up, it felt like magic. Here's the full step-by-step breakdown so you can replicate it.
Step 1: Create a KIE.io Account and Get Your API Key
Head over to KIE.io and sign up for an account. Once you're in, navigate to your API settings and generate an API key. Copy it somewhere safe — you'll need it in the next step.
One thing that tripped me up and I want to save you the headache: you must whitelist your IP address in the KIE dashboard. If you skip this, every API call will silently fail with no useful error message. Go to your KIE account settings, find the IP whitelist section, and add your current IP. If you're working from multiple networks, add them all.
Step 2: Understanding the API
KIE's Nano Banana 2 model is accessed via a simple POST request. Here's the core snippet straight from their documentation:
curl --location --request POST 'https://api.kie.ai/api/v1/jobs/createTask' \
--header 'Authorization: Bearer <your-token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "nano-banana-2",
"input": {
"prompt": "Your image prompt here",
"image_input": [],
"aspect_ratio": "auto",
"resolution": "1K",
"output_format": "png"
}
}'
The key fields you'll customize are the prompt, aspect_ratio, and output_format. The model handles the rest.
Step 3: Building the Skill in Claude Code
This is where it gets fun. Instead of running that API call manually every time, I worked with Claude to build a skill — a reusable set of instructions that Claude can invoke on command.
The skill wraps the KIE API call, handles authentication with your stored token, lets you pass a prompt in plain English, and saves the output image automatically. Once it's installed, all I have to say is something like "generate an image of..." and Claude handles the entire API request behind the scenes.
If you've never built a Claude skill before: it's essentially a markdown file with structured instructions that Claude reads and follows. Claude Code has a built-in skill-creator that walks you through the whole process. The result is a .skill file you install once and reuse forever.
Step 4: Organize Your Style References
One of my favorite features of this setup is style reference images. I created a folder structure on my machine to keep everything organized:
Projects/
my-website/
image-styles/
minimalist/
ref1.jpg
ref2.jpg
bold-editorial/
ref1.jpg
ref2.jpg
When I want images in a specific style, I point the skill at one of these folders and it uses those photos as visual references to guide the output. This is how you get consistent aesthetics across all your AI-generated images — not just a good prompt, but actual visual examples of what "good" looks like to you.
Step 5: Where Your Images End Up
Generated images get saved directly to your Desktop by default, so they're always easy to find right after generation. No digging through downloads folders or mysterious temp directories.
Why KIE Over Google Gemini?
Here's the part that really sealed the deal for me: Nano Banana 2 on KIE costs roughly half what the equivalent generation costs on Google Gemini. For the same quality output, you're paying 50 cents on the dollar. If you're generating images regularly — for blog posts, social content, client projects — that difference adds up fast.
KIE also gives you more direct control over the API parameters — resolution, aspect ratio, output format — without going through multiple layers of SDK abstraction. If you're already building AI workflows, it's a no-brainer addition to your toolkit. Give it a shot, guys!