vLLM tool calling: parsers, tool_choice modes and model support

vLLM can serve function calling from self-hosted models when the right tool-call parser, chat template and tool_choice settings match the model family. This page explains how to choose and verify them.

On this page

Why vLLM tool calling depends on the model family

Your application expects OpenAI-style function calling, and you want the same behavior from a self-hosted model. On vLLM, tool calling is not automatic. It is enabled per model through a tool-call parser and a chat template, and the combination has to match the model you serve. A model that works well with tools on one parser can return malformed or unparsed calls on another, so the decision is made model by model, not once for the whole server.

vLLM documents its tool calling behavior on the OpenAI-compatible server started with vllm serve, which exposes /v1/chat/completions among its endpoints. Applications send a tools array in the request, and the model must emit calls in the format it was trained on. The parser reads that raw text and converts it into the structured tool_calls field the OpenAI API defines. If the parser expects one output format and the model produces another, the calls come back as plain text, which breaks the client without any obvious server error. The chat template also has to render tool definitions into the prompt, so a model that lacks a suitable template needs one supplied with --chat-template.

For the planning stage, treat the model family as the primary input. Llama, Qwen, Mistral, DeepSeek, gpt-oss and Granite each emit tool calls in different formats, and the supported parser names differ across these families. Confirm the exact parser name, the template and the model revision against the vLLM tool calling documentation before you commit, since parser support changes between vLLM releases. Ask your engineers to run a fixed set of tool-call requests against each candidate model and record whether the output is parsed correctly. That test, rather than the model card, is the evidence you need before an application team depends on the feature.

Matching a vLLM tool-call parser to each model family

vLLM does not infer the right tool-call format from the model name. Each model family emits tool calls in its own syntax, and the server needs a parser that matches that syntax to turn the output into structured calls. The cards below group the parser names listed in the vLLM tool calling documentation with the model families they are documented for.

Hermes parser for Qwen2.5 and Hermes

The hermes parser is listed for Qwen2.5 and Hermes-format models. Teams serving Qwen2.5 variants should start here and confirm the parser against the tool calling page for their exact model revision. A Qwen model that emits a different tool-call format, such as the newer XML style, needs a different parser, so check the output of one test request before building on it.

vLLM tool calling docs

Mistral parser for Mistral models

The mistral parser is the documented choice for Mistral model families. Mistral chat templates and tool-call tokens differ from those of Llama or Qwen, so a shared parser setting across a multi-model fleet will fail silently for some models. Confirm the parser and any accompanying chat template flag against the current docs before rollout.

Llama parsers for Llama 3.1 to 4

The llama3_json parser is listed for Llama 3.1 to 3.3 style JSON tool calls, and llama4_pythonic for Llama 4 pythonic-style calls. Using the wrong one of these two is a common mismatch, because both families are called Llama. Verify which format your checkpoint produces and test it with a single tool call.

DeepSeek parsers for V3 and V3.1

The deepseek_v3 and deepseek_v31 parsers cover DeepSeek tool-call output. They are separate parser names, so a team cannot assume one covers all DeepSeek releases. Confirm which parser matches the revision you deploy and record the choice in your model configuration so upgrades do not change it without review.

OpenAI parser for gpt-oss

The openai parser is listed for gpt-oss models. Because gpt-oss also has reasoning output and its own Responses API guidance, check tool calls and reasoning together during testing rather than in separate steps. Confirm the parser and related flags in the vLLM docs for your gpt-oss revision.

Parsers for Kimi, Granite, GLM and Qwen3 XML

The remaining documented parsers are kimi_k2, granite4, glm45 and qwen3_xml. Each targets one model family's tool-call output, and Qwen3 XML output differs from the Hermes style used earlier in Qwen2.5. Pin each model to its parser in deployment code, and confirm the mapping against the current documentation before you upgrade vLLM.

How tool_choice behaves and where it differs from hosted APIs

The tool_choice field in a chat completions request tells the server whether the model may, must or must not call a tool. Application code depends on these meanings, so teams should read each mode as a contract with their own code rather than as a label. The vLLM tool calling docs describe the options that the application sends, and they are the reference for the exact accepted values in your vLLM release.

  • auto: The model decides whether to answer in text or emit a tool call. Your code must handle both outcomes on every turn.
  • none: Tool calls are suppressed for that request, so the response should be plain text even when tools are supplied.
  • Named function: The request names one function, and the application expects a call to that function. Confirm how the server reports a failure to produce the call.
  • required: Where your vLLM release supports it, the model must call at least one tool. Confirm this value in the docs for your version before relying on it.
  • Parallel calls: Check whether a single response can contain several tool calls and whether your code handles each one.

