Testing models served by vLLM with promptfoo

Point promptfoo at your self-hosted vLLM server through its OpenAI-compatible API, with the endpoint, authentication, judge and output-handling choices planned before the first eval runs.

On this page

How promptfoo tests models served by vLLM

A team that serves open models on its own GPUs with vLLM needs evals and red team scans that run against that exact endpoint, with the same model name, settings and access controls it uses in production. promptfoo reaches vLLM through the OpenAI-compatible routes the server exposes, principally /v1/chat/completions for chat-style models and /v1/completions for raw completion prompts. The provider points at your server through its base URL, so the test traffic follows the same path as your applications. The choice of route matters: chat models generally belong on the chat endpoint, because the chat template is applied by the server, and sending them raw prompts to the completions route can produce answers that do not match what users see. Confirm the route and model identifier with your vLLM server's /v1/models listing before you write the config.

promptfoo runs on the machine that executes the CLI, not on the vLLM host. Evals and red team probes are generated and graded locally, and promptfoo talks directly to the endpoint over HTTP. That means the workstation or CI runner needs network access to the vLLM server and to any judge model you choose, but it does not need the model weights or GPUs. vLLM is licensed under Apache-2.0 and has no paid edition, so the software itself carries no license fee. Your costs are the accelerator capacity that serves the model, the surrounding infrastructure, the implementation work and the people who operate the server. Ask any partner for those components separately in a quote, and plan for the recurring cost of keeping test runs on the same hardware as production.

Because red team scans send many adversarial requests, the vLLM server must be protected before you point promptfoo at it. vLLM's --api-key option covers the /v1 routes that test traffic uses, but the vLLM security documentation warns against relying on it alone and recommends a reverse proxy that allowlists only the endpoints meant for users. Decide which routes your test runners may reach, issue a dedicated key for test traffic, and keep the server's /metrics and /health routes off the test path. Also confirm that test prompts and responses are retained only where your data handling rules allow, since judge models and gateway logs may store them.

What you need before connecting promptfoo to vLLM

Connecting promptfoo to a self-hosted vLLM server depends on five things lining up: the inference server, the promptfoo host, the network path between them, access control on the API and, if you grade with a model, a judge endpoint. Check each one before writing the first config so a failed run points to a real problem.

Pin the vLLM version

vLLM ships new minor releases about every two weeks, so an upgrade can change endpoint behavior, defaults or model support between your test runs. Pick one version, record it in your eval config notes and run your suite against it before any upgrade. Retest after each change you approve, and keep the previous version available as a rollback. Confirm the version in your own environment with vllm --version on the serving host.

Minor release cadence
About 2 weeks
vLLM releases

Confirm the GPU and hardware stack

vLLM supports NVIDIA CUDA, AMD ROCm and Intel XPU GPUs, as well as CPUs on several architectures, and each stack has its own installation path and supported features. Confirm which one your serving hosts use against the installation documentation before you pick a build. Your model and quantization choices also depend on that stack, so the grader and the target may differ in hardware.

vLLM installation docs

Install a supported Node.js runtime

The promptfoo CLI version 0.124.1, published on 8 October 2026, requires Node.js 22.22.0 or newer. Install that runtime on the machine that runs evals, whether that is a developer laptop, a CI runner or a jump host. Older Node.js versions can fail in ways that look like provider errors, so check the version first when a run stops at startup.

promptfoo on npm

Open the network path to the API port

The promptfoo host must reach the vLLM API port directly, so confirm routing, DNS and firewall rules from that host before debugging the config. Keep the path narrow: only the promptfoo runner or judge host should reach the port. vLLM's multi-node communication is insecure by default and must sit on an isolated network, so keep serving nodes off the general network as well.

vLLM security docs

Set an API key with --api-key

Start the server with --api-key and store the key in your secrets manager, then pass it to promptfoo through an environment variable rather than in a committed config file. The flag protects the /v1 endpoints but not /metrics, /health or several control routes, so it is not enough on its own. Put a reverse proxy in front of the server that allowlists only the endpoints your tests need.

Provision a judge model endpoint

If assertions use a model to grade responses, you need a second endpoint for the judge, separate from the model under test. Decide whether the judge runs on vLLM too, on a local server or on a hosted provider, and confirm which data may leave your environment. Grader choice also affects cost and reproducibility, so record the judge model name and version with each eval run.

