vLLM
Self-hosted, high-throughput, OpenAI-compatible LLM serving.
Overview
vLLM is a high-throughput inference engine for serving Large Language Models in production. It exposes an OpenAI-compatible API and uses PagedAttention for efficient memory management.
Official Website: https://vllm.ai Documentation: https://docs.vllm.ai
Key features
- PagedAttention — Efficient KV-cache memory management
- High throughput — Optimized continuous batching for production serving
- OpenAI-compatible — Drop-in
/v1/chat/completionsAPI - Multi-GPU — Tensor and pipeline parallelism
- Any Hugging Face model — Serve any compatible open model
Local usage
vLLM is self-hosted. Start a server and call it directly — no API key is required for a local instance. The default endpoint is http://localhost:8000/v1.
# Start vLLM server
vllm serve meta-llama/Llama-3.1-8B-Instruct
# Call the local OpenAI-compatible endpoint
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "meta-llama/Llama-3.1-8B-Instruct",
"messages": [{"role": "user", "content": "Hello!"}]
}'Using vLLM with Yunxin
When a vLLM backend is registered with Yunxin, address its models using the provider/model convention by prefixing with vllm/ (for example, vllm/meta-llama/Llama-3.1-8B-Instruct). Requests use the same Yunxin base URL (https://api.yuhuanstudio.com/v1) and your Yunxin sk- API key.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["YUNXIN_API_KEY"],
base_url="https://api.yuhuanstudio.com/v1"
)
response = client.chat.completions.create(
model="vllm/meta-llama/Llama-3.1-8B-Instruct",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.YUNXIN_API_KEY,
baseURL: "https://api.yuhuanstudio.com/v1",
});
const response = await client.chat.completions.create({
model: "vllm/meta-llama/Llama-3.1-8B-Instruct",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);curl https://api.yuhuanstudio.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $YUNXIN_API_KEY" \
-d '{
"model": "vllm/meta-llama/Llama-3.1-8B-Instruct",
"messages": [{"role": "user", "content": "Hello!"}]
}'Available models
vLLM serves whichever Hugging Face model you start the server with; capabilities depend on the model and your hardware. When registered with Yunxin, query the live catalog with the Models API:
curl "https://api.yuhuanstudio.com/v1/models?provider=vllm" \
-H "Authorization: Bearer $YUNXIN_API_KEY"vLLM is a self-hosted solution. The model set and capabilities depend on which models you load and your hardware configuration.
Official resources
How is this guide?