From vllm
Complete vLLM v0.19.0 API reference for high-throughput LLM inference: batch generation, chat, structured outputs, LoRA, multimodal inputs, OpenAI-compatible serving.
How this skill is triggered — by the user, by Claude, or both
Slash command
/vllm:vllmThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Comprehensive reference for vLLM -- a high-throughput, memory-efficient inference engine for large language models.
Comprehensive reference for vLLM -- a high-throughput, memory-efficient inference engine for large language models.
vLLM provides two main interfaces:
LLM class -- batch processing with automatic memory managementvllm serve -- OpenAI-compatible REST API with streamingKey capabilities:
from vllm import LLM, SamplingParams
llm = LLM(model="meta-llama/Llama-3.1-8B-Instruct")
params = SamplingParams(temperature=0.8, max_tokens=256)
# Text completion (no chat template)
outputs = llm.generate(["The future of AI is"], params)
print(outputs[0].outputs[0].text)
# Chat completion (applies chat template)
outputs = llm.chat(
[{"role": "user", "content": "What is vLLM?"}],
sampling_params=params,
)
print(outputs[0].outputs[0].text)
vllm serve for production deploymentThe main offline inference API. Created with a model name/path, automatically manages GPU memory and batching.
from vllm import LLM
llm = LLM(model="meta-llama/Llama-3.1-8B-Instruct")
Controls generation behavior: temperature, top-p, max tokens, stop sequences, structured outputs, etc.
from vllm import SamplingParams
params = SamplingParams(temperature=0.7, max_tokens=256, top_p=0.95)
Critical distinction:
generate() takes raw text prompts. Does NOT apply chat templates.chat() takes message lists (role/content dicts). Applies the model's chat template automatically.Use chat() for conversational interactions. Use generate() for raw text completion.
vLLM reads generation_config.json from HuggingFace models by default, which may override SamplingParams defaults. To disable: pass generation_config="vllm" to LLM() or --generation-config vllm to vllm serve.
Imported separately. Constrains output to JSON schema, regex, choice list, or grammar.
from vllm.sampling_params import StructuredOutputsParams
params = SamplingParams(
structured_outputs=StructuredOutputsParams(
json={"type": "object", "properties": {"name": {"type": "string"}}}
)
)
| Method | Returns | Key Field |
|---|---|---|
generate() / chat() | list[RequestOutput] | .outputs[0].text |
embed() | list[EmbeddingRequestOutput] | .outputs.embedding |
classify() | list[ClassificationRequestOutput] | .outputs.probs |
score() | list[ScoringRequestOutput] | .outputs.score |
| File | Content | Lines |
|---|---|---|
| references/api-llm.md | LLM class constructor, all public methods, PromptType variants | ~380 |
| references/api-sampling.md | SamplingParams, StructuredOutputsParams, BeamSearchParams, all output types, PoolingParams | ~330 |
| references/api-server.md | vllm serve CLI flags, REST endpoints, OpenAI client usage, auth, tools, structured outputs | ~370 |
| references/api-lora.md | LoRARequest class, offline/server LoRA usage, multi-LoRA, limitations | ~190 |
| references/api-multimodal.md | Image/audio/video inputs, offline and server API, model-specific formats | ~250 |
| references/workflows.md | Complete working examples for all major use cases | ~420 |
generate() does not apply chat templates. Use chat() for conversations. Using generate() with a chat model without the template will produce poor results.
generation_config.json changes defaults. HuggingFace models ship with generation_config.json that vLLM reads by default. This can change temperature, max_tokens, and other defaults. Pass generation_config="vllm" to disable.
StructuredOutputsParams is not in vllm top-level. Import from vllm.sampling_params:
from vllm.sampling_params import StructuredOutputsParams
max_tokens defaults to 16. This is intentionally low. Always set it explicitly for production use.
Greedy sampling forces n=1. When temperature=0, you cannot set n > 1.
Pooling models need runner="pooling". For embed(), classify(), and score(), the model must be loaded with runner="pooling" (or auto-detected).
score() task is deprecated. The "score" pooling task is deprecated in v0.19.0. Use "classify" instead. Will be removed in v0.20.
LoRA needs enable_lora=True. Must be set at LLM() construction time. Cannot be enabled after.
swap_space is deprecated. The parameter is accepted but ignored with a warning.
Multimodal placeholders are model-specific. When using generate() with images, the placeholder token (e.g., <image>) varies by model. Use chat() for automatic handling.
enqueue() / wait_for_completion() -- Decouple request submission from result collectionreward() method -- Generate reward scores via token-level classificationRepetitionDetectionParams -- Detect and terminate repetitive N-gram patterns earlythinking_token_budget in SamplingParams -- Control thinking token limits for reasoning modelsflat_logprobs option -- High-performance flat logprob format (FlatLogprobs)sleep() / wake_up() -- Engine lifecycle management with multi-level sleep (levels 0, 1, 2)collective_rpc() / apply_model() -- Direct worker and model accessget_metrics() -- Retrieve Prometheus metrics snapshot--tool-server flag for external MCP tool servers/v1/messages endpoint/v1/responses endpoint (OpenAI Responses format)/v2/embed endpointstructural_tag constraint in StructuredOutputsParamsscore()default_chat_template_kwargs -- Server-level defaults for chat template (useful for reasoning models)runner and convert params -- Explicit control over runner type and model conversioninit_weight_transfer_engine() / update_weights() for RL trainingoffload_group_size, offload_num_in_group, offload_prefetch_step, offload_paramskv_cache_memory_bytes -- Fine-grained KV cache memory controllogits_processors -- Custom logits processor supporttokens_only mode -- Disaggregated serving token endpoint/v1/chat/completions/render and /v1/completions/render/v1/chat/completions/batchLLMEngine is replaced by vllm.v1.engine.llm_engine.LLMEngine.swap_space parameter deprecated -- accepted but ignored with a warning.score pooling task deprecated -- use classify instead. Will be removed in v0.20.PoolerConfig(task=...) instead.LLMEngine instantiation in LLM class (now always uses LLMEngine.from_engine_args()).gpu_memory_utilization (default 0.9)max_model_lenquantization="awq" or "gptq")cpu_offload_gb for partial CPU offloadingtensor_parallel_size=2)generation_config.json is overriding your params. Use generation_config="vllm" to disable.chat() not generate()max_tokens from the default of 16structured_outputs_config={"backend": "outlines"}grammar cannot be an empty stringchoice cannot be an empty list"guidance" or "lm-format-enforcer" backendsenable_lora=True at LLM constructionlora_int_id must be > 0lora_path must not be emptymax_lora_rank--portGET /health--api-key or VLLM_API_KEYnpx claudepluginhub datathings/marketplace --plugin vllmDeploys vLLM server on detected hardware (CUDA/ROCm/TPU/CPU), installs in virtual env with uv/pip, starts LLM serving, tests OpenAI-compatible API.
Guides local LLM inference, VRAM optimization, model selection, and quantization using Ollama, llama.cpp, vLLM, and LM Studio. Covers GGUF, EXL2 formats and privacy-first deployment.
Provides recipes and Docker Compose configs for serving LLMs on RTX 3090 GPUs with vLLM, llama.cpp, and SGLang, exposing an OpenAI-compatible API.