Confirm every mode against the tool calling docs for the vLLM version you run, since accepted values and edge cases can change between releases.

Setting up tool calling on a vLLM server

This sequence takes a self-hosted model from a chat template check to a verified tool call, so applications can rely on the tool_calls object the server returns. Each step ends with a check that tells you whether to move on.

  1. Confirm the chat template supports tools

    Before changing any server flags, check that the model's chat template includes tool definitions. Your model engineer or platform team does this by reading the tokenizer configuration or the template shipped with the model weights, and by confirming the model card names the function-calling format it was trained on. vLLM needs a chat template to serve the chat completions API, so a model without one will fail here regardless of parser settings. You know this step is done when you can name the template source (the model's own template or a template file you will pass with --chat-template) and the tool-calling format it expects.

  2. Select the matching tool-call parser

    Choose the parser that matches the model family. The vLLM tool calling docs list hermes (for Qwen2.5 and Hermes models), mistral, llama3_json and llama4_pythonic (for Llama 3.1 through 4), deepseek_v3 and deepseek_v31, openai (for gpt-oss), kimi_k2, granite4, glm45 and qwen3_xml. Confirm the exact parser name for your model version against the documentation, because a parser for a neighboring family will often produce malformed or missing tool calls without an obvious error. Record the chosen parser in your deployment configuration so it is reviewed alongside the model version.

  3. Start the server with auto tool choice enabled

    Start the server with vllm serve, the model path, the automatic tool choice flag and the parser you selected, plus an optional --chat-template file if the model's own template is missing or needs changes. The platform team runs this on the GPU host or container, and the server should be restarted after any template or parser change. You know the server is ready when the log shows the model loaded and the OpenAI-compatible endpoints listening, and when the /v1/models endpoint returns your served model name.

  4. Send a test request with a tool definition

    Send one request to /v1/chat/completions that includes a simple tool definition, such as a function with two typed parameters, and a user message that clearly needs that tool. Use an illustrative weather or ticket lookup function that is harmless to call. Run the request with tool_choice set to auto first. The check passes when the response contains a tool_calls array with a function name and arguments that are valid JSON matching your schema.

  5. Test none, auto and forced tool_choice modes

    Run three requests against the same tool definition. With tool_choice set to none, the model should answer in plain text and return no tool_calls. With auto, it should call the tool only when the prompt needs it, so test one prompt that needs the tool and one that does not. With a forced choice that names the function, the response should always contain that call. Record which modes behave as expected, because forced and named modes depend on the parser and model combination and should be confirmed with your own prompts rather than assumed from the docs.

  6. Parse and validate the returned tool_calls object

    In your application or test harness, parse the tool_calls object from each response, confirm the function name maps to a real handler, and validate the arguments against the JSON schema you declared. Run several varied prompts, including ones with multiple parameters, optional fields and unusual wording, and log any response where the arguments are truncated, wrapped in extra text or missing. You know this step is done when every test prompt produces a parseable call, or when failures are traced to a specific parser or template fix.

  7. Verify the template when chat completions fail

    If the chat completions request returns a template error, or tool calls never appear, inspect the chat template the server is actually using. Confirm which file was loaded, whether the tool section of the template renders for your request, and whether the parser name matches the model family. Compare the rendered prompt with the format the model was trained on. The step is complete when a corrected template or parser produces a passing result from the test requests in the earlier steps, and the working configuration is saved with the model version it was tested against.

Why chat templates decide whether tools reach the model

vLLM needs a chat template before it can serve the chat completions API. A model must either ship a usable template or be given one through the --chat-template option of vllm serve. The template is what turns the OpenAI-style tools array and the messages history into the exact token sequence the model was trained to read. If the bundled template ignores tool definitions, the model never sees the function schemas, no matter how correct the tool-call parser is. Check this first when a model answers in plain text even though the request included tools. Confirm the template behavior for your exact model revision in the vLLM online serving documentation and in the model card, because templates change between revisions of the same model family.

