Skip to main content
skill CX Codex

invokeai-image-gen — Claude Code skill: local image generation

invokeai-image-gen — a skill for generating images via local InvokeAI API, supporting FLUX.2 Klein, Z-Image Turbo, and SDXL. Auto-detects models and applies appropriate parameters, saves output as PNG.

Apache-2.0 ★ 173 updated 2026-10-24

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add sammcj/agentic-coding --skill invokeai-image-gen -a claude-code
Open on GitHub

What invokeai-image-gen does

This skill connects to a running InvokeAI instance and converts text prompts into images. It supports multiple modern models — FLUX.2 Klein as the default (4 inference steps, fast), FLUX.1 in dev and schnell variants, Z-Image Turbo, and SDXL — each with pre-tuned settings that you can override per request.

Under the hood is a Python script (scripts/generate.py) handling the generation pipeline. You control the prompt, output dimensions (1024×1024 by default), denoising steps, CFG scale, guidance strength, and random seed. For SDXL, negative prompts are supported. The generated image saves as PNG with a default name based on the seed, or to a path you specify.

The skill requires a local InvokeAI server running at http://localhost:9090 (or a custom URL set via the INVOKEAI_API_URL environment variable). Dependency mismatches in the InvokeAI environment can cause failures. On macOS, black image output sometimes occurs — fix it by setting precision: bfloat16 in invokeai.yaml.

What it helps with

  • Generate an image from a text description using InvokeAI models
  • Switch between FLUX and SDXL models during a session
  • Tune generation parameters for speed versus quality trade-offs
  • List and query which models are installed in InvokeAI

Example prompts for the agent

  • Generate an image with FLUX.2 Klein: a dramatic sunset over snow mountains with reflection in a lake
  • Create a portrait of a cat with green eyes using FLUX.1 dev and higher guidance strength
  • Produce multiple images with the same seed but different step counts

How to install invokeai-image-gen

1Skills CLI (Vercel)

npx skills add sammcj/agentic-coding --skill invokeai-image-gen -a claude-code

2Manually: put the files in place

~/.claude/skills/invokeai-image-gen/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/invokeai-image-gen/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about invokeai-image-gen

How do I install invokeai-image-gen in Claude Code?

Run npx skills add sammcj/agentic-coding --skill invokeai-image-gen -a claude-code. The skill file will appear at ~/.claude/skills/invokeai-image-gen/SKILL.md.

What does invokeai-image-gen do?

It generates images from text prompts via a local InvokeAI API. The skill supports FLUX.2 Klein, FLUX.1 variants, Z-Image Turbo, and SDXL, auto-selecting optimal parameters for each model.

What prerequisites are needed?

InvokeAI must be running locally at http://localhost:9090 (configurable via INVOKEAI_API_URL env var). On macOS, set precision: bfloat16 in invokeai.yaml to avoid black image output.

Source text

SKILL.md · Apache-2.0
---
name: invokeai-image-gen
description: Generate images using InvokeAI's local API. Use when asked to generate, create, or make images with InvokeAI, FLUX.2 Klein, Z-Image Turbo, FLUX, or SDXL models. Supports text-to-image generation, automatic model detection, image download, and parameter selection based on model architecture.
# model: inherit
# context: fork
# user-invocable: true
# allowed-tools: Read,Bash
---

# InvokeAI Image Generation

Generate images via InvokeAI's REST API. Supports FLUX.2 Klein (default), Z-Image Turbo, FLUX.1, and SDXL.

## Quick Start

Simply call the script with your prompt and the output file name:

```bash
python scripts/generate.py -p "A dramatic sunset over snow-capped mountains, warm orange light reflecting off a still alpine lake in the foreground. Soft clouds catch the fading light." -o sunset.png
```

## Overriding The Default Model

If the user asks you to use a specific model, first find the model key, then use it in the command:

```bash
python scripts/generate.py --list-models | grep -i 'flux'

python scripts/generate.py -p "A tabby cat with bright green eyes sits on a weathered wooden windowsill, soft afternoon light streaming through lace curtains. Cosy, intimate mood." --model MODEL_KEY -o cat.png
```

## Options

| Option | Description |
|--------|-------------|
| `--prompt, -p` | Generation prompt (required) |
| `--negative, -n` | Negative prompt (SDXL only) |
| `--model, -m` | Model key (UUID) or partial name match |
| `--width, -W` / `--height, -H` | Dimensions |
| `--steps, -s` | Denoising steps |
| `--cfg, -c` | CFG scale |
| `--guidance, -g` | Guidance strength (FLUX.1 only) |
| `--scheduler` | Sampling scheduler |
| `--seed` | Random seed |
| `--output, -o` | Output path (default: invokeai-{seed}.png) |
| `--list-models` | List installed models |
| `--json` | JSON output |

## Model Defaults

Note: FLUX.2 Klein is the latest model which is used by default.

