Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

sglang

БесплатноБез исполняемых скриптовНе проверен

SGLang is a high-throughput serving engine that runs open-weight language, vision-language and embedding models on your own GPU behind an OpenAI-compatible…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

SGLang — serve open-weight models on your own GPU

Overview

SGLang loads a model from the Hugging Face Hub (or a local folder) and exposes it as an HTTP server with OpenAI-compatible endpoints: /v1/chat/completions, /v1/completions, /v1/embeddings and /v1/models. It is built for throughput under many concurrent requests (prefix caching, continuous batching, tensor and data parallelism, quantized weights and KV cache) and for agent workloads that need tool calls, reasoning output and schema-constrained JSON.

It is a serving engine, not a model: you choose the weights. It needs an accelerator. This skill covers NVIDIA GPUs on Linux; for AMD, TPU, Intel or Apple Silicon follow the hardware guides at https://docs.sglang.io/docs/hardware-platforms/overview.md. Neighbouring skills: vllm is the closest alternative (same job, different engine), llama-cpp and ollama suit CPUs and small GPUs.

Instructions

Install

With uv, in a fresh environment (Python 3.11 or newer):

uv venv --python 3.12
source .venv/bin/activate
uv pip install --prerelease=allow sglang
python -m sglang.launch_server --help

Or use the official image, which already contains Python, SGLang and CUDA 13 libraries. It needs Docker and the NVIDIA Container Toolkit:

docker pull lmsysorg/sglang:latest

latest is the newest stable release; for reproducible deployments pin a release tag from https://hub.docker.com/r/lmsysorg/sglang/tags. Images for CUDA 12 are no longer published (v0.5.19-cu129 is the last).

Start a server

The current entry point is sglang serve. The older python -m sglang.launch_server --model-path ... still works and takes the same arguments.

sglang serve Qwen/Qwen3-0.6B --host 127.0.0.1 --port 30000

Wait for the log line The server is fired up and ready to roll!. The first start downloads the weights, so it can take minutes. Defaults: host 127.0.0.1, port 30000.

In Docker, bind the published port to loopback on the host, and let the process listen on all container interfaces:

docker run --rm --gpus all --ipc=host --shm-size 32g \
  -p 127.0.0.1:30000:30000 \
  -v "$HOME/.cache/huggingface:/root/.cache/huggingface" \
  lmsysorg/sglang:latest \
  sglang serve Qwen/Qwen3-0.6B --host 0.0.0.0 --port 30000

For gated models, export HF_TOKEN (created at https://huggingface.co/settings/tokens) and add --env HF_TOKEN before the image name.

Check health and call it

curl -s http://127.0.0.1:30000/health            # 200 when the server is up
curl -s http://127.0.0.1:30000/v1/models         # lists the served model name
curl -s http://127.0.0.1:30000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "Qwen/Qwen3-0.6B",
       "messages": [{"role": "user", "content": "What is the capital of France?"}],
       "max_tokens": 128}'

/health_generate generates one token, a stricter probe. The answer is in choices[0].message.content. With the OpenAI Python SDK (uv pip install openai):

from openai import OpenAI

client = OpenAI(base_url="http://127.0.0.1:30000/v1", api_key="EMPTY")
stream = client.chat.completions.create(
    model="Qwen/Qwen3-0.6B",
    messages=[{"role": "user", "content": "Explain prefix caching in two sentences."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices:
        print(chunk.choices[0].delta.content or "", end="", flush=True)

Key server arguments

These are from the server-arguments reference (https://docs.sglang.io/docs/advanced_features/server_arguments.md); python -m sglang.launch_server --help prints the full current list.

Argument Purpose
--model-path (or --model, or the first positional) Hub ID or local folder
--host, --port Bind address (default 127.0.0.1:30000)
--api-key Require this bearer key on the OpenAI endpoints
--served-model-name Name returned by /v1/models and expected in requests
--tp / --tp-size Tensor parallelism: split one model over N GPUs
--dp / --dp-size Data parallelism: N replicas for throughput
--mem-fraction-static GPU fraction for weights plus KV cache; lower it (for example 0.7) on out-of-memory
--context-length Override the model's maximum context
--chunked-prefill-size Smaller value (for example 4096) fixes OOM on long prompts
--quantization fp8 Quantize an fp16 checkpoint to fp8 on load
--kv-cache-dtype fp8_e4m3 Smaller KV cache
--max-running-requests Cap concurrent requests
--tool-call-parser, --reasoning-parser Enable tool calls and reasoning separation (below)
--grammar-backend xgrammar (default), outlines, llguidance for constrained output
--is-embedding Serve a decoder-style model as an embedding model
--trust-remote-code Allow custom modelling code from the Hub (see Guidelines)
--enable-metrics Expose Prometheus metrics
`--co
Полный SKILL.md на GitHub

Установить sglang в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл sglang?

SGLang is a high-throughput serving engine that runs open-weight language, vision-language and embedding models on your own GPU behind an OpenAI-compatible HTTP API. Use this skill when asked to serve a Hugging Face model with SGLang, run `sglang serve` or `python -m sglang.launch_server`, split a model across GPUs with tensor parallelism, tune GPU memory, enable tool calling, reasoning parsing or JSON-schema constrained output, or call a self-hosted model with the OpenAI SDK.

Как установить скилл sglang?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл sglang запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить sglang с