A tool-enabled template does three jobs. It renders each tool's name, description and JSON parameter schema into the system or tool section of the prompt. It renders the assistant's earlier tool calls back into the history in the format the model expects. It also renders tool results, which applications return with a tool role and a tool_call_id, so the model can connect each result to the call that produced it. A template that drops the tool_call_id, flattens nested arguments or places tool results where the model does not look will still return HTTP 200, but the next answer will be wrong. Read the rendered prompt for one full tool round trip before you trust a template.

Treat every template change as a behavior change that needs regression tests. Upgrading vLLM, swapping a model revision or editing --chat-template can alter tool output without any error. Keep a fixed set of recorded tool conversations from your application, covering a single call, parallel calls, a tool error and a follow-up turn, and replay them against each candidate configuration. Compare the parsed tool calls and the final answers, not only whether the server responds. Store the template file under version control next to the serving configuration so the test results can be tied to a specific template.

Configuration options and when each fits

This table compares the server flags and request fields that control tool calling on vLLM, with the situation each one suits and its main trade-off. Read the server flags first, because they decide whether a tool call can be parsed at all, then use the request fields to set how strictly calls are enforced. Exact flag names and supported tool_choice values can change between releases, so confirm them against the version you install before writing client code.

OptionWhen it fitsTrade-off
Flag: --enable-auto-tool-choiceAgents and chat apps where the model decides when to call a tool.Enables automatic tool selection, but a wrong parser then breaks calls.
Flag: --tool-call-parserRequired with auto tool choice. Match it to the model family, such as hermes for Qwen2.5 and Hermes or openai for gpt-oss.A mismatched parser can return plain text or malformed calls without a clear error. Confirm the pairing for each model release.
Flag: --chat-templateCheckpoints without a usable chat template, or templates that mishandle tool messages.A custom template must produce the tool format the parser expects. Test with real tool requests.
Request field: tool_choice set to autoDefault for most agent loops where the model may answer in text or call a tool.The model may skip a tool it should call. Check behavior against your own prompts.
Request field: tool_choice set to requiredWorkflows where a tool call must happen on every turn, such as extraction into a function schema.The model must call a tool even when none is needed. Confirm support in your vLLM version.
Request field: tool_choice set to noneTurns where tool definitions are sent for context but calls must be blocked.Tool definitions still use prompt tokens. Confirm how your version handles them.
Request field: named functionA single known function must be called, such as a classifier mapped to one tool.Narrowest control. Confirm that your parser and model support the named form.

Choosing a strictness level for production tool calls

Strictness is a design decision the application makes, not a setting the parser makes for you. A vLLM tool-call parser turns the model's output into a structured tool_calls entry, but it does not check that the arguments match the JSON schema you declared in the tools array, and it does not guarantee that the model emitted a call at all. Parser output alone does not give you schema-valid arguments. Decide before launch how strictly your application will validate each call, what it will do when a call is malformed or missing, and which failures it will surface to users or logs.

A practical starting point is a three-part policy in the application layer. First, validate every returned argument object against the schema you sent, and reject calls that fail rather than executing them. Second, define a bounded retry path: resend the conversation with the validation error included, cap the number of attempts, and fall back to a safe response when the cap is reached. Third, log the raw model output, the parsed call, the validation result and the tool_choice value used, so you can tell whether a failure came from the model, the chat template, or the parser selected for that model family. Confirm the parser name and template behavior for your exact model version against the vLLM tool calling documentation before you tune retries.

When the output must be exact, such as a payload that feeds a database write or a downstream API with a fixed contract, consider structured outputs instead of relying on free-form tool arguments alone. Structured outputs constrain the generated text itself, which reduces malformed JSON, while tool calling still decides which function the model wants to run. Test the combination with your reasoning model settings and your largest tool schemas, because constraint compilation and output token budgets both affect latency. Whatever you choose, keep the validation step in your code: constrained decoding narrows failures but does not replace the check that the call is authorized, the arguments are in range, and the tool should run at all.

How a tool call moves from application to model and back

The flow starts in the application, which sends messages and tool definitions to the vLLM chat completions endpoint. The chat template renders those into the prompt the model sees, and the model generates raw output. The tool-call parser for that model family extracts structured tool_calls, which return to the application. The application, not vLLM, runs the tool, so that step sits inside its own trust boundary. The tool result returns as a tool message. Check that the parser matches the model and that tool execution is authorized.