Configuring the vLLM provider step by step

This sequence takes a self-hosted vLLM server from a running model to a first promptfoo eval, with a check at each stage so problems surface where they start. Each step produces something you can verify before moving on.

  1. Confirm the model and endpoint type

    Before you touch promptfoo, decide which model you are testing and whether its chat template is set up for chat messages. Check the model card and the tokenizer configuration on the model host, and confirm the exact model identifier you will pass to vLLM. Your platform or ML team usually owns this decision. You are done when you have written down the model name, and you know whether the model is meant for chat or only for raw text completion.

  2. Start vLLM with the chosen model

    On the GPU host, run vllm serve with the model identifier and the port you have chosen. Bind the server to an address reachable only from the machine running promptfoo, and set --api-key if your network design calls for it. Note that the --api-key option does not cover every endpoint, so keep the server behind a reverse proxy that allowlists only the paths your testers need. The server is ready when the startup log reports that it is serving requests on the port you set.

  3. List models with curl

    From the promptfoo host, call the models endpoint with curl against the /v1 base of your server, for example a GET to the /v1/models path with an Authorization header if you enabled an API key. The response should list the model identifier you passed to vllm serve. If the call fails, check the host, port, firewall rules and the key before changing any promptfoo settings. You are done when the model name appears in the JSON response.

  4. Set apiBaseUrl to the /v1 base

    In your promptfoo configuration, create a provider entry that uses the OpenAI-compatible provider and set apiBaseUrl to the /v1 base of your vLLM server, with the model identifier from the listing as the model name. Keep the API key in an environment variable rather than in the file. The config is correct when promptfoo can read the file without errors and shows the provider in its listing.

  5. Choose chat or completions provider type

    Use the chat provider type when the model's chat template is configured and you want to send role-based messages to the /v1/chat/completions endpoint. Use the completions provider type for models without a chat template or when your test prompts are plain text, which sends requests to /v1/completions. Confirm the choice with the model owner, since a mismatch produces answers that look odd without any obvious error. You are done when the provider ID in your config matches the endpoint you intend to test.

  6. Run a single smoke test

    Add one test with a short, known prompt and an assertion whose expected answer you can predict, such as a simple arithmetic question. Run promptfoo eval against that single test. The run is complete when the output shows one row and it passes the assertion. If it fails, read the raw response first, because reasoning-style models may return extra text that the assertion does not expect.

  7. Run a first eval and review output

    Expand the smoke test into a small suite of representative prompts from your application, keeping the set short enough to review by hand. Run the eval and open the results view to confirm that every row carries the response you expect and that the grading matches your reading. The sequence is finished when the suite runs end to end against your vLLM server, and you can explain each pass and fail from the stored output.

Choosing chat versus completions endpoints for red teaming

Decide the endpoint before you write any test. vLLM's OpenAI-compatible server exposes both /v1/chat/completions and /v1/completions, and promptfoo can target either. The completions route sends a single prompt string that the server passes to the model as raw text. The chat route takes a list of messages with roles such as system, user and assistant, and the server applies the model's chat template to turn those messages into the token sequence the model was trained on. For an instruction-tuned model, that template is what gives the system prompt its meaning and what formats tool calls and turn boundaries correctly. For most red teams testing guardrails, system prompts and tool use, the chat route is the one that reflects how the application will call the model.

A wrong choice rarely produces an error. It produces outputs that look plausible but are not what production would return. On the completions route, a system instruction becomes plain text the model may ignore or continue, so refusals and policy behavior can look weaker than they are. Stop sequences and token limits can also cut a reply mid-sentence, and a model may continue the conversation by inventing a next user turn. Those symptoms can be mistaken for model weakness, or hide a real weakness, so compare a handful of known prompts across both routes before trusting any pass rate. Confirm the chat template behavior of the specific model in your own environment rather than assuming it: check the template shipped with the model files, the server's startup logs and a few raw responses, since templates differ between model families and between releases of the same family.

Record the route and the template in your test configuration so later runs stay comparable. A change of vLLM release, such as moving between the minor versions the project publishes every two weeks, can change how requests are handled, so re-check a small reference set after upgrades. If your judge model is also served by vLLM, apply the same check to it, because a grader that misreads a truncated or template-mangled answer will score the target wrongly. Documenting these choices also makes it easier for a security or compliance reviewer to see what was actually tested.