| Model | Steps | Guidance | CFG | Scheduler |
|-------|-------|----------|-----|-----------|
| FLUX.2 Klein | 4 | 3.5 | 1.0 | euler |
| Z-Image Turbo | 9 | - | 1.0 | euler |
| **FLUX.1 dev** | 28 | 3.5 | 1.0 | euler |
| **FLUX.1 Krea dev** | 28 | 4.5 | 1.0 | euler |
| **FLUX.1 Kontext dev** | 28 | 2.5 | 1.0 | euler |
| **FLUX.1 schnell** | 4 | 0.0 | 1.0 | euler |
| SDXL | 25 | - | 6.0 | dpmpp_2m_k |
| SDXL Turbo | 8 | - | 1.0 | dpmpp_sde |

All models default to 1024x1024. FLUX requires dimensions divisible by 16, SDXL by 8.

### FLUX.1 Variant Notes

- **FLUX.1 dev**: Standard text-to-image model, balanced quality/speed
- **FLUX.1 Krea dev**: Fine-tuned for aesthetic photography, use higher guidance (4.5)
- **FLUX.1 Kontext dev**: Image editing model, use lower guidance (2.5)
- **FLUX.1 schnell**: Distilled fast model, 4 steps, no guidance needed

## Model Selection

Auto-priority: Klein > Z-Image > FLUX > SDXL

Detection by name/base:
- **flux2_klein**: "klein" in name or "flux2" in base
- **flux_krea**: "krea" in name (FLUX.1 base)
- **flux_kontext**: "kontext" in name (FLUX.1 base)
- **flux_schnell**: "schnell" in name (FLUX.1 base)
- **flux**: "flux" in base (standard dev)
- **zimage**: "z-image" in base or "z-image/zimage" in name
- **sdxl**: "sdxl" in base (turbo/lightning variants auto-detect)

## Prompting (general information, but especially useful for FLUX.2 Klein)

Write prose, not keywords. Structure: **Subject -> Setting -> Details -> Lighting -> Atmosphere**

```
A weathered fisherman in his late sixties stands at the bow of a wooden boat,
wearing a salt-stained wool sweater. Golden hour sunlight filters through
morning mist, creating quiet determination and solitude.
```

**Key techniques:**
1. Front-load critical elements (word order matters)
2. Specify lighting: source, quality, direction, temperature
3. Include sensory texture: materials, reflections, atmosphere

**Good:** "A woman with short blonde hair poses against a light neutral background wearing colourful earrings, resting her chin on her hand."

**Bad:** "woman, blonde, short hair, neutral background, earrings"

Append style tags: `Style: Country chic. Mood: Serene, romantic.`

## Troubleshooting

| Issue | Solution |
|-------|----------|
| Connection refused | Check InvokeAI is running |
| Model not found | Use `--list-models` for valid keys |
| Dimensions error | FLUX: multiples of 16, SDXL: 8 |
| Black images (macOS) | Set `precision: bfloat16` in invokeai.yaml |

If the script fails to find the URL or authentication token, you can set or ask the user to set environment variables:

```bash
export INVOKEAI_API_URL='http://localhost:9090'
export INVOKEAI_AUTH_TOKEN='your-token'  # Optional
```

## Resources

- `scripts/generate.py` - Main generation script

© sammcj · Apache-2.0 · sammcj/agentic-coding

Similar skills

All skills for AI and ML →

From the same set73

The whole set →
demo-recorder demo-recorder drives headless Chromium to record scripted 3K 60fps web app demos, generate narration via Cloney, and dub the final cut. CX Codex +1 ★ 173repo stars diagrams-as-code diagrams-as-code is a Claude Code skill that creates architecture and infrastructure diagrams with Python’s diagrams library. It turns code-defined schemes into image files. CX Codex +1 ★ 173repo stars liteparse liteparse extracts text and structure from PDF, DOCX, PPTX, XLSX and images to markdown locally, no cloud or LLM required. CX Codex +1 ★ 173repo stars analyse-design The analyse-design skill examines an app, website, or document’s code and screenshots to map its design system. Use it to audit UI consistency or guide new components. CX Codex +1 ★ 173repo stars qa-to-issues qa-to-issues runs an interactive QA session to turn reported bugs into durable GitHub issues. The agent asks quick clarifying questions, checks your codebase, and files tickets. CX Codex +1 ★ 173repo stars systematic-debugging systematic-debugging — a structured debugging skill for stubborn bugs that survived several fixes. It traces symptoms to root causes before proposing code changes. CX Codex +1 ★ 173repo stars personal-genomics personal-genomics runs pharmacogenomics, disease-risk, carrier and trait checks on raw DNA files, entirely offline — one array export or several sources merged into a single report. CX Codex +1 ★ 173repo stars markedit-tools markedit-tools manages the MarkEdit markdown editor on macOS: installs updates, handles extensions, and edits settings via Claude Code. CX Codex +1 ★ 173repo stars

Project sponsors

Companies that keep this analytics open