Nano Banana 2
透過 OpenClaw 使用 NanoPhoto.AI Nano Banana 2 API 進行圖片生成,支援 Google 搜尋增強。
透過 NanoPhoto.AI Nano Banana 2 API 生成或編輯圖片,支援可選的 Google 搜尋提示詞增強。
安裝:npx clawhub@latest install nano-banana-2
ClawHub:clawhub.ai/u/nanophotohq
前置條件
- 在 nanophoto.ai/settings/apikeys 取得 API Key
- 在 OpenClaw 技能設定中設定
NANOPHOTO_API_KEY
{
"skills": {
"entries": {
"nano-banana-2": {
"enabled": true,
"env": {
"NANOPHOTO_API_KEY": "your_api_key_here"
}
}
}
}
}模式
- generate — 文字生成圖片
- edit — 圖片編輯(需要公開圖片 URL,最多 14 個)
參數
| 參數 | 類型 | 必填 | 描述 |
|---|---|---|---|
prompt | string | 是 | 圖片生成提示詞 |
mode | string | 是 | generate 或 edit |
aspectRatio | string | 否 | 16:9、9:16、4:3 或 3:4 |
imageQuality | string | 否 | 1K(預設)、2K 或 4K |
googleSearch | boolean | 否 | 啟用 Google 搜尋提示詞增強 |
inputImageUrls | string[] | 條件必填 | edit 模式時必填(最多 14 個 URL) |
使用方法
文字生成圖片
python3 scripts/nano_banana_2.py submit \
--prompt "未來城市日落,飛行汽車" \
--mode generate \
--aspect-ratio 16:9 \
--image-quality 2K使用 Google 搜尋增強
python3 scripts/nano_banana_2.py submit \
--prompt "最新款特斯拉 Cybertruck 在沙漠中" \
--mode generate \
--aspect-ratio 16:9 \
--image-quality 2K \
--google-search \
--follow圖片編輯
python3 scripts/nano_banana_2.py submit \
--prompt "將這張照片轉換為水彩畫風格" \
--mode edit \
--input-image-url https://example.com/photo.webp \
--aspect-ratio 16:9 \
--image-quality 1K查詢狀態
python3 scripts/nano_banana_2.py status --generation-id abc123xyz錯誤碼
| 錯誤碼 | 原因 | 處理方式 |
|---|---|---|
LOGIN_REQUIRED | API Key 無效 | 在 settings/apikeys 驗證 |
INSUFFICIENT_CREDITS | 積分不足 | 儲值積分 |
INVALID_PROMPT | 缺少提示詞 | 提供提示詞 |
MISSING_INPUT_IMAGE | 編輯模式缺少圖片 | 提供公開圖片 URL |
TOO_MANY_IMAGES | 超過 14 張圖片 | 減少到 14 張以內 |
GENERATION_FAILED | 伺服器錯誤 | 重試或簡化提示詞 |
NanoPhoto.AI文檔