Self-hosted judge models and thinking-model output in grading

The simplest option is to point promptfoo's grading provider at the same vLLM server that serves the model under test. The judge then runs on the same hardware, through the same OpenAI-compatible endpoint, and no grading traffic leaves your infrastructure. The trade-off is that the candidate model and the judge compete for the same accelerator capacity, and a judge that shares the candidate's weaknesses may grade its own outputs too leniently. Use this option for smoke tests and early development, where speed and simplicity matter more than independence.

  • Configuration: set defaultTest.options.provider to an openai:chat: provider whose apiBaseUrl points at your vLLM host, using the same model name the server reports.
  • Capacity: plan for concurrent grading requests on top of generation requests, since judge calls queue behind the same scheduler.
  • Independence: a model grading its own answers is a weak signal, so prefer a separate judge for release gates.
  • Data handling: grading prompts and outputs stay inside the network, which is the main reason to choose a self-hosted judge.
  • Versioning: record the judge model and vLLM version in the eval config so results can be reproduced after upgrades.

Before relying on this setup, confirm with your platform team that the server's API key and network allowlist cover the grading calls as well as the test traffic.

How a promptfoo request reaches vLLM and returns to grading

The flow starts on the test host, where the promptfoo CLI sends prompts to the vLLM OpenAI-compatible server through its configured apiBaseUrl. The response returns to promptfoo, which applies assertions locally. When a rubric needs an LLM judge, promptfoo calls a separate self-hosted judge endpoint, also inside the client network. Results are written to the local machine. Check that both the vLLM API and the judge endpoint sit inside the trust boundary, and that only intended endpoints are reachable from the test host.

Prompts, responses and judge calls stay inside the client network.

Mapping promptfoo settings to vLLM endpoints and models

This table pairs each promptfoo config key with the vLLM server setting or served model value it must match. Read it while writing your provider block, and check each row against the server you started and the output of its /v1/models endpoint.

Promptfoo settingWhat it must match on vLLMWhere to confirm it
Base URL (apiBaseUrl)Host, port and /v1 path of the vLLM server started with vllm serve, reachable from the machine running promptfooServer host and port in your deployment, and a successful request to /v1/models from the test runner
Model nameThe exact identifier vLLM serves. It is case-sensitive and often includes an organization prefix, so a near match failsThe id values returned by /v1/models, or the served model name you set when starting the server
Endpoint type (chat or completions)Chat tests use /v1/chat/completions and raw completions use /v1/completions. Both are exposed by the OpenAI-compatible serverYour provider ID choice in the config, compared with the endpoints your server answers
API keyThe key passed to the server with its api-key option, if you enabled one. That option protects /v1 routes onlyAn environment variable on the runner, such as OPENAI_API_KEY, referenced by name in the config
Temperature and max tokensSampling and output length sent per request. Values above the model's context limit or server defaults can be rejected or truncatedRequest parameters in the promptfoo config, compared with the model card and server logs for truncation
Secrets handlingThe key stays out of committed YAML. Promptfoo reads it from the environment at run time, so the config file can be shared safelyRepository scan for literal key values before merge, and CI secret variables set for the job
Endpoint exposureOnly /v1 routes should be reachable by test traffic. The docs recommend a reverse proxy that allowlists user-facing endpointsNetwork rules and proxy configuration, checked with requests to /metrics and /health from outside the cluster

Securing the vLLM endpoint that promptfoo calls

A promptfoo run sends many requests to your vLLM server, and some of those requests carry sensitive test data or exercise the server hard. The cards below cover the access controls, network placement, secret handling and capacity checks to settle before you point promptfoo at a shared server.

Scope the API key to /v1 only

The --api-key option protects the endpoints under /v1, /v2, /inference and /cohere, but not /invocations, /metrics, /health, /pause, /resume or /abort_requests. A key alone does not close those routes. Confirm which paths your vLLM version exposes, and check from outside the network that unauthenticated requests to the unprotected routes are either blocked or deliberately allowed.

vLLM security docs

Allowlist routes at a reverse proxy

