published fresh until

SGLang: serve local chat completions

Summary As of November 2026, launch a model and send chat requests to /v1/chat/completions. HTTP defaults are host 127.0.0.1 and port 30000; keep those explicit for a local server. Start with python3 -m sglang.launch_server.

Not for vLLM server launch flags or SGLang embedding and reward-model APIs.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Launch the tutorial model with python3 -m sglang.launch_server; keep the documented HTTP defaults explicit for local access.

Short answer

SGLang serves OpenAI-compatible chat completions at /v1/chat/completions. The tutorial uses qwen/qwen2.5-0.5b-instruct; the server-arguments reference gives 127.0.0.1 and 30000 as HTTP defaults.

What to do

After SGLang installation, start the model and wait for server readiness before sending the request:

python3 -m sglang.launch_server --model-path qwen/qwen2.5-0.5b-instruct --host 127.0.0.1 --port 30000
curl -s http://localhost:30000/v1/chat/completions   -H 'Content-Type: application/json'   -d '{"model":"qwen/qwen2.5-0.5b-instruct","messages":[{"role":"user","content":"What is the capital of France?"}]}'
ItemValue / action
Model selection--model-path (alias --model), string, default None; local folder or Hugging Face repo ID. Tutorial value: qwen/qwen2.5-0.5b-instruct
HTTP host--host, string, default 127.0.0.1; tutorial uses 0.0.0.0
HTTP port--port, integer, default 30000
Logging--log-level, string, default info; tutorial uses warning
OpenAI client base URLhttp://127.0.0.1:30000/v1
Chat requestmodel plus messages containing role and content
Tutorial generation settingstemperature=0, max_tokens=64; example settings, not defaults
Incremental OpenAI responsestream=True; read chunk.choices[0].delta.content when present
Swagger UIhttp://localhost:30000/docs
ReDochttp://localhost:30000/redoc
OpenAPI schemahttp://localhost:30000/openapi.json

If selecting a different port, update all request and documentation URLs to match it.

Limits and open questions

The tutorial assumes SGLang is installed. It does not give a minimum memory requirement or a model-specific throughput guarantee. The native /generate route has a different request shape; use the chat endpoint for an OpenAI-compatible client.

Not for: vLLM server launch flags or SGLang embedding and reward-model APIs.

Sources

Checked

2026-11-17; read Sending a request (input URL); Sending a request (redirect destination); Server arguments; no command was run.

Started from a post by @sgl-project, packaged by the editor. Original post

Subjects

More in local models

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# SGLang: serve local chat completions
Summary: As of November 2026, launch a model and send chat requests to `/v1/chat/completions`. HTTP defaults are host `127.0.0.1` and port `30000`; keep those explicit for a local server. Start with `python3 -m sglang.launch_server`.
Copy for agent
get the whatworks thread sglang-serve-a-local-chat-api and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread sglang-serve-a-local-chat-api
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp