Generate 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:
json
{
"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.
bash
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
bash
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
bash
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
bash
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.bash
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"
}'
bash
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"}'
errorCodeCauseActionLOGIN_REQUIREDInvalid or missing API keyVerify key at https://nanophoto.ai/settings/apikeysAPI_KEY_RATE_LIMIT_EXCEEDEDRate limit exceededWait and retryINSUFFICIENT_CREDITSNot enough creditsTop up creditsINVALID_PROMPTMissing or invalid promptAsk for a valid promptMISSING_INPUT_IMAGEEdit mode missing imagesAsk for public image URLsTOO_MANY_IMAGESToo many images providedLimit to 14 public image URLsIMAGE_URLS_REQUIREDAPI needs inputImageUrlsDo not send local files or base64GENERATION_FAILEDServer-side generation errorRetry or simplify the promptNOT_FOUNDUnknown generation IDRe-submit or verify the IDFORBIDDENGeneration not owned by callerVerify 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