The vLLM security docs recommend a reverse proxy that forwards only the endpoints meant for users. For promptfoo, that usually means the chat or completions routes and the embeddings route if your tests use it. Deny everything else, including /metrics and the control endpoints that can pause or abort work. Test the proxy with a request to each blocked path so you know the rule works.

Isolate multi-node traffic

Communication between nodes in a multi-node vLLM deployment is insecure by default, with no authorization or encryption. Place the nodes on an isolated network that test machines and other applications cannot reach directly. If your test runners sit on a different segment, route them through the proxy rather than opening node-to-node ports to them.

Keep keys out of configs and logs

Put the vLLM API key in an environment variable or your secrets manager, and reference it from the promptfoo provider configuration instead of writing the value into the YAML file. In CI, store it as a masked or protected variable and confirm that eval output, debug logs and uploaded artifacts do not echo request headers. Rotate the key when someone with access leaves the team.

Keep sensitive test data on site

Red team prompts and eval datasets can contain customer records, clinical notes or internal documents. Because promptfoo runs locally and talks directly with the model, the prompts travel from your machine to your vLLM server, so keep both on infrastructure you control. Check where promptfoo writes result files and whether reports are shared outside the team before they leave your network.

Plan capacity for red team load

A red team scan sends many adversarial prompts in a short window, which can saturate the GPUs and starve real users of the same server. Run scans against a dedicated test instance, or schedule them off-peak, and watch request counts and KV cache use on the /metrics endpoint from inside your network. Agree on concurrency limits with the team before a full scan starts.

vLLM metrics docs

Common vLLM and promptfoo failures and how to fix them

This table lists the failures teams most often hit when pointing promptfoo at a self-hosted vLLM server, with the likely cause and the fix for each. Read it when a run fails or returns odd results, and match the symptom to the row. Several causes are documented behavior of the vLLM server, so confirm version-specific details against the release you run after each upgrade.

SymptomLikely causeFix
404 Not Found on every requestThe base URL omits the /v1 path that vLLM serves its OpenAI-compatible endpoints under, so requests go to the wrong route.Set apiBaseUrl to the server root ending in /v1, then send one test request to /v1/models to confirm the path before running a suite.
Model not found or invalid model errorThe model name in the promptfoo config does not match the name vLLM registered when it started, which is often the full Hugging Face path or a name set with the served model name option.Call /v1/models on the server, copy the exact returned ID into the provider configuration, and keep the spelling and case identical.
401 UnauthorizedThe server was started with --api-key and the request does not send a matching bearer token, or the key in the config is stale after a restart.Pass the key through an environment variable in the provider's apiKey setting, confirm it matches the server's configured key, and do not commit it to the repository.
Requests pass in a quick check but fail on /metrics or /health from a shared networkThe --api-key option does not cover every route, including /metrics, /health and some control endpoints, so those paths may be reachable without it.Place a reverse proxy in front of vLLM that allowlists only the endpoints test traffic needs, and keep administrative and monitoring routes on a private network.
Timeouts and errors that appear only when several tests run in parallelConcurrent requests queue on the GPU, so long generations exceed the client timeout, and the eval concurrency is higher than the server can serve.Lower promptfoo concurrency, raise the request timeout for long prompts, and watch queue depth and latency in the Prometheus metrics exposed at /metrics while a run is active.
Empty output from the chat providerThe model is served only through the completions path, or the chat template is missing, so /v1/chat/completions returns no usable content for the prompt.Switch the provider to the completions endpoint for that model, or confirm the model ships a chat template before using the chat provider. Check one response by hand first.
Assertions fail because the output starts with reasoning text or hidden thinkingA thinking model returns its reasoning in the message content, so contains, regex or equality checks run against text the user would never see.Strip the reasoning block with a transform or post-processing step before assertions run, or configure the server to separate reasoning output if your vLLM version supports it. Confirm this behavior after upgrades.
Judge scores look lenient or inconsistentThe judge model is the same small or weak model under test, so it grades its own outputs and misses the failures you are testing for.Use a separate, stronger judge model, preferably self-hosted on the same infrastructure, and spot-check judge verdicts by hand on a sample before trusting a gate.

Questions teams ask before connecting promptfoo to vLLM

Does running promptfoo against vLLM carry a license cost?

