vllm
БесплатноБез исполняемых скриптовНе проверенvLLM is a high-throughput inference and serving engine for large language models that exposes an OpenAI-compatible HTTP API and a Python batch API. Use this…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
vLLM
Overview
vLLM serves LLMs with paged KV-cache memory (PagedAttention), continuous batching, prefix caching, chunked prefill, quantization and tensor/pipeline/data parallelism. vllm serve starts an OpenAI-compatible server (/v1/chat/completions, /v1/completions, /v1/embeddings, plus tokenization, health and Prometheus /metrics endpoints); the LLM class runs offline batch inference in Python. The engine is the V1 engine; older flags and environment variables from 2024-era guides may no longer exist, so check vllm serve --help for the installed version (0.30 at the time of writing).
Instructions
Install
uv venv --python 3.12 && source .venv/bin/activate
uv pip install vllm --torch-backend=auto # picks the PyTorch/CUDA build for your driver
# plain pip alternative: pip install vllm
Use a fresh environment: the wheel pins its own PyTorch and CUDA kernels, and mixing in an existing PyTorch usually breaks. Blackwell GPUs need CUDA 12.8 or newer. Gated models (Llama, Gemma) need export HF_TOKEN=... and accepted licence terms on Hugging Face.
Serve a model
vllm serve Qwen/Qwen3-8B \
--max-model-len 8192 \
--gpu-memory-utilization 0.90 \
--api-key "$VLLM_API_KEY"
The model is a positional argument (--model also still works). Useful flags:
--tensor-parallel-size 4splits one model over 4 GPUs on one machine;--pipeline-parallel-sizespans nodes;--data-parallel-sizeruns replicas.--max-model-lencaps context length; lowering it is the first fix for out-of-memory at start-up because the KV cache is sized from it.--max-num-seqscaps concurrent sequences;--gpu-memory-utilizationis the fraction of each GPU vLLM may use (default about 0.9).--served-model-name chat-prodsets the name clients must send asmodel.--quantizationis normally unnecessary: pre-quantized checkpoints (for exampleQwen/Qwen2.5-7B-Instruct-AWQ, GPTQ, FP8) are detected from their config. Passingawqfor a non-AWQ model fails. Quantization needs a checkpoint that is already quantized (or an FP8 option vLLM applies on load); it does not quantize an arbitrary model for you.--enable-auto-tool-choice --tool-call-parser hermesturns on tool calling (pick the parser that matches the model family);--reasoning-parseris for reasoning models.- Prefix caching is on by default in V1 for models that support it;
--enable-prefix-caching/--no-enable-prefix-cachingoverride. VLLM_API_KEYin the environment is equivalent to--api-key.
Docker
docker run --runtime nvidia --gpus all --ipc=host \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=$HF_TOKEN" \
-p 127.0.0.1:8000:8000 \
vllm/vllm-openai:latest \
--model Qwen/Qwen3-8B --max-model-len 8192
Arguments after the image name are the same as for vllm serve. --ipc=host (or a large --shm-size) is required for multi-GPU. Pin a version tag such as vllm/vllm-openai:v0.11.0 instead of latest in production.
Call it with the OpenAI SDK
import os
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key=os.environ["VLLM_API_KEY"])
resp = client.chat.completions.create(
model="Qwen/Qwen3-8B",
messages=[{"role": "user", "content": "Write a Python function that returns the nth Fibonacci number."}],
temperature=0.7,
max_tokens=512,
)
print(resp.choices[0].message.content)
stream=True works as with OpenAI. List what the server exposes with curl -H "Authorization: Bearer $VLLM_API_KEY" localhost:8000/v1/models.
Embeddings
Serve an embedding model on its own server; a pooling model such as BAAI/bge-large-en-v1.5 is detected automatically (--runner pooling forces it):
vllm serve BAAI/bge-large-en-v1.5 --port 8001
emb = OpenAI(base_url="http://localhost:8001/v1", api_key="unused").embeddings.create(
model="BAAI/bge-large-en-v1.5", input=["How do I reset my password?"])
print(len(emb.data[0].embedding)) # 1024
(If the server was started with --api-key, send that key instead of "unused".)
Offline batch inference
from vllm import LLM, SamplingParams
llm = LLM(model="Qwen/Qwen3-8B", max_model_len=8192, gpu_memory_utilization=0.90)
params = SamplingParams(temperature=0.7, top_p=0.9, max_tokens=256)
outputs = llm.generate(["Summarize PagedAttention in two sentences.",
"Write a haiku about GPUs."], params)
for o in outputs:
print(o.prompt, "->", o.outputs[0].text.strip())
# chat-formatted input applies the model's chat template for you
chat = llm.chat([{"role": "user", "content": "What is continuous batching?"}], params)
print(chat[0].outputs[0].text)
Examples
Example 1: Serve a 70B model on four GPUs
Request: "Host Llama 3.3 70B on our 4xA100 box so the team can use the OpenAI SDK."
export HF_TOKEN=... # from your Hugging Face account, licence accepted
vllm ser
Установить vllm в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл vllm?
vLLM is a high-throughput inference and serving engine for large language models that exposes an OpenAI-compatible HTTP API and a Python batch API. Use this skill when asked to serve an open-weight model (Llama, Qwen, Mistral, Gemma, Phi) on NVIDIA GPUs, run `vllm serve`, split a model across GPUs with tensor parallelism, serve quantized checkpoints, run it in Docker, or call it with the OpenAI SDK.
Как установить скилл vllm?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл vllm запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic