Image Generation Skill
This skill enables you to generate images using a variety of state-of-the-art AI models. It supports:
- Midjourney (via Legnext.ai) — Best for artistic, cinematic, and highly detailed images. Faster and more stable than other MJ providers.
- Flux 1.1 Pro (via fal.ai) — Best for photorealistic images and complex scenes.
- Flux Dev (via fal.ai) — Fast, high-quality generation for general use.
- Flux Schnell (via fal.ai) — Ultra-fast generation (<2s), great for quick drafts.
- SDXL Lightning (via fal.ai) — Fast Stable Diffusion XL, great for stylized art.
- Nano Banana Pro (via fal.ai
fal-ai/nano-banana-pro) — Google Gemini-powered image generation and editing.
- Ideogram v3 (via fal.ai) — Best for images with text, logos, and typography.
- Recraft v3 (via fal.ai) — Best for vector-style, icon, and design assets.
Model Selection Guide
When the user does not specify a model, use this guide to pick the best one:
| User Intent |
Recommended Model |
Model ID |
| Artistic, cinematic, painterly, highly detailed |
Midjourney |
midjourney |
| Photorealistic, portrait, product photo |
Flux 1.1 Pro |
flux-pro |
| General purpose, balanced quality/speed |
Flux Dev |
flux-dev |
| Quick draft, fast iteration (<2s) |
Flux Schnell |
flux-schnell |
| Image with text, logo, poster, typography |
Ideogram v3 |
ideogram |
| Vector art, icon, flat design, illustration |
Recraft v3 |
recraft |
| Stylized anime, illustration, concept art |
SDXL Lightning |
sdxl |
| Gemini-powered generation or editing |
Nano Banana Pro |
nano-banana |
How to Use This Skill
Basic Usage
When a user asks to generate an image, follow these steps:
- Understand the request: Identify the subject, style, and any specific requirements.
- Select a model: Use the guide above, or honor the user's explicit model choice.
- Enhance the prompt: Expand the user's prompt with relevant style, lighting, and quality descriptors appropriate for the chosen model.
- Call the generation script: Use the
exec tool to run the generation script.
- Return the result: Present the image URL(s) to the user.
Calling the Generation Script
Use the exec tool to run the Node.js script at {baseDir}/generate.js:
node {baseDir}/generate.js \
--model <model_id> \
--prompt "<enhanced prompt>" \
[--aspect-ratio <ratio>] \
[--num-images <1-4>] \
[--negative-prompt "<negative prompt>"]
Parameters:
--model: One of midjourney, flux-pro, flux-dev, flux-schnell, sdxl, nano-banana, ideogram, recraft
--prompt: The image generation prompt (required)
--aspect-ratio: Output aspect ratio, e.g. 16:9, 1:1, 9:16, 4:3, 3:4 (default: 1:1)
--num-images: Number of images to generate, 1-4 (default: 1, Midjourney always returns 4)
--negative-prompt: Things to avoid in the image (not supported by Midjourney)
--mode: Midjourney speed mode: turbo (default, 10-20s, requires Pro/Mega plan), fast (30-60s), relax (free but slow)
Example:
node {baseDir}/generate.js \
--model flux-pro \
--prompt "a majestic snow leopard on a mountain peak, golden hour lighting, photorealistic, 8k" \
--aspect-ratio 16:9 \
--num-images 1
Midjourney-Specific Notes
Midjourney is powered by Legnext.ai (faster and more stable than TTAPI). Turbo mode is enabled by default (--turbo), which reduces generation time to ~10-20 seconds (requires a Midjourney Pro or Mega plan). The --aspect-ratio is automatically appended to the prompt as --ar <ratio>. The model always generates 4 images in a grid. After generation, you can:
- Ask the user if they want to upscale (U1-U4) or create variations (V1-V4) of any image.
- Use
--action upscale --index <1-4> --job-id <id> to upscale a specific image.
- Use
--action variation --index <1-4> --job-id <id> to create variations.
- Use
--action reroll --job-id <id> to re-generate with the same prompt.
Upscale types (via --upscale-type):
0 = Subtle (default): Conservative enhancement, preserves original details. Best for photography.
1 = Creative: More artistic interpretation. Best for illustrations.
Variation types (via --variation-type):
0 = Subtle (default): Minor changes while preserving composition.
1 = Strong: More dramatic variations with significant changes.
# Upscale image 2 from a previous Midjourney generation (subtle)
node {baseDir}/generate.js \
--model midjourney \
--action upscale \
--index 2 \
--job-id <previous_job_id> \
--upscale-type 0
# Create a strong variation of image 3
node {baseDir}/generate.js \
--model midjourney \
--action variation \
--index 3 \
--job-id <previous_job_id> \
--variation-type 1
# Reroll (regenerate with same prompt)
node {baseDir}/generate.js \
--model midjourney \
--action reroll \
--job-id <previous_job_id>
Prompt Enhancement Tips
- For Midjourney: Add style keywords like
cinematic lighting, photorealistic, --v 7, --style raw, --ar 16:9. Legnext.ai supports all MJ parameters.
- For Flux: Add quality boosters like
masterpiece, highly detailed, sharp focus, professional photography
- For Ideogram: Be explicit about text content, font style, and layout
- For Recraft: Specify
vector illustration, flat design, icon style, SVG-style
Environment Variables
This skill requires the following environment variables to be set in your OpenClaw config:
Configure them in ~/.openclaw/openclaw.json:
{
"skills": {
"entries": {
"image-gen": {
"enabled": true,
"env": {
"FAL_KEY": "your_fal_key_here",
"LEGNEXT_KEY": "your_legnext_key_here"
}
}
}
}
}
Example Conversations
User: "帮我画一只在雪山上的雪豹,电影感光效"
Action: Select midjourney, enhance prompt to "a majestic snow leopard on a snowy mountain peak, cinematic lighting, dramatic atmosphere, ultra detailed --ar 16:9 --v 7", run script.
User: "用 Flux 生成一张产品海报,白色背景,一瓶香水"
Action: Select flux-pro, enhance prompt, run script with --aspect-ratio 3:4.
User: "快速生成一个草稿看看效果"
Action: Select flux-schnell for fastest generation (<2 seconds).
User: "帮我做一个 App 图标,扁平风格,蓝色系"
Action: Select recraft, use prompt with flat design icon, blue color scheme, minimal, vector style.
User: "把第2张图片放大"
Action: Run with --model midjourney --action upscale --index 2 --job-id <id>.
1---2name: image-gen3description: Generate images using multiple AI models — Midjourney (via Legnext.ai), Flux, SDXL, Nano Banana (Gemini), and more via fal.ai. Automatically picks the best model based on user intent, or lets the user specify one explicitly.4---56# Image Generation Skill78This skill enables you to generate images using a variety of state-of-the-art AI models. It supports:910- **Midjourney** (via [Legnext.ai](https://legnext.ai)) — Best for artistic, cinematic, and highly detailed images. Faster and more stable than other MJ providers.11- **Flux 1.1 Pro** (via fal.ai) — Best for photorealistic images and complex scenes.12- **Flux Dev** (via fal.ai) — Fast, high-quality generation for general use.13- **Flux Schnell** (via fal.ai) — Ultra-fast generation (<2s), great for quick drafts.14- **SDXL Lightning** (via fal.ai) — Fast Stable Diffusion XL, great for stylized art.15- **Nano Banana Pro** (via fal.ai `fal-ai/nano-banana-pro`) — Google Gemini-powered image generation and editing.16- **Ideogram v3** (via fal.ai) — Best for images with text, logos, and typography.17- **Recraft v3** (via fal.ai) — Best for vector-style, icon, and design assets.1819---2021## Model Selection Guide2223When the user does not specify a model, use this guide to pick the best one:2425| User Intent | Recommended Model | Model ID |26|---|---|---|27| Artistic, cinematic, painterly, highly detailed | Midjourney | `midjourney` |28| Photorealistic, portrait, product photo | Flux 1.1 Pro | `flux-pro` |29| General purpose, balanced quality/speed | Flux Dev | `flux-dev` |30| Quick draft, fast iteration (<2s) | Flux Schnell | `flux-schnell` |31| Image with text, logo, poster, typography | Ideogram v3 | `ideogram` |32| Vector art, icon, flat design, illustration | Recraft v3 | `recraft` |33| Stylized anime, illustration, concept art | SDXL Lightning | `sdxl` |34| Gemini-powered generation or editing | Nano Banana Pro | `nano-banana` |3536---3738## How to Use This Skill3940### Basic Usage4142When a user asks to generate an image, follow these steps:43441. **Understand the request**: Identify the subject, style, and any specific requirements.452. **Select a model**: Use the guide above, or honor the user's explicit model choice.463. **Enhance the prompt**: Expand the user's prompt with relevant style, lighting, and quality descriptors appropriate for the chosen model.474. **Call the generation script**: Use the `exec` tool to run the generation script.485. **Return the result**: Present the image URL(s) to the user.4950### Calling the Generation Script5152Use the `exec` tool to run the Node.js script at `{baseDir}/generate.js`:5354```bash55node {baseDir}/generate.js \56 --model <model_id> \57 --prompt "<enhanced prompt>" \58 [--aspect-ratio <ratio>] \59 [--num-images <1-4>] \60 [--negative-prompt "<negative prompt>"]61```6263**Parameters:**64- `--model`: One of `midjourney`, `flux-pro`, `flux-dev`, `flux-schnell`, `sdxl`, `nano-banana`, `ideogram`, `recraft`65- `--prompt`: The image generation prompt (required)66- `--aspect-ratio`: Output aspect ratio, e.g. `16:9`, `1:1`, `9:16`, `4:3`, `3:4` (default: `1:1`)67- `--num-images`: Number of images to generate, 1-4 (default: `1`, Midjourney always returns 4)68- `--negative-prompt`: Things to avoid in the image (not supported by Midjourney)69- `--mode`: Midjourney speed mode: `turbo` (default, ~10-20s, requires Pro/Mega plan), `fast` (~30-60s), `relax` (free but slow)7071**Example:**72```bash73node {baseDir}/generate.js \74 --model flux-pro \75 --prompt "a majestic snow leopard on a mountain peak, golden hour lighting, photorealistic, 8k" \76 --aspect-ratio 16:9 \77 --num-images 178```7980### Midjourney-Specific Notes8182Midjourney is powered by **Legnext.ai** (faster and more stable than TTAPI). **Turbo mode is enabled by default** (`--turbo`), which reduces generation time to ~10-20 seconds (requires a Midjourney Pro or Mega plan). The `--aspect-ratio` is automatically appended to the prompt as `--ar <ratio>`. The model always generates 4 images in a grid. After generation, you can:8384- Ask the user if they want to **upscale** (U1-U4) or **create variations** (V1-V4) of any image.85- Use `--action upscale --index <1-4> --job-id <id>` to upscale a specific image.86- Use `--action variation --index <1-4> --job-id <id>` to create variations.87- Use `--action reroll --job-id <id>` to re-generate with the same prompt.8889**Upscale types** (via `--upscale-type`):90- `0` = Subtle (default): Conservative enhancement, preserves original details. Best for photography.91- `1` = Creative: More artistic interpretation. Best for illustrations.9293**Variation types** (via `--variation-type`):94- `0` = Subtle (default): Minor changes while preserving composition.95- `1` = Strong: More dramatic variations with significant changes.9697```bash98# Upscale image 2 from a previous Midjourney generation (subtle)99node {baseDir}/generate.js \100 --model midjourney \101 --action upscale \102 --index 2 \103 --job-id <previous_job_id> \104 --upscale-type 0105106# Create a strong variation of image 3107node {baseDir}/generate.js \108 --model midjourney \109 --action variation \110 --index 3 \111 --job-id <previous_job_id> \112 --variation-type 1113114# Reroll (regenerate with same prompt)115node {baseDir}/generate.js \116 --model midjourney \117 --action reroll \118 --job-id <previous_job_id>119```120121### Prompt Enhancement Tips122123- **For Midjourney**: Add style keywords like `cinematic lighting`, `photorealistic`, `--v 7`, `--style raw`, `--ar 16:9`. Legnext.ai supports all MJ parameters.124- **For Flux**: Add quality boosters like `masterpiece`, `highly detailed`, `sharp focus`, `professional photography`125- **For Ideogram**: Be explicit about text content, font style, and layout126- **For Recraft**: Specify `vector illustration`, `flat design`, `icon style`, `SVG-style`127128---129130## Environment Variables131132This skill requires the following environment variables to be set in your OpenClaw config:133134| Variable | Description | Where to get it |135|---|---|---|136| `FAL_KEY` | fal.ai API key (for Flux, SDXL, Nano Banana, Ideogram, Recraft) | https://fal.ai/dashboard/keys |137| `LEGNEXT_KEY` | Legnext.ai API key (for Midjourney) | https://legnext.ai/dashboard |138139Configure them in `~/.openclaw/openclaw.json`:140```json141{142 "skills": {143 "entries": {144 "image-gen": {145 "enabled": true,146 "env": {147 "FAL_KEY": "your_fal_key_here",148 "LEGNEXT_KEY": "your_legnext_key_here"149 }150 }151 }152 }153}154```155156---157158## Example Conversations159160**User**: "帮我画一只在雪山上的雪豹,电影感光效"161**Action**: Select `midjourney`, enhance prompt to `"a majestic snow leopard on a snowy mountain peak, cinematic lighting, dramatic atmosphere, ultra detailed --ar 16:9 --v 7"`, run script.162163**User**: "用 Flux 生成一张产品海报,白色背景,一瓶香水"164**Action**: Select `flux-pro`, enhance prompt, run script with `--aspect-ratio 3:4`.165166**User**: "快速生成一个草稿看看效果"167**Action**: Select `flux-schnell` for fastest generation (<2 seconds).168169**User**: "帮我做一个 App 图标,扁平风格,蓝色系"170**Action**: Select `recraft`, use prompt with `flat design icon, blue color scheme, minimal, vector style`.171172**User**: "把第2张图片放大"173**Action**: Run with `--model midjourney --action upscale --index 2 --job-id <id>`.