| name | nano-banana-image-ad |
| description | Generate one or more standalone Meta image-ad creatives via Nano Banana 2 / Nano Banana Pro (Gemini Flash Image family) through the KIE.ai API. Locks the model family, auto-strips platform chrome, enforces edge-safe layouts. Use when the user asks for a "Nano Banana ad", "Gemini image ad", "nano-banana-2 ad creative", or anchors on a need for photoreal / lifestyle / multi-reference / handheld-object / clay-texture ad creatives (sticky-note flatlays, held-whiteboard signs, lifestyle portraits, ingredient collages, OOH photography). Does NOT trigger on ChatGPT Image cues โ use chatgpt-image-ad for those. |
nano-banana-image-ad (KIE.ai)
Generate one or more standalone Meta ad image creatives via KIE.ai's POST /api/v1/jobs/createTask with the Nano Banana model family (default nano-banana-2). Hands the image paths off to your Meta-ad-builder skill โ this skill does not upload to Meta itself.
Read order
- This file โ KIE-specific endpoint, auth, URL-only reference flow, workflow phases.
- shared/skills/nano-banana-image-ad/prompting/guide.md โ model-specific prompting.
- shared/skills/image-ad-prompting/prompting/prompt-library.md โ 30+ validated templates with per-model notes.
- shared/skills/image-ad-prompting/prompting/safety-suffixes.md โ the 3 always-on guards.
- scripts/generate_image.py โ the helper script (Python stdlib only).
Hard rules โ never relax
- Model is in the Nano Banana family. Accepts
nano-banana-2 (default), nano-banana-pro, nano-banana-edit, or nano-banana (legacy). Anything else is refused.
- No platform/screenshot chrome.
NO_CHROME_SUFFIX always on.
- Edge-safe + glyph-safety suffixes always on unless
--no-safe-zone is explicit.
- Max 14 reference URLs. KIE's
input.image_input cap.
- References are public URLs. KIE has NO presigned-upload flow. Local files are rejected at the CLI. Host on R2 / S3 / Cloudinary / your CDN first.
- No Meta upload from this skill. Image generation only.
- Always present a credit-cost estimate before generating (read
logs/kie-api.jsonl or MASTER_CONTEXT.md rates; nano-banana-pro > nano-banana-2).
Prerequisites
.env containing KIE_API_KEY
- Reference images hosted at PUBLIC URLs (R2 / S3 / Cloudinary / Imgur / GitHub raw / etc.)
- If you only have local files, see
MASTER_CONTEXT.md ยง Image hosting for the user's chosen hosting strategy
Configuration
- Base URL:
https://api.kie.ai (or KIE_BASE_URL).
- Auth:
Authorization: Bearer $KIE_API_KEY.
- Submit:
POST /api/v1/jobs/createTask with {model: "nano-banana-2", input: {prompt, image_input?, aspect_ratio}}.
- Poll:
GET /api/v1/jobs/recordInfo?taskId=<id> until data.state == "success". Result URLs in data.resultJson (JSON-encoded string).
Generation modes
| Mode | When to use | Required | Optional |
|---|
image (default) | Brand-new ad image. | --prompt, --aspect-ratio | --image-url (up to 14) |
image_edit | Modify a --source-url image. | --prompt, --source-url | --image-url (up to 14 additional refs) |
Supported aspect ratios
1:1, 4:5, 5:4, 2:3, 3:2, 9:16, 16:9, 3:4, 4:3, 21:9.
Default to 4:5 for Meta feed-portrait โ Nano Banana renders this natively. chatgpt-image-ad can't on either backend without post-cropping.
Model variants (--model)
nano-banana-2 (default) โ Gemini 2.5 Flash Image.
nano-banana-pro โ Gemini 3 Pro Image. Use for hero stills, identity continuity, material-realism critical shots.
nano-banana-edit โ inpaint-focused. Use only with --mode image_edit.
nano-banana โ legacy.
Confirm with user before first call in a session if not already in MASTER_CONTEXT.md.
Workflow
Phase 1: Preflight
.env exists with KIE_API_KEY.
- Health-check: a quick
GET /api/v1/jobs/recordInfo?taskId=test returns a recognized auth response (any 4xx other than 401 means auth is good).
- Reference URLs reachable (
curl -I <url> returns 200) โ the script does this automatically unless --skip-url-check.
Phase 2: Gather inputs
Collect: seed prompt, mode, source URL (if edit), reference URLs (up to 14), variant count, aspect ratio, model variant.
If user has local files only, stop and ask: "Where do you host these (R2 / S3 / Cloudinary / etc.)?" Document the answer in MASTER_CONTEXT.md so future runs don't re-ask.
Phase 3: Prompt rewrite
Read shared/skills/image-ad-prompting/prompting/prompt-library.md. Match a template (check Model notes block โ only proceed if nano-banana is preferred or clean). Fill placeholders. Show the user. Ask for approval.
For fresh prompts: follow the shared/skills/nano-banana-image-ad/prompting/guide.md ยง Phase 3b structure.
Phase 4: Credit cost confirmation (MANDATORY)
Present the estimate (read logs/kie-api.jsonl for matching past calls, or KIE pricing page). Wait for explicit confirmation.
Phase 5: Generate
~/.claude/skills/nano-banana-image-ad/scripts/generate_image.py \
--prompt "<rewritten>" \
--aspect-ratio <ratio> \
--n <N> \
--image-url https://<your-host>/product.jpg \
[--image-url https://<your-host>/character.jpg] \
--out ./generated \
--env-file .env
~/.claude/skills/nano-banana-image-ad/scripts/generate_image.py \
--model nano-banana-pro \
--prompt "<rewritten>" \
--aspect-ratio <ratio> \
--n <N> \
--image-url https://<your-host>/product.jpg \
--out ./generated \
--env-file .env
~/.claude/skills/nano-banana-image-ad/scripts/generate_image.py \
--mode image_edit \
--model nano-banana-edit \
--prompt "<edit-instruction>" \
--source-url https://<your-host>/existing.png \
[--image-url https://<your-host>/guidance.png] \
--n <N> \
--out ./generated \
--env-file .env
Each line on stdout is one JSON variant (variant, path, task_id, width, height, prompt, mode, aspect_ratio, model).
Log each call to logs/kie-api.jsonl per the kie-external-api SKILL.md conventions.
Phase 6: Visual QA (MANDATORY)
For each variant, read the image and inspect for: garbled small text, extra fingers / wrong limb count, wordmark drift, character identity drift across variants.
If defects: regenerate with a revised prompt per shared/skills/nano-banana-image-ad/prompting/guide.md ยง Retry mode. Cap at 2 retries per variant.
Phase 7: Confirm and hand off
Show all paths. Ask "Use all / use these specific ones / regenerate / cancel."
Selected variants ready for your Meta-ad-builder skill.
Out of scope
- Meta upload โ different skill.
- ChatGPT Image 2 โ use
chatgpt-image-ad.
- Video / carousel / DCO โ image only.
- Editing the shared library โ use
image-ad-clone (asks which backend at Phase 1).
Common errors
- 401/403 โ fix
KIE_API_KEY in .env.
- 400 validation โ usually a reachable-URL problem; check
--image-url returns 200.
- 422 โ moderation; tighten prompt.
- 429 โ rate-limited (>20 req/10s). Reduce
--n parallelism.
- 500 โ retry once; if persistent, file issue.
Files this skill owns
~/.claude/skills/nano-banana-image-ad/SKILL.md โ this file
~/.claude/skills/nano-banana-image-ad/scripts/generate_image.py โ KIE Nano Banana caller
See also