alterlab-generate-image — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited alterlab-generate-image (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Generate and edit high-quality images using OpenRouter's image generation models including FLUX.2 Pro and Gemini 3.1 Flash Image (a.k.a. "Nano Banana 2").
Use this skill (`alterlab-generate-image`) for:
| Scenario | Use Instead |
|---|---|
| Flowchart, CONSORT/PRISMA or methodology diagram, circuit, biological pathway, system or neural-network architecture | alterlab-scientific-schematics |
| Infographic that lays out statistics, a timeline, a comparison, or process steps as a designed graphic | alterlab-infographics |
| Plot of numeric data from a file or array (scatter, bar, line, distribution) | alterlab-matplotlib / alterlab-seaborn / alterlab-plotly |
| Diagram that should stay editable, version-controlled text in a README or Markdown doc | alterlab-mermaid |
Use the scripts/generate_image.py script to generate or edit images:
# Generate a new image
python scripts/generate_image.py "A beautiful sunset over mountains"
# Edit an existing image
python scripts/generate_image.py "Make the sky purple" --input photo.jpgThis generates/edits an image and saves it as generated_image.png in the current directory.
The script needs an OpenRouter API key and stops with an error if it can't find one. It checks, in order: the --api-key flag, the OPENROUTER_API_KEY environment variable, then an OPENROUTER_API_KEY=<key> line in a .env file in the current or a parent directory. If none is set, ask the user to either:
export OPENROUTER_API_KEY=your-api-key-here, orOPENROUTER_API_KEY=your-api-key-here to a .env file.Keys are issued at https://openrouter.ai/keys.
This skill sends your prompts and any input image to a third-party API (OpenRouter) for processing. Avoid sending confidential, clinical, or unpublished material. The OpenRouter API key is read from the environment (OPENROUTER_API_KEY).
Default: google/gemini-3.1-flash-image ("Nano Banana 2", GA) — high quality, generation + editing. Use this unless there's a reason not to. It replaced google/gemini-3.1-flash-image-preview, which Google shut down on 2026-06-25. Set ALTERLAB_IMAGE_MODEL to change the default for every run, or pass --model for one run.
Other models (all support both generation and editing on OpenRouter):
black-forest-labs/flux.2-pro — frontier visual quality, strong prompt adherence, up to 4 MP.black-forest-labs/flux.2-flex — cheaper; especially good at rendering text/typography and fine detail.Model IDs are version-sensitive (verified against the OpenRouter model list on 2026-09-23) — re-check https://openrouter.ai/models if a call returns a "model not found" error. The script uses OpenRouter's chat-completions endpoint with the modalities parameter. OpenRouter launched a dedicated Image API (/api/v1/images) in June 2026: image models that existed then stay available on chat completions (all models listed here do), but models added since may be served only by the Image API — if a newer model fails with this script, that is the likely reason.
# Generate (default model) to a chosen path
python scripts/generate_image.py "Abstract art" --output artwork.png
# Generate with a specific model
python scripts/generate_image.py "A cat in space" --model "black-forest-labs/flux.2-pro"
# Edit an existing image (edit mode is triggered by --input)
python scripts/generate_image.py "Add sunglasses to the person" --input portrait.png --output cleaned.pngFor multiple images, run the script once per prompt with distinct --output paths (it always writes one file and overwrites the default generated_image.png).
prompt (required): Text description of the image to generate, or editing instructions--input or -i: Input image path for editing (enables edit mode)--model or -m: OpenRouter model ID (default: $ALTERLAB_IMAGE_MODEL, else google/gemini-3.1-flash-image)--output or -o: Output file path (default: generated_image.png)--api-key: OpenRouter API key (overrides OPENROUTER_API_KEY and .env)# Conceptual figure for a paper (illustration, not a data plot)
python scripts/generate_image.py "Microscopic view of cancer cells being attacked by immunotherapy agents, clean scientific illustration style" --output figures/immunotherapy_concept.png
# Slide background / poster hero image
python scripts/generate_image.py "Abstract blue and white background with subtle molecular patterns, professional presentation style" --output slides/background.png
python scripts/generate_image.py "Modern, well-lit laboratory with current equipment, photorealistic" --output poster/hero.png--output; the script handles both the images and content response shapes used by different OpenRouter models.requests, a network error, an API error (with status code), or a response without an image — read it and fix before retrying.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.