ImageGen
Generate images locally on your system using NVIDIA GPU with FLUX.2-klein-4B model via Diffusers. Zero external API calls.
Choose how to use this skill
You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.
1. Native installer
This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.
Do not guess an installer command or replace an existing version without reviewing the diff.
2. Complete package recommended
Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.
No complete ProSkills package is published for this listing yet.3. Prompt-only
Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.
Need only the instruction file?
Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.
No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.
// RATINGS
Not yet listed on ClawHub or SkillsMP
// README
imagegen
imagegen is a local image-generation skill that leverages an NVIDIA GPU in your system for OpenClaw.
It uses:
- an NVIDIA GPU with CUDA available through PyTorch
- a local Python runtime
- Hugging Face
diffusers - the
black-forest-labs/FLUX.2-klein-4Bmodel
The generated image must be written under:
$HOME/.openclaw/media/outbound/
for the Agent to be able to handle the images and embed them elsewhere.
Files
SKILL.md: skill instructions and usage rulesrun_image_model.sh: shell wrapper used by the skillrun_image_model.py: Python entrypoint that loads the model and saves the image
Requirements
Before using this skill, make sure the host has:
- Python 3.10+
bash- an NVIDIA GPU
- working CUDA support in PyTorch
- internet access on first run to download model weights from Hugging Face
Python packages required by this skill:
torchdiffuserstransformersacceleratesafetensorshuggingface_hubsentencepiecePillow
Preferred Install: .venv
This is the recommended setup.
It matches the current wrapper, which expects a Python runtime in:
$HOME/.venv/bin/python
1. Create the virtual environment
python3 -m venv "$HOME/.venv"
2. Activate it
source "$HOME/.venv/bin/activate"
3. Upgrade packaging tools
python -m pip install --upgrade pip setuptools wheel
4. Install PyTorch with CUDA support
Install the CUDA-enabled PyTorch build appropriate for the machine. Example:
pip install torch --index-url https://download.pytorch.org/whl/cu124
If the host uses a different CUDA build, use the matching PyTorch install command instead.
5. Install the remaining dependencies
pip install diffusers transformers accelerate safetensors huggingface_hub sentencepiece Pillow
6. Verify the environment
"$HOME/.venv/bin/python" -c "import torch; import diffusers; print(torch.cuda.is_available())"
If this prints True, the runtime is ready.
Alternative Install: local Python, no virtual environment
This option installs packages into the local Python environment instead of a dedicated .venv.
Important note
The current run_image_model.sh script is configured to use:
$HOME/.venv/bin/python
If you install dependencies without a virtual environment, you must also update run_image_model.sh so VENV_PYTHON points to your local Python, for example:
VENV_PYTHON="/usr/bin/python3"
1. Upgrade packaging tools
python3 -m pip install --upgrade pip setuptools wheel
2. Install PyTorch with CUDA support
Example:
python3 -m pip install torch --index-url https://download.pytorch.org/whl/cu124
Use the correct CUDA build for the host if it differs.
3. Install the remaining dependencies
python3 -m pip install diffusers transformers accelerate safetensors huggingface_hub sentencepiece Pillow
4. Verify the environment
python3 -c "import torch; import diffusers; print(torch.cuda.is_available())"
Example usage
$HOME/.openclaw/workspace-pixy/skills/imagegen/run_image_model.sh \
flux2-klein-4b \
"A sunset over the ocean" \
$HOME/.openclaw/media/outbound/flux2-sunset.png \
1024 \
768 \
4 \
42
Notes
- The first generation may take longer because model weights may need to be downloaded.
- The wrapper creates and uses cache directories under
$HOME/.cache/. - The skill currently supports one model only:
flux2-klein-4bbut it can easily modify to leverage other models. Just ask your Agent.
// HOW IT'S BUILT
KEY FILES