generate-image
Original:🇺🇸 English
Translated
1 scripts
Use when the user needs to generate images, UI assets, icons, backgrounds, placeholders, or any visual content. Triggers on requests like "generate an image", "create a picture", "make an icon", "I need a visual for...".
1installs
Added on
NPX Install
npx skill4agent add wxul/openrouter-generate-image-skill generate-imageTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Generate Image via OpenRouter
Generate images using OpenRouter's image models from the command line. Default model: .
google/gemini-3.1-flash-image-previewPrerequisites
- environment variable must be set
OPENROUTER_API_KEY - available via npx
tsx
Usage
Run the script via :
npx tsxbash
npx tsx generate-image.ts \
--prompt "description of the image" \
--model "google/gemini-3.1-flash-image-preview" \
--width 1024 --height 1024 \
--output "filename.png" \
--dir "./generated-images" \
--proxy "http://127.0.0.1:7890"Parameters
| Param | Required | Default | Description |
|---|---|---|---|
| Yes | - | Image description |
| No | | OpenRouter model ID |
| No | 1024 | Image width |
| No | 1024 | Image height |
| No | auto (timestamp-slug.png) | Output filename |
| No | | Output directory |
| No | - | HTTP proxy URL |
Supported Models
- (default, recommended)
google/gemini-3.1-flash-image-preview black-forest-labs/flux-1.1-problack-forest-labs/flux-schnell- Any OpenRouter model that supports image generation
How to Use as an Agent
When the user asks you to generate an image:
- Compose a detailed English prompt describing the desired image
- Choose appropriate model and size for the use case
- Run the script using Bash tool
- The script outputs the saved file path to stdout — use this path to reference the image in code or tell the user
Quick Examples
bash
# Simple generation with defaults
npx tsx generate-image.ts \
--prompt "a minimalist logo of a mountain with a sun, flat design, blue and orange"
# With specific model and output
npx tsx generate-image.ts \
--prompt "abstract gradient background, purple to blue" \
--model "black-forest-labs/flux-1.1-pro" \
--output "bg-gradient.png" \
--dir "./public/images"
# With proxy
npx tsx generate-image.ts \
--prompt "pixel art cat sitting on a desk" \
--proxy "http://127.0.0.1:7890"Troubleshooting
- No API key: Set env var. Get key at https://openrouter.ai/keys
OPENROUTER_API_KEY - Proxy issues: Ensure proxy URL is correct and proxy is running
- Model not found: Check available models at https://openrouter.ai/models