Skip to content

About

OpenClaw image generation provider for Draw Things CLI - local AI image generation on Apple Silicon

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

OpenClaw Draw Things

Local AI image generation for OpenClaw using Draw Things CLI on Apple Silicon. Generate images with Stable Diffusion, FLUX, and other models without API costs.

Features

  • πŸ–ΌοΈ Local image generation - No API keys needed
  • 🎨 Image editing (img2img) - Transform existing images with AI
  • 🍎 Apple Silicon optimized - Uses Core ML for fast inference
  • πŸ€– Multiple models - SD, FLUX, and more
  • ⚑ OpenClaw integration - Native tool support

Prerequisites

  • macOS with Apple Silicon (M1/M2/M3/M4)
  • Draw Things CLI installed via Homebrew:
    brew tap drawthingsai/draw-things
    brew install draw-things-cli
  • (Optional) Draw Things App from Mac App Store β€” easier GUI for browsing and downloading models
  • OpenClaw 2026.4.0 or later
  • AI Models downloaded (see Models section below)

πŸ’‘ Note: Only the CLI is required. The Draw Things app is optional but provides a convenient GUI for browsing and downloading models.

Installation

From ClawHub (Recommended)

openclaw plugins install openclaw-draw-things --dangerously-force-unsafe-install

⚠️ Security Notice: This plugin executes shell commands to run the Draw Things CLI. OpenClaw's security scanner flags this as "dangerous code patterns". This is expected and necessary for the plugin to function β€” it uses child_process to spawn the draw-things-cli binary for local image generation. Use the --dangerously-force-unsafe-install flag to proceed with installation.

Manual Installation

git clone https://github.com/acwilan/openclaw-draw-things.git
cd openclaw-draw-things
npm install
npm run build
openclaw plugins install "$(pwd)"

Configuration

Add to your ~/.openclaw/openclaw.json:

{
  "plugins": {
    "entries": {
      "draw-things": {
        "enabled": true,
        "config": {
          "cliPath": "draw-things-cli",
          "outputDir": "~/Downloads/draw-things-output",
          "defaultModel": "realistic_vision_v5.1_f16.ckpt",
          "defaultSize": "1024x1024",
          "defaultEditStrength": 0.5,
          "defaultPromptMode": "auto",
          "defaultPromptAppend": "watercolor, soft brush strokes, cohesive painterly style",
          "defaultConfigJson": {
            "sampler": 12,
            "loras": [
              {
                "mode": "all",
                "file": "breath_of_the_wild_style_lora_f16.ckpt",
                "weight": 1
              }
            ]
          }
        }
      }
    }
  },
  "agents": {
    "defaults": {
      "imageGenerationModel": {
        "primary": "draw-things/realistic_vision_v5.1_f16.ckpt"
      }
    }
  }
}

Config Options

Option Type Default Description
cliPath string draw-things-cli Path to Draw Things CLI binary
modelsDir string - Optional override for models directory
outputDir string ~/Downloads/draw-things-output Where to save generated images
defaultModel string realistic_vision_v5.1_f16.ckpt Default model file
defaultSize string model-specific Default output size like 1024x1024; reduced to Draw Things-compatible multiples of 64 and takes precedence over aspect ratio/defaultWidth/defaultHeight when request size is omitted
defaultWidth number model-specific Legacy/default output width (reduced to multiple of 64)
defaultHeight number model-specific Legacy/default output height (reduced to multiple of 64)
defaultSteps number model-specific Override sampling steps
defaultCfg number model-specific Override CFG guidance scale
defaultEditStrength number 0.5 Img2img/edit strength from 0-1
defaultPromptMode string auto auto, natural, or tagged prompt handling
defaultPromptAppend string - Text appended to every generation/edit prompt before optimization; useful for fixed profiles like watercolor, cartoons, selfies, or charcoal
defaultConfigJson object - Draw Things JSGenerationConfiguration overrides forwarded through --config-json, including LoRAs, sampler, hires fix, upscaler, and other CLI-supported options
enablePromptOptimization boolean mode-dependent Enable/disable model-aware prompt conversion
highResSteps number 15 SD 1.5 high-resolution img2img upscale steps
timeoutMs number 300000 Per-generation CLI timeout in milliseconds

Models

The provider now uses a generated Draw Things CLI model catalog plus curated overrides for defaults like size, steps, CFG, prompt mode, and high-resolution behavior. Unknown model names still work via best-effort type inference, but adding curated overrides in src/model-metadata.ts gives more predictable behavior.

At runtime, the plugin checks draw-things-cli models list --downloaded-only and falls back to a downloaded model if the configured/requested model is not present locally.

