Install
openclaw skills install nanophoto-nano-banana-2Generate or edit images with the NanoPhoto.AI Nano Banana 2 API. Use when: (1) User wants text-to-image generation, (2) User wants image-to-image editing with public image URLs, (3) User mentions Nano Banana 2, AI image generation, image editing, Google Search enhanced prompts, or checking Nano Banana generation status. Supports aspect ratio, quality, optional Google Search prompt enhancement, status checks, and optional in-process polling from a single bundled script. Prerequisite: Obtain an API key at https://nanophoto.ai/settings/apikeys and configure env.NANOPHOTO_API_KEY.
openclaw skills install nanophoto-nano-banana-2Generate or edit images through the NanoPhoto.AI Nano Banana 2 API.
NANOPHOTO_API_KEY before using the skill.Preferred OpenClaw setup:
NANOPHOTO_API_KEYEquivalent config shape:
{
"skills": {
"entries": {
"nano-banana-2": {
"enabled": true,
"env": {
"NANOPHOTO_API_KEY": "your_api_key_here"
}
}
}
}
}
Other valid ways to provide the key:
export NANOPHOTO_API_KEY="your_api_key_here"NANOPHOTO_API_KEY~/.openclaw/openclaw.json at skills.entries.nano-banana-2.env.NANOPHOTO_API_KEYCredential declaration summary:
NANOPHOTO_API_KEY--api-key → NANOPHOTO_API_KEY environment variable → ~/.openclaw/openclaw.json skill envgenerate (text-to-image) or edit (image-to-image).aspectRatio, imageQuality, and whether googleSearch should be enabled.submit --follow.completed or failed.imageUrl, generationId, and progress details when available.mode
generate: text-to-imageedit: image-to-image; requires inputImageUrlsaspectRatio
16:99:164:33:4imageQuality
1K: default, lowest cost2K: higher detail4K: highest detail and highest costgoogleSearch
Use the single bundled script with subcommands.
python3 scripts/nano_banana_2.py submit \
--prompt "A futuristic cityscape at sunset with flying cars and neon lights" \
--mode generate \
--aspect-ratio 16:9 \
--image-quality 2K
python3 scripts/nano_banana_2.py submit \
--prompt "The latest Tesla Cybertruck in a desert landscape" \
--mode generate \
--aspect-ratio 16:9 \
--image-quality 2K \
--google-search \
--follow
python3 scripts/nano_banana_2.py submit \
--prompt "Transform this photo into a watercolor painting style" \
--mode edit \
--aspect-ratio 16:9 \
--image-quality 1K \
--input-image-url https://static.nanophoto.ai/demo/nano-banana-pro.webp
python3 scripts/nano_banana_2.py status --generation-id abc123xyz
The bundled script resolves credentials in this order: --api-key, then NANOPHOTO_API_KEY from the environment, then ~/.openclaw/openclaw.json at skills.entries.nano-banana-2.env.NANOPHOTO_API_KEY.
Subcommands:
submit: submit a generation tasksubmit --follow: submit and keep polling in the same processstatus: check an existing generationIdCross-platform note:
python3 on macOS/Linux.python on Windows unless python3 is available.curl.--json-only when another script/tool needs raw JSON output.--poll-interval to override the default 4-second polling interval.curl -X POST "https://nanophoto.ai/api/nano-banana-2/generate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $NANOPHOTO_API_KEY" \
--data-raw '{
"prompt": "A futuristic cityscape at sunset with flying cars and neon lights",
"mode": "generate",
"aspectRatio": "16:9",
"imageQuality": "2K"
}'
curl -X POST "https://nanophoto.ai/api/nano-banana-2/check-status" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $NANOPHOTO_API_KEY" \
--data-raw '{"generationId": "abc123xyz"}'
| errorCode | Cause | Action |
|---|---|---|
LOGIN_REQUIRED | Invalid or missing API key | Verify key at https://nanophoto.ai/settings/apikeys |
API_KEY_RATE_LIMIT_EXCEEDED | Rate limit exceeded | Wait and retry |
INSUFFICIENT_CREDITS | Not enough credits | Top up credits |
INVALID_PROMPT | Missing or invalid prompt | Ask for a valid prompt |
MISSING_INPUT_IMAGE | Edit mode missing images | Ask for public image URLs |
TOO_MANY_IMAGES | Too many images provided | Limit to 14 public image URLs |
IMAGE_URLS_REQUIRED | API needs inputImageUrls | Do not send local files or base64 |
GENERATION_FAILED | Server-side generation error | Retry or simplify the prompt |
NOT_FOUND | Unknown generation ID | Re-submit or verify the ID |
FORBIDDEN | Generation not owned by caller | Verify the account |
scripts/nano_banana_2.py: single entry point for submit, status, and optional in-process pollingreferences/api.md: condensed API reference, parameters, and error behavior