Generate images with Nano Banana Pro via OpenRouter. Use when the user asks for image generation, mentions Nano Banana Pro, Gemini 3 Pro Image, or OpenRouter image generation.
1. --api-key argument (use if user provided a key in chat)
OPENROUTERAPIKEY environment variable
The API base URL must be set via OPENROUTERBASEURL. Use the full chat
completions endpoint (for OpenRouter: https://openrouter.ai/api/v1/chat/completions).
The script also loads .env files automatically (if present):
- Current working directory .env
Skill directory .env
Important: If a .env file exists, do not ask the user for the key up front.
Just run the script and only ask if it errors with "No API key provided."
OpenClaw Chat Execution Rules
- OpenClaw does NOT auto-source the skill .env file
If ~/.openclaw/workspace/skills/nano-banana-pro-openrouter/.env exists:
1. Use the read tool to read .env
2. Extract OPENROUTER_API_KEY and OPENROUTER_BASE_URL
3. Always pass the key via --api-key when running the script
- Only ask the user if .env is missing or the key cannot be read
If the user asks for a timestamped filename, prefer --filename auto (do not handwrite dates)
If neither is available, the script exits with an error message.
Preflight and Common Failures (fast fixes)
Preflight:
- command -v sh (must exist)
INLINECODE13 (must exist)
INLINECODE14 (must exist)
Common failures:
- Error: No API key provided. -> read .env and retry with --api-key; if still failing, ask the user to set OPENROUTERAPIKEY
INLINECODE16 -> ensure OPENROUTERBASEURL is set to a full chat completions endpoint
INLINECODE17 -> wrong path or unreadable file; verify --input-image points 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: INLINECODE18
Format: {timestamp}-{descriptive-name}.png
- Timestamp: Current date/time in format yyyy-mm-dd-hh-mm-ss (24-hour format)
Name: Descriptive lowercase text with hyphens
Keep the descriptive part concise (1-5 words typically)
Use context from the user's prompt or conversation
If unclear, use INLINECODE21
Examples:
- Prompt "A serene Japanese garden" -> INLINECODE22
Prompt "sunset over mountains" -> INLINECODE23
Prompt "create an image of a robot" -> INLINECODE24
Unclear context -> INLINECODE25
Tip: To avoid incorrect timestamps, pass --filename auto and let the script
generate the filename using the system clock.
Image Editing (Not Supported in Shell Version)
The shell script only supports generating new images. Editing an input image is not available in this version.
Prompt Handling
For generation: pass the user's image description as-is to --prompt. Only rework if clearly insufficient.
Prompt Templates (high hit-rate)
Use templates when the user is vague or when edits must be precise.