Stable Diffusion logo

Stable Diffusion

Community
AlexAI-MCP
stable-diffusion

Run Stable Diffusion locally with diffusers — text-to-image, img2img, inpainting, ControlNet, and SDXL.

Overview

PublisherAlexAI-MCP
Repositoryhermes-CCC
Skill namestable-diffusion
Stars
134
Forks
22
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by AlexAI-MCP on GitHub. Read the source before you install it.

Installation

Install the Stable Diffusion AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/stable-diffusion
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AlexAI-MCP/hermes-CCC.git /tmp/hermes-CCC
mkdir -p .claude/skills
cp -r /tmp/hermes-CCC/skills/stable-diffusion .claude/skills/stable-diffusion
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Stable Diffusion in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Stable Diffusion on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Stable Diffusion is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Stable Diffusion

Purpose

  • Use this skill to generate or edit images locally with Hugging Face diffusers.
  • Prefer it for text-to-image, img2img, inpainting, and model composition workflows.
  • This skill covers both classic Stable Diffusion models and SDXL.
  • It is useful for scripted generation, reproducible experiments, and GPU-backed image pipelines.

Install

bash
pip install diffusers transformers accelerate torch
  • You typically also need a compatible CUDA-enabled PyTorch build for GPU inference.
  • Confirm the install in Python before pulling large checkpoints.

Core Libraries

  • diffusers for pipeline abstractions
  • transformers for text encoders and related model components
  • accelerate for efficient device loading and memory movement
  • torch for runtime execution

Text-to-Image With SD 1.5

  • Classic Stable Diffusion 1.5 uses StableDiffusionPipeline.
python
import torch
from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained(
    "runwayml/stable-diffusion-v1-5",
    torch_dtype=torch.float16,
)
pipe = pipe.to("cuda")

image = pipe(
    prompt="a cinematic photo of a mountain observatory at sunrise",
    negative_prompt="blurry, low quality, distorted",
    num_inference_steps=30,
    guidance_scale=7.5,
).images[0]

image.save("output.png")

SDXL

  • SDXL typically uses StableDiffusionXLPipeline.
python
import torch
from diffusers import StableDiffusionXLPipeline

pipe = StableDiffusionXLPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    torch_dtype=torch.float16,
)
pipe = pipe.to("cuda")

image = pipe(
    prompt="a highly detailed editorial photo of a futuristic library interior",
    negative_prompt="low resolution, deformed, extra limbs",
    num_inference_steps=35,
    guidance_scale=6.5,
).images[0]

image.save("sdxl-output.png")
  • SDXL generally produces stronger prompt fidelity and image quality than SD 1.5, but it also requires more VRAM.

Key Parameters

  • prompt: the main text instruction
  • negative_prompt: what to suppress
  • num_inference_steps: denoising step count
  • guidance_scale: classifier-free guidance strength
  • seed: random seed for reproducibility

Seeded Generation

  • Use a seed when you need repeatable outputs:
python
import torch
from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained(
    "runwayml/stable-diffusion-v1-5",
    torch_dtype=torch.float16,
).to("cuda")

generator = torch.Generator(device="cuda").manual_seed(42)

image = pipe(
    prompt="a clean product photo of a ceramic mug on a wood table",
    negative_prompt="blurry, noisy, warped",
    num_inference_steps=28,
    guidance_scale=7.0,
    generator=generator,
).images[0]

image.save("seeded-output.png")
  • The same seed and settings help with debugging prompt and LoRA changes.

Save Output

  • Save the generated image with PIL:
python
image.save("output.png")
  • Always save prompt metadata separately if you need auditability or experiment tracking.

Img2Img

  • Use StableDiffusionImg2ImgPipeline to transform an existing image while preserving composition.
python
import torch
from diffusers import StableDiffusionImg2ImgPipeline
from PIL import Image

pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
    "runwayml/stable-diffusion-v1-5",
    torch_dtype=torch.float16,
).to("cuda")

init_image = Image.open("input.png").convert("RGB").resize((768, 768))

image = pipe(
    prompt="turn this concept sketch into a polished sci-fi matte painting",
    negative_prompt="blurry, low contrast, artifacts",
    image=init_image,
    strength=0.65,
    num_inference_steps=30,
    guidance_scale=7.5,
).images[0]

image.save("img2img-output.png")
  • Lower strength preserves more of the input image.
  • Higher strength pushes the result further away from the source.

Inpainting

  • Use StableDiffusionInpaintPipeline to replace or repair masked regions.
python
import torch
from diffusers import StableDiffusionInpaintPipeline
from PIL import Image

pipe = StableDiffusionInpaintPipeline.from_pretrained(
    "runwayml/stable-diffusion-inpainting",
    torch_dtype=torch.float16,
).to("cuda")

image = Image.open("scene.png").convert("RGB").resize((512, 512))
mask = Image.open("mask.png").convert("RGB").resize((512, 512))

