sglang-diffusion-add-model

sglang-diffusion-add-model is a skill for Claude Code from sgl-project/sglang. It costs 24 tokens per session (9,285 once invoked), scanned A, original, Apache-2.0.

A development guide for adding a new image-generation model or pipeline to SGLang Diffusion. Diffusion models create images through repeated denoising steps, and a pipeline is the code that connects preparation, denoising, and decoding.

In plain words
What is it for?
Use it to add model preprocessing, connect standard denoising and decoding stages, and choose an appropriate pipeline structure.
Why use it?
It gives new model integrations a consistent structure and keeps model-specific preparation separate from shared processing stages. This makes the integration easier to maintain and compare with reference implementations.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it to add model preprocessing, connect standard denoising and decoding stages, and choose an appropriate pipeline structure.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sgl-project/sglang/sglang-diffusion-add-model
About the project

SGLang is a framework for running inference for large language models and multimodal models, meaning it processes inputs to produce model outputs such as text or other media. It is used to serve and accelerate open AI models and related workloads.

sgl-project/sglang · 35,615 stars · on GitHub · sglang.io

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add sgl-project/sglang --skill sglang-diffusion-add-model
Clone the repo
git clone --depth 1 https://github.com/sgl-project/sglang

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sglang-diffusion-add-model

README.md
[![agentmods](https://agentmods.dev/badge/skills/sgl-project/sglang/sglang-diffusion-add-model/github.svg)](https://agentmods.dev/skills/sgl-project/sglang/sglang-diffusion-add-model)
Your own site
<a href="https://agentmods.dev/skills/sgl-project/sglang/sglang-diffusion-add-model"><img src="https://agentmods.dev/badge/skills/sgl-project/sglang/sglang-diffusion-add-model/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sglang-diffusion-add-model

Your own site · 80×15
<a href="https://agentmods.dev/skills/sgl-project/sglang/sglang-diffusion-add-model"><img src="https://agentmods.dev/badge/skills/sgl-project/sglang/sglang-diffusion-add-model.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 9,285 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Snyk pass 7 Sept 2026
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high System Prompt Leakage · line 404
    Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
    Fix: Remove any instructions that reveal, print, or output system prompts or internal rules. System instructions should never be exposed to end users.
  • medium System Prompt Leakage · line 429
    Skill contains patterns that could indirectly extract system prompts through rephrasing, translation, summarization, or side-channel techniques.
    Fix: Guard against indirect extraction by refusing to summarize, translate, or rephrase system instructions. Add explicit anti-extraction clauses.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00024 $0.09285
Opus 5 $0.00012 $0.04643
Sonnet 5 $0.00005 $0.01857
Haiku 4.5 $0.00002 $0.00928

Measured 7d ago against content hash 4ad59a61ba03, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

sglang-diffusion-add-model scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

python/sglang/multimodal_gen/.claude/skills/sglang-diffusion-add-model/SKILL.md · 780 lines

How it starts

The opening of the file, as written. The whole thing — 780 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Add a Diffusion Model to SGLang

Use this skill when adding a new diffusion model or pipeline variant to sglang.multimodal_gen.

Three Pipeline Styles

Style A: Hybrid Monolithic Pipeline (Recommended)

The recommended default for most new models. Uses a three-stage structure:

BeforeDenoisingStage (model-specific)  -->  DenoisingStage (standard)  -->  DecodingStage (standard)
  • BeforeDenoisingStage: A single, model-specific stage that consolidates all pre-processing logic: input validation, text encoding, image encoding, latent preparation, timestep setup. This stage is unique per model.
  • DenoisingStage: Framework-standard stage for the denoising loop (DiT/UNet forward passes). Shared across models.
  • DecodingStage: Framework-standard stage for VAE decoding. Shared across models.

Why recommended? Modern diffusion models have highly heterogeneous pre-processing requirements (different text encoders, different latent formats, different conditioning mechanisms). The Hybrid approach keeps pre-processing isolated per model, avoids fragile shared stages with excessive conditional logic, and lets developers port Diffusers reference code quickly.

Style B: Modular Composition Style

Uses the framework's fine-grained standard stages (TextEncodingStage, LatentPreparationStage, TimestepPreparationStage, etc.) to build the pipeline by composition.

This style is appropriate when:

  • The new model's pre-processing can largely reuse existing stages — e.g., a model that uses standard CLIP/T5 text encoding + standard latent preparation with minimal customization. In this case, add_standard_t2i_stages() or add_standard_ti2i_stages() may be all you need.
  • A model-specific optimization needs to be extracted as a standalone stage — e.g., a specialized encoding or conditioning step that benefits from being a separate stage for profiling, parallelism control, or reuse across multiple pipeline variants.

See existing Modular examples: QwenImagePipeline (uses add_standard_t2i_stages), FluxPipeline, WanPipeline, SanaPipeline, StableDiffusion3Pipeline, and ZImagePipeline.

Read the full file on GitHub · 780 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago Changed · +2 lines 4ad59a61ba03
  2. 9d ago First seen · 778 lines · 24 tokens per session scan A 4269fb556560

Subscribe to this mod's changes

sglang-diffusion-add-model is a skill published in the GitHub repository sgl-project/sglang (35,615 stars, last pushed today), licensed Apache-2.0. It adds 24 tokens to every session and 9,285 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories