AI agent skill · by @TokenRhythm
Nano Banana Pro Openrouter
Deterministic OpenRouter image generation adapter for Nano Banana Pro / Gemini image models. Use as skill_exec when a meta-skill needs local image files and structured IMAGE_READY records without spawning an LLM agent.
Archived 2026-10-23 · Source updated 2026-09-17 · License: Apache-2.0. Check the original repository for the latest version.
SKILL.md instructions
# Nano Banana Pro OpenRouter Adapter
This skill is a deterministic adapter around OpenRouter image generation. It is
intended for meta-skill `skill_exec` use, not as an open-ended agent surface.
## Contract
- During MetaSkill execution, accepts only the parent-resolved, process-local
provider lease. The credential, endpoint, and proxy never enter `with`, argv,
the plan, or persisted run data. Direct standalone CLI use may still provide
`OPENROUTER_API_KEY`.
- Does not read `.env` files, prompt for credentials, print credentials, or
write credentials to disk.
- Uses only the model, base URL, output directory, and local path prefix passed
by the caller.
- Saves generated image bytes under the supplied output directory.
- Emits one `IMAGE_READY:` JSON line per saved image.
- A missing/invalid required MetaSkill lease exits 78 before any provider
submission. Provider failures after submission emit `IMAGE_GENERATION_FAILED`
with exit 0 so the webpage can bind a replacement slot without auto-replay.
## Meta-Skill Payload Mode
When stdin is JSON containing `media_slots`, `image_slots`, `slots`, or
`page_outline`, the adapter generates image slots and preserves already
downloaded images. Structured slots are preferred over free-form outline text:
```json
{
"requirement_framing": "...",
"media_slots": {"slots": [{"slot_id": "hero-visual", "modality": "image"}]},
"page_outline": "...",
"image_download": "...",
"include_images": "YES",
"visual_style": "..."
}
```
Existing `IMAGE_READY:` records in `image_download` are preserved. If
`IMAGE_DOWNLOAD_INCOMPLETE:` lists `unfilled_slot_ids`, only those slots are
generated. If the caller requested images but both structured slots and outline
slot parsing are empty, the adapter synthesizes minimal webpage-safe image
slots from the brief instead of emitting `no_image_slots_to_generate`.
## Plain Prompt Mode
When stdin is plain text, the adapter generates one image using that text as the
prompt and the `--filename` stem as the `slot_id`.