result = pipe(
    prompt="replace the missing area with a wooden chair",
    negative_prompt="blurry, malformed, duplicate objects",
    image=image,
    mask_image=mask,
    num_inference_steps=30,
    guidance_scale=7.5,
).images[0]

result.save("inpaint-output.png")
  • White mask regions are typically where edits are applied.
  • Good masks matter as much as prompts for reliable inpainting.

ControlNet

  • ControlNet is useful when you want stronger control over pose, depth, edges, or composition.
  • Typical uses include pose-guided character generation, depth-aware edits, and line-art conditioning.
  • Pair ControlNet with SD 1.5 or SDXL depending on the model combination you are using.

Memory Optimization

  • Reduce memory pressure with built-in helpers:
python
pipe.enable_model_cpu_offload()
pipe.enable_attention_slicing()
  • pipe.enable_model_cpu_offload() is often helpful on constrained GPUs.
  • pipe.enable_attention_slicing() can reduce peak memory at some performance cost.
  • These settings are practical for laptops and single-GPU consumer machines.

LoRA Loading

  • Load LoRA adapters to specialize style, subject, or composition behavior:
python
pipe.load_lora_weights("./lora.safetensors")
  • Keep the base model and LoRA pairing compatible.
  • Track LoRA names, weights, and prompts in experiment logs.

Negative Prompts

  • Common negative prompts include:

  • blurry

  • low quality

  • worst quality

  • deformed

  • extra limbs

  • bad anatomy

  • artifact

  • text

  • watermark

  • Use concise negative prompts first.

  • Overly long negative prompts can produce unstable or muddled outputs.

Prompting Guidance

  • Be concrete about subject, style, lighting, framing, and medium.
  • Use short prompt iterations during tuning rather than changing many variables at once.
  • Record prompt, negative prompt, seed, and model version together.

SDXL vs SD 1.5

  • Use SDXL when:

  • prompt fidelity matters

  • you need stronger detail and composition

  • you have enough VRAM

  • Use SD 1.5 when:

  • you need a lighter model

  • you rely on mature community tooling

  • you need broad LoRA and ControlNet ecosystem support

Common Workflows

  • Text-to-image concept generation
  • Product mockups and ideation
  • Img2img refinement from sketches
  • Inpainting object replacement
  • Style transfer through LoRAs

ComfyUI Alternative

  • diffusers is strong for code-driven workflows.
  • ComfyUI is a strong GUI alternative when you want node-based visual workflows.
  • Use ComfyUI for rapid experimentation, complex graph composition, or collaborative prompt workflows.

Practical GPU Guidance

  • SD 1.5 is easier on smaller GPUs.
  • SDXL generally needs more VRAM and benefits from float16.
  • CPU generation is possible, but it is much slower and rarely ideal for interactive use.

Common Failure Modes

  • Out-of-memory:

  • enable CPU offload

  • enable attention slicing

  • reduce image size

  • use SD 1.5 instead of SDXL

  • Muddy or low-quality images:

  • increase num_inference_steps

  • refine the prompt

  • simplify the negative prompt

  • verify you are using the intended model

  • Unreliable edits in img2img:

  • lower or raise strength depending on whether the source is being ignored or over-preserved

  • use clearer prompts

  • start from a cleaner input image

  • Inpainting artifacts:

  • improve the mask

  • widen the masked area slightly

  • use a prompt that matches the surrounding scene

Recommended Workflow

  • Start with a baseline text-to-image run.
  • Lock a seed when comparing prompt or LoRA changes.
  • Move to img2img or inpainting only after the base model behavior looks correct.
  • Add memory optimizations before assuming you need larger hardware.

When To Use This Skill

  • You need local image generation from Python.
  • You want reproducible scripted generation for experiments or pipelines.
  • You need SDXL, img2img, inpainting, or LoRA-based customization.
  • You prefer code-first workflows over GUI-only tools.

Quick Reference

  • Install: pip install diffusers transformers accelerate torch
  • SDXL pipeline: StableDiffusionXLPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
  • SD 1.5 pipeline: StableDiffusionPipeline
  • Save image: image.save("output.png")
  • Img2img: StableDiffusionImg2ImgPipeline
  • Inpainting: StableDiffusionInpaintPipeline
  • Memory helpers: pipe.enable_model_cpu_offload() and pipe.enable_attention_slicing()
  • LoRA: pipe.load_lora_weights("./lora.safetensors")

Frequently asked questions

What does the Stable Diffusion AI skill do?

Run Stable Diffusion locally with diffusers — text-to-image, img2img, inpainting, ControlNet, and SDXL.

Why use Stable Diffusion on TypingMind?

Because you install it once and use it with any model. Stable Diffusion is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Stable Diffusion in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/stable-diffusion. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Stable Diffusion?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Stable Diffusion?

As many as you like. As long as a model supports skills, you can use Stable Diffusion with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Stable Diffusion AI skill free?

Yes. It is published on GitHub by AlexAI-MCP under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