Tool call path from the application through vLLM and back to the application's tool execution.

Security risks in tool-enabled vLLM deployments

Once a model can call tools, its output becomes an instruction to systems that act with real credentials. The risks below connect how tools run, what the model can be tricked into sending, and which vLLM endpoints are exposed, so each one has a control and a test before production.

Tools run with application credentials

A tool call is only a request from the model. The function that executes it runs with whatever credentials the application gives it, such as a database role, a service account or an API token. Confirm which identity each tool uses, scope it to the narrowest permissions the function needs, and keep write or delete actions behind a separate approval step rather than trusting the parser output alone.

vLLM tool calling docs

Untrusted model output in arguments

Parsers such as hermes, mistral or llama3_json turn generated text into structured arguments, but a malformed or hostile argument string is still model output. Validate every argument against a schema on the application side before execution, reject unexpected fields, and never pass arguments into shell commands, SQL strings or file paths without escaping. Test parser behavior on each model you deploy, since the expected output format differs by family.

Prompt injection from retrieved content

Documents, web pages, emails and tickets fed into a prompt can contain instructions that steer the model toward calling a tool with attacker-chosen arguments. The serving layer cannot tell trusted instructions from retrieved text. Separate retrieved content from system instructions in the chat template, limit which tools are available when untrusted content is in context, and include indirect injection cases in your test set.

Allowlisting tools per route

Every tool exposed to the model enlarges what an injected prompt can reach. Maintain an explicit allowlist of tool names and schemas in the application, and send only the subset a given user or workflow needs in each request. Pair this with tool_choice settings that do not force a call when none is intended, and log every tool name the model requested, including those the application rejected.

Endpoints the API key does not cover

The vLLM security docs state that --api-key protects the /v1, /v2, /inference and /cohere routes, but not /invocations, /pause, /resume, /abort_requests, /metrics or /health. Do not rely on the key alone. Place a reverse proxy in front of the server that forwards only the routes user applications need, and confirm that administrative and metrics routes are unreachable from user networks.

vLLM security docs

Testing before production

Tool-enabled setups change with model versions, chat templates and vLLM releases, so a single manual check is not enough. Build a test suite that covers valid and malformed tool calls for each model family, injected instructions in retrieved content, and proxy allowlist behavior. Confirm the results on your own configuration and repeat the suite after every model or vLLM upgrade.

Questions teams ask before enabling tool calling on vLLM

Does tool calling cost extra on vLLM?

No. vLLM has no paid edition, and its tool calling is part of the open-source engine licensed under Apache-2.0. The money you spend comes from three places: GPU or other accelerator capacity to run the model, the surrounding infrastructure such as networking, storage, monitoring and the API gateway, and the people who select, test and operate the setup. Tool calling adds little to the hardware bill on its own, but a model that calls tools reliably may need a larger or better-suited model, which raises the accelerator cost. Ask any partner for a quote built from those three components, with one-time work such as validation separated from recurring costs such as capacity and upgrades.

How much effort does it take to validate a model for tool calling?

The effort depends on how many models you plan to serve and how many tools they must call. For each model, the team has to confirm the matching parser, check the chat template, test tool_choice behavior with real tool schemas, and measure how often arguments come back malformed. Models in the same family often share a parser, so a second model in that family usually needs less work than the first. Ask for the test matrix in writing: models, parsers, tool schemas, and the pass criteria your application needs. The effort is driven mainly by the number of models and the strictness your application requires.

What does the work need from our team?

Your team needs to name the applications and workflows that will call tools, supply or approve representative tool schemas, and decide which failures are acceptable. Someone must own the model choice, the serving configuration and the decision to change a parser when a model or vLLM release changes. Engineers who run the server also need access to logs and metrics, since parser failures often show up as malformed tool calls rather than server errors. Plan for a named reviewer who signs off on test results before production use.

Can our own team enable tool calling without a partner?

Yes, if your team has engineers who can run vllm serve, read the tool calling documentation, and write repeatable tests for their own tool schemas. Many teams start in-house with one model and one application. A partner becomes more useful when you need several models validated, a fixed test matrix, a reverse proxy that limits endpoints, or evidence for a security or compliance review. Compare the internal hours and skills required against a written, fixed-scope quote, and confirm which parts of the work you want to keep in-house.

How do vLLM release changes affect tool-call parsers?

vLLM ships new minor releases about every two weeks, for example v0.31.0 on October 5, 2026, and parser names, defaults and model support can change between them. A parser that worked on one release may behave differently after an upgrade, so pin the version in your deployment and re-run your tool-call tests before moving to a newer one. Read the release notes for changes to tool-call parsers, chat templates and the endpoints your clients use. Treat each upgrade as a test cycle, not a routine restart.

Which checks should we run on tool calls before going live?

Start with the basics: confirm that the model returns tool calls in the format your client expects for each tool_choice mode, including auto, none and required where you use them. Then test invalid arguments, missing required fields, tools with nested objects and multi-tool turns. Record the result for each model and parser pair. Finally, check that the endpoints used for tool calls are reachable only by intended clients, because the vLLM security docs say the --api-key option does not protect every endpoint and recommend a reverse proxy that allowlists only user-facing routes.

What should we ask for in a quote for this work?

Ask for the list of models and parsers in scope, the tool schemas and tool_choice modes to be tested, the acceptance criteria, and the environment where testing runs. Ask which deliverables you receive, such as configuration files, a test report and runbook notes, and what happens when a vLLM upgrade changes parser behavior. Ask whether retesting after upgrades is included or offered as a retainer. Confirm who pays for accelerator capacity during testing. DeployOpen plans and implements in your own infrastructure and prepares evidence, but does not issue audit reports or certifications.

What to confirm before you commit to a model and parser

Before you fix a model and a --tool-call-parser value, confirm that the parser you plan to use is listed for the vLLM release you will run. The parser list in the vLLM tool calling documentation is the reference point, and parser names are not interchangeable across model families. Record the exact release tag, the model checkpoint revision and the parser name together in your configuration, so that a later upgrade or model swap forces a deliberate re-check rather than a silent change in how tool calls are parsed.

Tool behavior can change between vLLM releases, including how tool_choice values are honored, how tool definitions are rendered into the prompt through the chat template, and how malformed model output is handled. Release notes are the first place to look, and the vLLM GitHub releases page lists them for each version. Treat every minor upgrade as a change to the tool layer: rerun a fixed suite of tool-calling cases covering required, named and auto tool choice, invalid arguments, and multi-step conversations before you promote it.

Parallel tool calls are the area where teams most often assume more reliability than they have measured. Confirm with your own test suite whether your chosen model and parser return several calls in one turn consistently, whether argument JSON stays valid under load and at your longest context lengths, and how your application handles a partial or duplicated call. If you also plan to expose the OpenAI Responses API or an Anthropic-style Messages endpoint, test tools on each endpoint separately, because parser behavior and tool result handling may differ between them. Write those results down as acceptance criteria before rollout.

How DeployOpen scopes and delivers vLLM tool calling

DeployOpen plans and implements tool calling on self-hosted vLLM inside your own infrastructure, starting from the models and client applications you need to support. The work covers parser selection, tool_choice behavior, chat templates and testing against each model family in scope, with a written handover your team can run.

How we scope

  • Engagements are fixed-scope, with the models, parsers, endpoints and client applications agreed in writing first.
  • We list each model family that must call tools and confirm its parser choice against the vLLM tool calling documentation.
  • The scope states which tool_choice modes clients use and which strictness expectations apply to each application.
  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.

How we build

  • We configure the tool-call parser and chat template for each model and record the pairing in a versioned configuration.
  • We test auto, required and named tool_choice behavior against each client application, not only against sample prompts.
  • We check malformed or partial tool-call output and define how the application handles a failed parse.
  • We confirm the endpoints clients call and make sure the serving layer exposes only the routes users need.

How we hand over

  • You receive a documented matrix of models, parsers, chat templates, tool_choice modes and known limits.
  • Test cases and scripts run against your serving environment so your team can repeat the checks after changes.
  • Runbooks cover parser changes, template updates and what to recheck when you move to a newer vLLM release.
  • Walkthroughs with your platform and application teams confirm who owns each part of the tool-calling setup.

How we support

  • Before a vLLM upgrade, we retest tool-calling behavior for each model and parser in your scope.
  • When you add a model family, we extend the test matrix and document the parser decision before it reaches users.
  • Retainers cover continuous testing of tool-calling regressions alongside upgrades and documentation updates.
  • Ask any partner to confirm the support hours, response process and retest terms in the written quote.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.