No software license is required for either tool. promptfoo is licensed under the MIT license, and vLLM is licensed under Apache-2.0 according to its GitHub repository. The real costs are the accelerator capacity that runs the model (GPUs or other supported hardware), the surrounding infrastructure such as networking, storage and monitoring, and the people who install, operate and secure the stack. Ask whoever quotes the work to separate one-time setup from recurring infrastructure and staff time, and to state which items are included.

How long does a promptfoo and vLLM setup take, and what drives it?

Duration depends mostly on how many models and endpoints must be tested, how the vLLM server is authenticated and reached, and how the judge model is designed. A single model behind one endpoint is the simplest case. Each additional model, provider or application adds configuration and test data work. Authentication through a reverse proxy, a separate judge model, and multi-node serving all add steps. Ask for a written scope that lists the models, endpoints, auth method and grading approach before agreeing a timeline.

What does the team need to provide before the work starts?

Plan to provide three things. First, GPU or accelerator access on a server or cluster where vLLM runs, with the model weights available to it. Second, network access from the machine running promptfoo to the vLLM endpoint, and a decision on whether that path stays on a private network. Third, key management: where the API key for vLLM lives, how it reaches CI or developer machines, and who rotates it. Confirm the exact list with your platform team, since storage, identity provider and change approval rules differ between organizations.

Can our own team connect promptfoo to vLLM without outside help?

Yes, for a single model on one server, a capable engineer can point promptfoo at the OpenAI-compatible API, run a first eval and add a few assertions. Effort rises with multi-node deployments, which use tensor and pipeline parallelism and need careful network isolation, since the vLLM security documentation says inter-node communication is insecure by default. It rises again when auditors need documented evidence of access control, logging and test results. Teams that want that evidence should decide early who owns each control.

Does the vLLM API key protect every endpoint?

No. The vLLM --api-key option protects endpoints under /v1, /v2, /inference and /cohere, but not /invocations, /pause, /resume, /abort_requests, /metrics or /health. The vLLM security documentation warns against relying on the key alone and recommends a reverse proxy that allowlists only the endpoints meant for users. Before connecting promptfoo, confirm which paths the proxy exposes, and keep control endpoints off the network that test runners and CI jobs can reach.

What changes when we upgrade vLLM to a newer version?

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. Each upgrade can change model support, default settings, API behavior or response fields, so an upgrade can shift eval results even when promptfoo is unchanged. Pin the vLLM version in your deployment, rerun a baseline eval suite after each upgrade, and compare pass rates before moving production traffic. Ask any partner to include this regression run in the upgrade process.

Should we use a self-hosted model as the judge for grading?

A self-hosted judge keeps grading data inside your infrastructure, which matters when prompts or responses contain regulated or confidential content. The trade-off is that the judge is another model to serve, monitor and version, and its quality affects every grade. Choose a judge you can test against known good and bad answers, and record its version alongside results. Ask whether the judge's capacity will compete with the models under test on the same accelerators.

How DeployOpen scopes and delivers this vLLM integration

DeployOpen treats promptfoo against a self-hosted vLLM server as a scoped integration, not a one-line config change. We agree which endpoints, judge models and grading rules the suite needs, then build and verify them against your own inference infrastructure before handing over.

How we scope

  • Confirm which vLLM endpoints the suite will call, chat or completions, and who can reach the server.
  • Agree the judge model location, whether a self-hosted grader stays inside your network.
  • Write the scope, deliverables and timeline down before any work starts; engagements are fixed-scope.

How we build

  • Configure the promptfoo provider with apiBaseUrl and model names, then validate a small test set against the live server.
  • Set grading so thinking-model reasoning output is handled consistently before scores are compared.
  • Check that the vLLM API key and network controls match the endpoints your users are allowed to reach.

How we hand over

  • Deliver the working promptfoo configuration, environment variables and a short run guide for your team.
  • Document known limits, such as which vLLM endpoints the setup relies on and how judge results were checked.
  • Walk your engineers through running evals and reading results, so the setup stays with your team.

How we support

  • Offer ongoing support as a retainer for upgrades to promptfoo and vLLM, which ship on a regular release cycle.
  • Re-verify provider settings after vLLM version changes that affect the OpenAI-compatible API.
  • Provide continuous testing as an option when the suite needs to run on every model or serving change.

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.