360 Secure SkillHub
360 安全技能中心

SGLang-Diffusion Image Generation

该技能通过 Python 脚本调用本地 SGLang-Diffusion 服务器的兼容接口,按提示词生成图片,支持负向提示词、尺寸、步数、引导系数、种子、服务器地址与可选 API Key;默认将时间戳命名的 PNG 存到 /tmp/,并打印媒体行供宿主附加,运行前需已有服务端。

jiangyukunok
jiangyukunok
热度 71.63
最近更新 2026-05-11 17:29:59
分类:创作依赖:代码执行 / 第三方 API / 读写文件应用场景:图像生成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add sglang-diffusion
Metadata
name
sglang-diffusion
description
Generate images using a local SGLang-Diffusion server (FLUX, Stable Diffusion, Qwen-Image, etc.). Use when: user asks to generate, create, draw, or render an image with a locally running SGLang-Diffusion instance. NOT for: cloud-hosted image APIs (use openai-image-gen or nano-banana-pro instead). Requires a running SGLang-Diffusion server.
homepage
https://github.com/sgl-project/sglang
metadata
{"openclaw":{"emoji":"🎨","requires":{"bins":["python3"]}}}

SGLang-Diffusion Image Generation

Generate images via a local SGLang-Diffusion server's OpenAI-compatible API.

Prerequisites

  • SGLang-Diffusion server running (default: http://127.0.0.1:30000)
  • If the server was started with --api-key, set SGLANG_DIFFUSION_API_KEY env var

Generate an image

python3 {baseDir}/scripts/generate.py --prompt "a futuristic cityscape at sunset"

Useful flags

python3 {baseDir}/scripts/generate.py --prompt "portrait of a cat" --size 512x512
python3 {baseDir}/scripts/generate.py --prompt "abstract art" --negative-prompt "blurry, low quality"
python3 {baseDir}/scripts/generate.py --prompt "landscape" --steps 30 --guidance-scale 7.5 --seed 42
python3 {baseDir}/scripts/generate.py --prompt "photo" --server http://192.168.1.100:30000 --out ./my-image.png

API key (optional)

Only needed if the SGLang-Diffusion server was started with --api-key. Set SGLANG_DIFFUSION_API_KEY, or pass --api-key directly:

python3 {baseDir}/scripts/generate.py --prompt "hello" --api-key sk-my-key

Or configure in ~/.openclaw/openclaw.json:

{
 skills: {
   "sglang-diffusion": {
     env: { SGLANG_DIFFUSION_API_KEY: "sk-my-key" },
   },
 },
}

Notes

  • The script prints a MEDIA: line for OpenClaw to auto-attach on supported chat providers.
  • Output defaults to timestamped PNG in /tmp/.
  • Do not read the image back; report the saved path only.