Serving reasoning models on vLLM with reasoning parsers: when teams need it
An application calls a self-hosted thinking model and gets back a response that contains the model's reasoning mixed into the answer. The text is correct in substance, but the client was built to show only the final answer, so users see scratch work, and any code that parses the reply breaks. A reasoning parser is the vLLM feature that fixes this situation by separating the reasoning segment from the final answer before the response reaches the client. The vllm serve server exposes OpenAI-compatible chat endpoints, including /v1/chat/completions and /v1/responses, so the parser sits between the model output and the API response that existing clients already expect.
Teams need this capability when they host thinking models such as DeepSeek-R1, Qwen3 or Gemma 4 for applications that consume only the answer, or when they want the reasoning kept in a separate field for logging, review or evaluation. If every consumer of the endpoint can handle reasoning text, the parser may be unnecessary. The decision starts with the model family. Each family emits its reasoning in its own format, so the parser must match the model. The vLLM documentation names deepseek_r1 in its structured outputs guidance and gemma4 in its Gemma 4 recipe, and the value you need for other families should be confirmed against the vLLM documentation for the version you plan to run.
Before you rely on the parser, confirm three things in your own environment: which parser the chosen model requires, whether your client reads the separated reasoning field or ignores it, and whether the answer stays correct when the model reasons at length. Parser behavior also interacts with other features, such as structured outputs, that need their own settings during reasoning. Ask your implementation partner or your own platform team to test the exact model, parser and client combination with representative prompts before production traffic arrives, because a parser that works for one family can misclassify output from another.
How reasoning parsers separate thinking from answers
A reasoning parser is a serving component, not a prompt setting. Each card below covers one decision in that component: what gets split out, how applications read the two fields, which parser a model needs, and what goes wrong when the choice is off.
What the parser splits out
The parser reads the generated text and separates the model's thinking from its final answer before the response leaves the server. Reasoning is typically delimited by think tags, so the parser must know where that span starts and ends. Check a test response from each model version to confirm the split happens where you expect, before any client depends on it.
Online serving docsHow applications read the fields
Clients should read the answer from the final content field and treat reasoning as an optional, separate field that may be logged, shown to a reviewer or dropped. Code that parses the raw text for tags will break when the parser changes. Agree the field contract with application teams and test it against both streaming and non-streaming requests.
Wrong parser, leaked reasoning
If the parser does not match the model's output format, reasoning text can appear inside the answer. That exposes internal deliberation to end users, breaks JSON or tool-call parsing downstream, and inflates stored transcripts. Treat a mismatched parser as a defect that a smoke test should catch, not as a cosmetic issue.
- Parser example
- deepseek_r1
The deepseek_r1 parser
The deepseek_r1 parser is the option named in vLLM's structured outputs documentation for DeepSeek-R1 style reasoning output. It can be combined with structured outputs, so a model can reason first and then emit schema-valid JSON in the answer field. Confirm the parser name against the vLLM docs for the exact model version you deploy, since reasoning formats change between releases.
Structured outputs docsThe gemma4 parser
The vLLM Gemma 4 recipe enables thinking mode output with the gemma4 reasoning parser. Teams serving Gemma 4 should start from the recipe's flags rather than assuming the DeepSeek parser behaves the same way. Verify that the thinking output and the answer separate correctly for each Gemma 4 variant and chat template you run.
Gemma 4 recipeConfirming parser per model version
Parser names and model output formats can change with model revisions and vLLM releases, and the vLLM project ships minor releases about every two weeks. Before go-live, record the vLLM version, model revision, parser flag and chat template together, then rerun the split test after every upgrade. Ask the vendor or community docs to confirm any parser not covered here.
Request flow from client through vLLM reasoning parser
The request starts at the client, which sends a chat completion to the vllm serve endpoint with the reasoning parser enabled. The model generates thinking tokens followed by the answer, and the parser separates the two before the response leaves the API server. When structured outputs or tool calling are on, a constrained decoding or tool-parsing step runs in the same path, so check that it still applies after the split. The trust boundary sits at the API server, and the reader should confirm which endpoints are exposed through the reverse proxy.
Shows how a reasoning request moves through vLLM, with the trust boundary at the API server.
Reasoning parser and output settings and when each fits
This table compares the settings that shape how a reasoning model's thinking reaches clients: the reasoning parser for each model family, structured outputs during reasoning, the output token budget and the chat template. Read each row for the condition that makes it the right choice and the trade-off it brings, then confirm exact flags and defaults against the vLLM version you deploy.
| Setting | When it fits | Trade-off to weigh |
|---|---|---|
| Reasoning parser deepseek_r1 | Serving DeepSeek-R1 family models whose output separates thinking from the final answer, so clients can read the answer alone | Clients that expect the raw thinking text must be updated to read the separated field; confirm the parser matches your checkpoint |
| Reasoning parser gemma4 | Serving Gemma 4 with thinking mode enabled, following the vLLM Gemma 4 recipe | Applies to the recipe configuration; confirm the parser name and model variant against the recipe for your release before relying on it |
| Structured outputs with a reasoning parser | Applications that need JSON or grammar-constrained answers from a reasoning model and can accept the parser splitting thinking from the answer | Constraints apply to the answer, so test that a schema is enforced on the content your client actually reads |
| enable_in_reasoning for Qwen3 Coder | Qwen3 Coder with reasoning where structured output must also constrain text produced inside the reasoning span, set through --structured-outputs-config.enable_in_reasoning=True | Constraining reasoning text can reduce the model's room to think and can slow generation; test answer quality before enabling it |
| Output token budget | Workloads with long reasoning traces where you cap generation to control latency and cost per request | A tight limit can cut off the reasoning before the answer, leaving empty or partial output; set it from measured reasoning lengths for your prompts |
| Chat template | Any chat completions use, where the model must have a chat template or one supplied with --chat-template | A missing or mismatched template breaks reasoning tags and tool calls; verify the template against the model card before go-live |
Setting up a reasoning model on vLLM step by step
This sequence takes a thinking model from a checked model and release to a running server that returns reasoning and final answers in separate fields, with structured outputs verified under reasoning. Each step ends with a check that tells the team whether to continue.
Confirm the model and vLLM release
The platform or model owner records the exact model checkpoint and the vLLM release it will run on, checking the model's vLLM recipe or documentation for the reasoning parser name and any flags it requires. Current minor releases are listed in the vLLM GitHub releases, and the team should pin one version rather than track the latest. Done means a written note names the checkpoint, the release tag and the parser, and the note has been reviewed by the engineer who will run the server. Confirm that the release you pin still supports the model family, because parser support changes between releases.
Confirm the chat template
The engineer checks that the model has a chat template that the chat completions API can use, either bundled with the checkpoint or supplied with the server's chat template option. Reasoning models often emit their thinking delimiters through the template, so a missing or mismatched template can cause the parser to miss the reasoning span entirely. Run the template against a sample conversation with a system message, a user message and a multi-turn exchange, and confirm the rendered prompt contains the expected thinking markers. Done means the rendered prompt looks correct for a one-turn and a two-turn conversation.
Start the server with the matching parser
The engineer starts the server with vllm serve, passing the reasoning parser that matches the model family, such as deepseek_r1 for DeepSeek-R1 class models or gemma4 for the Gemma 4 recipe. The server should bind to an internal address behind an authenticated gateway, with the API key and endpoint allowlist set as the security guidance describes. Watch the startup log for the parser name and for any warning about the chat template or the reasoning configuration. Done means the server reports ready, lists the model under the models endpoint, and the log shows the reasoning parser was loaded without errors.
Send a test request that splits reasoning from answer
The team sends a fixed test prompt with a question that has a verifiable answer, through the chat completions endpoint, and reads the reasoning and final content fields separately. The reasoning text should appear in its own field and the answer should contain only the final response, without thinking delimiters leaking into it. Keep the prompt and expected answer in version control so the same test can be repeated after every upgrade. Done means the answer field matches the expected result and the reasoning field is populated, and a second request with a longer prompt also splits correctly.
Check the output token budget
The engineer sends a harder prompt with a generous output limit and then a deliberately small one, to see how the model behaves when the budget runs out during reasoning. A truncated response may contain reasoning with no final answer, so the client must handle an empty content field and a finish reason that signals the limit was reached. Set the default maximum output length in the client, and record the limit that gives complete answers for your typical workload. Done means the client code handles a truncated response without failing, and the team has a documented output limit for the model.
Enable structured outputs with reasoning
If the application needs JSON or another constrained format, the engineer enables structured outputs alongside the reasoning parser and sends a schema-constrained request. For some model families, such as Qwen3 Coder with reasoning, the structured outputs documentation says a configuration option must be set to allow constraints during the reasoning phase, so check the docs for the exact setting for your model before relying on it. Done means the constrained request returns valid output in the answer field, and the reasoning field is still populated.
Verify structured outputs with reasoning on
The team runs the structured output test set against the reasoning-enabled server, covering a valid schema, a nested schema, and a prompt that tempts the model to add prose outside the format. Each response is parsed with the same validator the application uses, and failures are logged with the reasoning text for review. Repeat the full set after any change to the parser, the release, or the model checkpoint. Done means every case in the set returns output that passes schema validation, and the team has recorded the set and results in its runbook.
Combining structured outputs with reasoning in vLLM
Structured outputs can run alongside a reasoning parser on vLLM, so a thinking model can be forced to return a schema-valid answer after its reasoning phase. The reasoning parser, such as deepseek_r1 for DeepSeek-R1 class models, splits the generated text into a reasoning part and an answer part, and the constraint is applied to the answer. Some models also emit structured content inside the reasoning phase, and for those the team has to decide whether constrained decoding should apply there too. The vLLM structured outputs documentation notes that Qwen3 Coder with reasoning may need --structured-outputs-config.enable_in_reasoning=True. Turning this setting on is a decision about model behavior, not a default to copy, so test it against the model you actually serve before it goes into a client.
The verification plan should cover two failure modes. The first is whether the content field of the response parses as valid JSON against the schema on every run, across the request types your application sends. The second is whether a long reasoning trace causes the schema to break, for example because the output token budget runs out before the answer starts or because the model drifts out of the constrained grammar once it leaves the reasoning block. Build a fixed test set with short and long reasoning cases, record the reasoning and answer lengths, and check both fields separately. Confirm with your vLLM version how the reasoning parser and structured output backend interact, since behavior changes between releases.
The schema design, backend choice and compile latency of constrained decoding are covered in the structured outputs topic, so this section assumes a working schema and focuses on the reasoning interaction. Keep the same test set when you change the model, the parser, the enable_in_reasoning setting or the vLLM release, because any of those can shift where the answer begins and whether it stays valid.
Security and operational considerations for reasoning output
Reasoning models produce more text than a plain answer, and that extra text carries the same data risks as the answer itself. The cards below cover where that text ends up, which endpoints are exposed, and how metrics and logs are handled, so the serving platform can pass the review it would face for any other model output.
Treat reasoning text as sensitive output
Reasoning traces can repeat parts of the prompt, retrieved documents, personal data or internal instructions. Apply the same classification, access rules, retention and deletion you use for final answers to the reasoning field, and confirm it in every response path your applications use. Reasoning text is not a debug artifact. Check this before any client stores full responses.
Expose only allowlisted endpoints
The --api-key option protects routes under /v1, /v2, /inference and /cohere, but not /invocations, /pause, /resume, /abort_requests, /metrics or /health. The vLLM security docs warn against relying on the key alone. Place a reverse proxy in front of the server and allow only the endpoints user applications need, so administrative routes stay unreachable from user networks.
vLLM security docsRestrict the metrics endpoint
vLLM exposes Prometheus-format metrics at /metrics on its API server, covering request counts, token throughput, latency and KV cache use. Those figures reveal traffic patterns and load, so scrape them from a monitoring network and block the path at the proxy for user traffic. Confirm which metrics your dashboards need before widening access.
vLLM metrics docsSet a reasoning text logging policy
Decide in writing whether gateway, application and server logs keep reasoning content, for how long, and who can read it. Many teams log token counts and latency but not reasoning text by default. Verify that the reverse proxy and any tracing tool redact or omit the reasoning field before logs leave the serving network.
Protect nodes in multi-node serving
The vLLM security docs state that communication between nodes in a multi-node deployment is insecure by default, without authorization or encryption. Reasoning models often run at larger sizes that span nodes, so place those nodes on an isolated network. Confirm that inter-node traffic never crosses the segment where user requests and reasoning output travel.
vLLM security docsReview access and retention with owners
Name an owner for reasoning output who signs off on what is stored, who can query it and how long it stays. Include application developers, since they often write the code that saves responses. Record the decision alongside your data handling standard so auditors can trace each control to its source.
Questions teams ask about reasoning models on vLLM
What does it cost to serve reasoning models on vLLM?
vLLM itself has no paid edition, so the cost comes from four places: GPU or other accelerator capacity, the surrounding infrastructure, implementation work and the people who operate the server. Reasoning models add cost in a specific way: they generate a long hidden reasoning trace before the visible answer, so each request consumes more output tokens and holds GPU memory for longer. That raises capacity needs for the same number of users. Capacity is usually the largest recurring cost and it is paid to your cloud provider or hardware budget, not to vLLM. Ask any partner for a quote that separates one-time work (model selection, parser testing, test cases, documentation) from recurring work (upgrades, monitoring, retesting after releases) and states which items use your own accelerators.
How long does it take to set up a reasoning model on vLLM?
The duration depends on how many models you run, how much accelerator capacity you already have, and how much testing your applications need. A single model on hardware you already operate is mostly a matter of confirming the launch flags, the reasoning parser and the chat template, then running your own request tests. Multiple models, new hardware or structured output requirements add testing rounds because each combination of model, parser and output format behaves differently. Ask for a written schedule that lists the models in scope, the hardware available for testing, and the acceptance tests that close each stage. Any figure a provider gives should trace back to that scope.
What must our team provide before the setup starts?
Your team needs to provide four things before work begins:
- The model choice, including the exact checkpoint, license and whether it must run in a private network.
- Accelerator hardware or a clear capacity plan, including GPU generation and memory per node.
- Representative test cases: prompts that should return a clean answer, prompts that trigger long reasoning, and requests that use tools or structured outputs.
- A named owner for acceptance, who decides whether reasoning text may reach end users or logs.
Without the test cases, the team cannot tell whether the parser separates reasoning from answers correctly for its own traffic.
Can our internal engineers set up reasoning model serving alone?
Often yes, if at least one engineer already runs GPU inference or Kubernetes workloads and has time to test. vLLM is open source under Apache-2.0, so the software is available without a license purchase, and the official documentation covers the server flags, the reasoning parser options and the structured outputs behavior. The gaps usually appear in testing: checking each model against your prompts, confirming that reasoning text does not leak into the answer field, and deciding how logs handle reasoning content. Teams that prefer to keep the work in-house but want outside review can scope a partner for specific parts, such as an independent test run or a security review of the endpoints. Confirm with your own engineers which parts they have capacity for before committing.
Which reasoning parser should we pick for our model?
Match the parser to the model family, then verify it with your own requests. The vLLM structured outputs documentation names deepseek_r1 as a parser that works with structured outputs, and the vLLM Gemma 4 recipe enables thinking output with --reasoning-parser gemma4. For Qwen3 Coder with reasoning, the documentation notes that structured outputs may need the --structured-outputs-config.enable_in_reasoning=True setting. Check the parser against the current model card and the vLLM recipe for your exact checkpoint, because a parser that suits one release of a model family may not suit another. Test both a reasoning-heavy prompt and a plain prompt, and confirm that the answer field contains only the final response.
How do vLLM upgrades affect reasoning output and parsing?
Upgrades can change parsing behavior, so every minor release needs a regression run before it reaches production. vLLM ships new minor releases about every two weeks, for example v0.30.0 on September 22 and v0.31.0 on October 5, 2026, according to its GitHub releases. Between releases, parser names, default flags, structured outputs options and model support can change. Pin the version in your deployment, read the release notes for each step, and rerun the reasoning test set: confirm the parser still splits reasoning from answers, that token limits still leave room for the final answer, and that structured outputs still validate. Plan who approves the upgrade and how a rollback works before you start.
How DeployOpen scopes reasoning model work on vLLM
DeployOpen plans and implements self-hosted vLLM inside your own cloud accounts, data centers or air-gapped networks, and the reasoning model work is scoped in writing before any build starts. The scope, deliverables and timelines are agreed with your platform, security and application owners first, and a quote follows from that written scope. Because vLLM has no paid edition, the scope also has to name the accelerator capacity, the surrounding infrastructure and the operations staff who will carry the platform after handover, since those are the cost lines that actually move.
The work runs in a fixed sequence. The first step is model compatibility: confirm the exact checkpoint, its chat template and the --reasoning-parser value that matches the model family, such as deepseek_r1 for DeepSeek-R1 or gemma4 for the Gemma 4 thinking output described in the vLLM recipes. Qwen3 Coder with reasoning may also need --structured-outputs-config.enable_in_reasoning=True, so that decision is recorded at this stage. Next comes parser configuration, which covers the server flags, the output token budget per request and whether structured outputs are allowed during the reasoning phase. Each of these is tested against the vLLM release your team has pinned, since minor releases ship about every two weeks.
Verification and handover close the engagement. Test scripts check that reasoning text and final answers arrive in separate fields, that truncated reasoning is handled, and that the /metrics endpoint and the reverse proxy allowlist behave as the security configuration requires. Handover includes runbooks, the configuration in version control and a retest plan for future upgrades. Ask any provider to confirm which items are in the fixed scope and which are optional extensions before you sign.
How DeployOpen delivers and supports vLLM reasoning deployments
DeployOpen plans, implements, documents and supports self-hosted vLLM inside your own infrastructure, including the reasoning parser, output token budgets and structured output settings that thinking models need. Each engagement starts from a written scope that names the models, the client applications and the evidence your teams expect before go-live.
How we scope
- Confirm which thinking models, such as DeepSeek-R1, Qwen3 or Gemma 4, your applications will call and which reasoning parser each one needs.
- Record which client applications read reasoning output separately and which only expect the final answer.
- Agree in writing whether structured outputs will run during reasoning, and which vLLM configuration option that requires for your model.
How we build
- Pin the vLLM version and model revision, then test the reasoning parser against sample prompts that include long chains of thought.
- Set output token budgets and check how truncated reasoning appears to clients before any traffic reaches the server.
- Verify structured output and tool calling behavior with reasoning enabled, and record the settings that passed in a configuration file.
How we hand over
- Deliver the server configuration, parser settings, test cases and results, and a runbook for changing reasoning options safely.
- Document which endpoints are exposed to users and which are kept internal, based on the vLLM security guidance.
- Walk your platform and application teams through how to read reasoning fields, respond to truncation and plan vLLM upgrades.
How we support
- Fixed-scope engagements are agreed in writing before work starts, and a quote follows from that scope.
- Ongoing support, upgrades and continuous testing are available as a retainer when reasoning models change or vLLM releases move.
- Retesting of parser and structured output behavior runs after each model or vLLM version change, with findings reported in writing.

