Nano Banana Pro (Gemini 3 Pro Image)
Use the bundled script to generate or edit images.
Generate
CODEBLOCK0
Edit
CODEBLOCK1
Batch API (50% cheaper, non-blocking)
CODEBLOCK2
Batch file format (JSON array):
CODEBLOCK3
Batch notes
- -
--batch is always non-blocking: submits the job, prints BATCH_JOB: token, and exits immediately. - After submitting, add a temporary check list to HEARTBEAT.md. Include why this image was requested (context/intent), so it's clear even after a session reset.
# Temporary Check List
- **Nano Banana Batch job**: <why this image was requested>. Check `batches/abc123` for job result. When ready, retrieve and send to user with mediaUrl parameter. Remove this item after reporting the result.
- - If the user explicitly requests a timed check, use a cronjob instead of HEARTBEAT.md.
- The script tracks pending jobs in
memory/pending-batch-jobs.json. Created on batch submit, removed on --batch-check completion. Format: [{"job_name", "filename", "prompt", "created_at"}]. File is deleted when empty.
API key
- -
GEMINI_API_KEY env var - Or set
skills."nano-banana-pro".apiKey / skills."nano-banana-pro".env.GEMINI_API_KEY in INLINECODE8
Notes
- - Resolutions:
1K (default), 2K, 4K. - Aspect ratios:
1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9. Generation only (ignored for editing). - Use timestamps in filenames:
YYYYMMDD-hhmmss-name.png. - The script outputs the saved file path. To send images via messaging channels, use the
mediaUrl parameter in your channel action (e.g., mediaUrl: "/absolute/path/to/output.png"). - Do not read the image back; report the saved path and use it with mediaUrl to deliver the image to the user.
Nano Banana Pro (Gemini 3 Pro Image)
使用捆绑脚本生成或编辑图像。
生成
bash
uv run {baseDir}/scripts/generate_image.py --prompt 你的图像描述 --filename output.png --resolution 1K --aspect-ratio 16:9
编辑
bash
uv run {baseDir}/scripts/generate_image.py --prompt 编辑指令 --filename output.png --input-image /path/in.png --resolution 2K
批量 API(便宜50%,非阻塞)
bash
单张图像
uv run {baseDir}/scripts/generate_image.py --prompt 描述 --filename output.png --batch
从 JSON 文件批量处理
uv run {baseDir}/scripts/generate_image.py --batch-file .tmp/requests.json
检查/获取先前任务的结果
uv run {baseDir}/scripts/generate_image.py --batch-check batches/abc123 --filename output.png
批量文件格式(JSON 数组):
json
[
{
prompt: 一只可爱的猫,
filename: cat.png,
resolution: 1K,
aspect_ratio: 16:9
},
{
prompt: 一只奔跑的狗,
filename: dog.png,
resolution: 2K
}
]
批量说明
- - --batch 始终是非阻塞的:提交任务,打印 BATCH_JOB: 令牌,然后立即退出。
- 提交后,在 HEARTBEAT.md 中添加临时检查列表。包括为什么请求此图像(上下文/意图),以便即使在会话重置后也能清晰明了。
# 临时检查列表
- Nano Banana 批量任务:<请求此图像的原因>。检查 batches/abc123 获取任务结果。准备就绪后,检索并通过 mediaUrl 参数发送给用户。报告结果后删除此项。
- - 如果用户明确要求定时检查,请使用 cronjob 而不是 HEARTBEAT.md。
- 脚本在 memory/pending-batch-jobs.json 中跟踪待处理任务。在批量提交时创建,在 --batch-check 完成时删除。格式:[{jobname, filename, prompt, createdat}]。文件为空时被删除。
API 密钥
- - GEMINIAPIKEY 环境变量
- 或在 ~/.clawdbot/clawdbot.json 中设置 skills.nano-banana-pro.apiKey / skills.nano-banana-pro.env.GEMINIAPIKEY
说明
- - 分辨率:1K(默认)、2K、4K。
- 宽高比:1:1、2:3、3:2、3:4、4:3、4:5、5:4、9:16、16:9、21:9。仅用于生成(编辑时忽略)。
- 在文件名中使用时间戳:YYYYMMDD-hhmmss-name.png。
- 脚本输出保存的文件路径。要通过消息渠道发送图像,请在渠道操作中使用 mediaUrl 参数(例如 mediaUrl: /absolute/path/to/output.png)。
- 不要回读图像;报告保存的路径并使用 mediaUrl 将图像传递给用户。