nano-banana-2-direct-direct
Generate/edit images with Gemini 3.1 Flash Image Preview (Nano Banana 2). Direct API call without inference.sh dependency. Use for image create/modify requests incl. edits. Supports text-to-image + image-to-image; 1K/2K/4K; use --input-image.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/franklu0819-lang/nano-banana-2-directNano Banana 2 Direct - Gemini 3.1 Flash Image
Generate new images or edit existing ones using Google's Gemini 3.1 Flash Image Preview API directly (no inference.sh required).
Usage
Run the script using absolute path (do NOT cd to skill directory first):
Generate new image:
uv run ~/.openclaw/workspace/skills/nano-banana-2-direct/scripts/generate_image.py --prompt "your image description" --filename "output-name.png" [--resolution 1K|2K|4K] [--api-key KEY]
Edit existing image:
uv run ~/.openclaw/workspace/skills/nano-banana-2-direct/scripts/generate_image.py --prompt "editing instructions" --filename "output-name.png" --input-image "path/to/input.png" [--resolution 1K|2K|4K] [--api-key KEY]
Important: Always run from the user's current working directory so images are saved where the user is working, not in the skill directory.
Default Workflow (draft → iterate → final)
Goal: fast iteration without burning time on 4K until the prompt is correct.
- Draft (1K): quick feedback loop
uv run ~/.openclaw/workspace/skills/nano-banana-2-direct/scripts/generate_image.py --prompt "<draft prompt>" --filename "yyyy-mm-dd-hh-mm-ss-draft.png" --resolution 1K
- Iterate: adjust prompt in small diffs; keep filename new per run
- If editing: keep the same
--input-imagefor every iteration until you're happy.
- If editing: keep the same
- Final (4K): only when prompt is locked
uv run ~/.openclaw/workspace/skills/nano-banana-2-direct/scripts/generate_image.py --prompt "<final prompt>" --filename "yyyy-mm-dd-hh-mm-ss-final.png" --resolution 4K
Resolution Options
The Gemini 3.1 Flash Image API supports three resolutions (uppercase K required):
- 1K (default) - ~1024px resolution
- 2K - ~2048px resolution
- 4K - ~4096px resolution
Map user requests to API parameters:
- No mention of resolution →
1K - "low resolution", "1080", "1080p", "1K" →
1K - "2K", "2048", "normal", "medium resolution" →
2K - "high resolution", "high-res", "hi-res", "4K", "ultra" →
4K
API Key
The script checks for API key in this order:
--api-keyargument (use if user provided key in chat)GEMINI_API_KEYenvironment variable
If neither is available, the script exits with an error message.
Preflight + Common Failures (fast fixes)
-
Preflight:
command -v uv(must exist)test -n "$GEMINI_API_KEY"(or pass--api-key)- If editing:
test -f "path/to/input.png"
-
Common failures:
Error: No API key provided.→ setGEMINI_API_KEYor pass--api-keyError loading input image:→ wrong path / unreadable file; verify--input-imagepoints to a real image- "quota/permission/403" style API errors → wrong key, no access, or quota exceeded; try a different key/account
Filename Generation
Generate filenames with the pattern: yyyy-mm-dd-hh-mm-ss-name.png
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-franklu0819-lang-nano-banana-2-direct": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
zhipu-asr
Automatic Speech Recognition (ASR) using Zhipu AI (BigModel) GLM-ASR model. Use when you need to transcribe audio files to text. Supports Chinese audio transcription with context prompts, custom hotwords, and multiple audio formats.
zhipu-tts
Text-to-speech conversion using Zhipu AI (BigModel) GLM-TTS model. Use when you need to convert text to audio files with various voice options. Supports Chinese text synthesis with multiple voice personas, speed control, and output formats.
feishu-file
飞书文件发送技能。支持发送各类文件到飞书聊天,包括文档、图片、压缩包等,自动识别文件类型并处理上传。
clawhub-manager
ClawHub 技能管理工具。封装技能的发布、删除、查询和搜索功能,方便管理 ClawHub 上的技能。
md2pdf
Markdown 转 PDF 技能。将 Markdown 文件转换为精美的 PDF 文档,完美支持中文、代码高亮、自定义样式。