Models are stored in:
~/Library/Containers/com.liuliu.draw-things/Data/Documents/Models/

Or specify a custom modelsDir in the plugin config.

Downloading Models via CLI

If you prefer not to use the Draw Things app, you can download models entirely via CLI:

# List currently downloaded models
draw-things-cli models list --downloaded-only

# List all available models for download
draw-things-cli models list

# Download a specific model
draw-things-cli models ensure --model <model-name>

πŸ’‘ Tip: If using a custom models directory, add --models-dir <path> to match your plugin config.

Recommended Models

Model Description
realistic_vision_v5.1_f16.ckpt Photorealistic images (recommended default)
flux_2_klein_4b_q6p.ckpt FLUX.2 Klein 4-bit quantized (fast, good quality)
flux_1_schnell_4b_q8p.ckpt FLUX.1 Schnell for fast generation
sd_xl_base_1.0_f16.ckpt Stable Diffusion XL

Via Draw Things App (optional GUI method):
Open Draw Things app β†’ Models β†’ Download Models

Usage

Once installed and configured, OpenClaw can generate images:

Generate an image of a sunset over mountains

Or use explicit tool calls:

Use image_generate to create a cartoon cat

Default Prompt Append

Use defaultPromptAppend to lock a Draw Things-backed agent into a consistent visual profile. The plugin appends this text to every generation/edit prompt before model-aware prompt optimization, so a user prompt like a portrait of a woman can become a portrait of a woman, watercolor, soft brush strokes, cohesive painterly style.

Example profiles:

{
  "defaultPromptAppend": "watercolor, soft brush strokes, cohesive painterly style"
}
{
  "defaultPromptAppend": "cartoon illustration, bold outlines, vibrant colors"
}

Draw Things Configuration Overrides and LoRAs

Use defaultConfigJson for Draw Things-native options that are not part of OpenClaw's shared image-generation contract. The object is serialized and passed to draw-things-cli generate --config-json for both initial generation and high-resolution generation passes.

{
  "defaultConfigJson": {
    "sampler": 12,
    "hiresFix": false,
    "loras": [
      {
        "mode": "all",
        "file": "breath_of_the_wild_style_lora_f16.ckpt",
        "weight": 1
      }
    ]
  }
}

The CLI applies these values before the plugin's explicit model, dimensions, steps, CFG, and edit-strength arguments, so the shared OpenClaw request controls continue to win for overlapping settings.

OpenClaw's current image_generate request only defines provider-specific options for OpenAI. This means Draw Things overrides are persistent plugin configuration, not per-call tool parameters; supporting dynamic per-request LoRA selection requires an upstream extension of the image-generation contract.

Image Editing (img2img)

Transform existing images using AI:

Turn this photo into a watercolor painting [attach image]

Or explicitly:

Edit this image to look like a comic book style

The plugin supports:

  • One input image per edit request
  • Configurable strength via defaultEditStrength (how much the image changes)
  • Style transformations - watercolor, oil painting, cartoon, etc.
  • Detail enhancement - improve or modify specific aspects

Tips for best results:

  • Use clear style descriptions (e.g., "oil painting", "anime style", "sketch")
  • For subtle changes, the strength is moderate (0.5)
  • Works with any supported model

Troubleshooting

Provider does not show as configured

The plugin reports configured only when it can find draw-things-cli, the output path is plausible, and draw-things-cli models list --downloaded-only returns at least one local model.

"No image-generation provider registered"

Make sure the imageGenerationModel.primary is set correctly:

"imageGenerationModel": {
  "primary": "draw-things/your-model.ckpt"
}

"Model not found"

  • Verify the model file exists in Draw Things
  • Check the exact filename in the Models directory
  • Ensure modelsDir config matches your setup if using custom location

"draw-things-cli command not found"

Install the CLI via Homebrew:

brew tap drawthingsai/draw-things
brew install draw-things-cli

Plugin not loading

Check the plugin is enabled:

openclaw plugins list

If needed, restart the gateway:

openclaw gateway restart

Development

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

# Run tests
npm test

Releasing

# Patch version (1.0.0 β†’ 1.0.1)
npm run release:patch

# Minor version (1.0.0 β†’ 1.1.0)
npm run release:minor

# Major version (1.0.0 β†’ 2.0.0)
npm run release:major

This handles version bump, manifest sync, changelog, commit, tag, and push automatically.

License

MIT Β© Andres Rovira

Links

About

OpenClaw image generation provider for Draw Things CLI - local AI image generation on Apple Silicon

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages