Scanning vLLM-served models with garak's OpenAI-compatible generator

Point garak's OpenAICompatible generator at your own vLLM server to probe a self-hosted model, with the base URI, model name, keys and parallelism set correctly. Covers the setup, the security of the endpoint under test, and common failures.

On this page

Scanning vLLM-served models with garak's OpenAI-compatible generator for your own endpoint

garak's openai.OpenAICompatible generator can call a vLLM server through the OpenAI client once you set a base URI, because vllm serve exposes OpenAI-compatible endpoints such as /v1/completions and /v1/chat/completions. The generator's base URI defaults to ` which is also vLLM's default address, so a team running both on one host may need to change nothing else. Both tools are licensed under Apache 2.0, which means the scanner and the server carry no license fee, but the cost of running the model stays with your team: accelerator capacity, the surrounding infrastructure and the people who operate both systems. Confirm each license in the repository you actually deploy, since your packaging or a vendor build may add terms.

Plan the scan as load on your own endpoint, not as a single test call. garak makes 5 generations per prompt by default, and a full scan sends many prompts across the selected probes, so the endpoint will see sustained traffic for the length of the run. Confirm before the first run that the serving host has the capacity to absorb that load alongside production users, and decide whether the scan should run against a staging instance with the same model and settings. Parallel attempts are the main lever for speed, since maintainers recommend remote endpoint generators over local model generators because remote endpoints allow parallel requests. Check the vLLM server's concurrency limits and your reverse proxy's rate limits before raising the parallelism setting, or the scan will measure your queueing behavior instead of the model.

Before you point garak at the server, decide how the API key and network path will be handled. vLLM's --api-key option protects only some endpoints under /v1, and the vLLM security documentation warns against relying on it alone, so confirm which routes the scanner must reach and which routes your proxy exposes to the scanning host. Set the key through the environment variable and the generator settings your garak version documents, and keep it out of committed config files. Also confirm the model name string the server reports, because the generator must request the same name that vLLM serves. The scan report is written as JSONL and garak.log, so store both where your evidence process can find them.

What you need before the first garak run against vLLM

Four things must be in place before garak can reach your model: a Python environment with garak installed, a running vLLM server with the model loaded, a network path between the scanner and that server, and agreed key handling. Confirm the vLLM and garak versions first, because the same scan can behave differently across releases.

Python 3.11 and garak installed

Install garak from PyPI into a Python 3.11 or newer environment on the host that will run the scan. The garak PyPI package requires that Python version, so an older interpreter on a build server will fail at install time. Pin the garak version in your environment, since the 0.17.1 release dated 16 October 2026 is the version this guide was checked against. Record the version in every report so later comparisons make sense.

garak on PyPI

A running vLLM server with the model loaded

Start the server with vllm serve using the exact model you intend to test, and confirm it answers on /v1/chat/completions or /v1/completions before involving garak. A scan against a server that is still loading weights produces connection errors that look like model failures. Note the vLLM version, since the project ships new minor releases about every two weeks, and the model revision, so results can be tied back to a specific build.

vLLM online serving docs

Network path from scanner to server

Confirm that the scanner host can reach the vLLM port over the network, and that a firewall or ingress rule does not block the /v1 path. The garak OpenAICompatible generator defaults to a base URI of ` so a scanner on a different host needs that value changed. Keep the path inside your network. vLLM communication between nodes in a multi-node deployment is insecure by default, so the scanner should reach a single protected endpoint, not internal cluster traffic.

API key configuration if --api-key is set

If the server runs with --api-key, decide where the key lives before the first run, and store it in an environment variable or secrets manager rather than in a config file committed to source control. The vLLM key protects /v1 routes only, not /metrics or /health, so the scanner needs the key for model calls while the other endpoints stay outside the scan. Ask the platform team who rotates the key and how a rotated key reaches the scanner.

vLLM security docs

Accelerator platform and version pinning

Confirm the accelerator the server runs on. vLLM supports NVIDIA CUDA, AMD ROCm, Intel XPU and CPU platforms, along with some further hardware through third-party plugins, and the platform affects which model sizes and throughput the scan will see. Record the vLLM version alongside the garak version, because a version change on either side can shift results. Check the installation guide for your platform before the first run.

Latest minor release cited
0.31.0
vLLM installation docs

How to configure the OpenAICompatible generator for vLLM

This sequence connects garak to a self-hosted model served by vLLM, so that every probe request goes to your own endpoint with a verified base URI, model name, key and parallelism setting. The result is a working scan target that you have confirmed answers requests before any full run starts.

  1. Install garak in a dedicated environment

    On the host that will run the scan, create a virtual environment with Python 3.11 or newer and install garak from PyPI with pip. garak is a command-line tool developed on Linux and macOS, so confirm the host meets that baseline before you begin. Run the garak help command to confirm the install works. The check is a clean help output listing the available options, with no import errors.

  2. Start vLLM serving the target model

    Start the server with vllm serve and the model you want to test, on a host and port reachable from the scanning machine. The vLLM server exposes OpenAI-compatible endpoints under /v1, including /v1/completions and /v1/chat/completions. Confirm the server log reports that it is ready to accept requests before moving on. Record the host, port and any API key you configured, because each one is used in later steps.

  3. Confirm the model name from the models list

    Request the model list from the server's /v1/models path using curl or a browser, and copy the exact model identifier it returns. garak's OpenAICompatible generator sends that identifier with every request through the OpenAI client, so a mismatch causes requests to fail. Note that the name is case sensitive and may include a path-like prefix if the model was loaded from a local directory. The check is that the identifier in the list matches the name you intend to pass to garak.

  4. Set the base URI to the server's /v1 path

    Point the generator at the server by setting its base URI to the address of the vLLM server followed by /v1. The garak source defaults the base URI to a localhost address on port 8000 with the /v1 path, so change it only if your server runs elsewhere. Set the model name to the identifier you copied in the previous step. The check is a single test prompt sent through the generator that returns a completion, which confirms the path and name together.

  5. Export the API key variable

    If you started vLLM with the --api-key option, export the same key as an environment variable in the shell that runs garak, so the OpenAI client sends it with each request. Keep the key out of configuration files that go into version control. Remember that the vLLM security documentation says the key protects the /v1 endpoints but not every route, and recommends a reverse proxy that allowlists only the endpoints meant for users. The check is that the same test prompt succeeds with the key set and fails with a wrong key, which shows authentication is enforced.

  6. Set parallel attempts for the remote endpoint

    Because the endpoint is remote, garak can send requests in parallel, and the maintainers recommend remote endpoint generators over local model generators for speed. Set the number of parallel attempts to a value your vLLM host can sustain, and watch the server's request queue while the test runs. Keep in mind that garak makes 5 generations per prompt by default. The check is a short probe run in which the server log shows concurrent requests being handled without errors or timeouts, and the run completes and writes its JSONL report.

  7. Run a small probe scan to verify the setup

    Before a full scan, run one narrow probe with the configured generator and inspect the output. garak writes a JSONL report of every attempt and its evaluation, and a garak.log file that continues across runs, so review both. Confirm that the report names the model you set and that attempts show completions rather than connection or authentication errors. Once this run is clean, the same configuration can be used for wider probe selections.

Choosing parallelism and generation counts for a vLLM scan

garak's maintainers recommend remote endpoint generators over local model generators for speed, because remote endpoints allow parallel requests. That split matters for a vLLM scan. When garak loads a model in process, it works through prompts with far less room to overlap them. When it calls the OpenAICompatible generator against a vLLM server, garak can send several requests at once, and the vLLM server decides how many of them it processes simultaneously based on its own batching, memory and configured limits. Scan speed therefore depends less on your laptop or the garak host and more on how many concurrent requests the serving stack accepts before latency climbs.

  • Remote generators parallelize: The OpenAI client path lets garak keep multiple requests in flight against the endpoint.
  • Local generators serialize: Running the model inside the garak process removes that overlap, which is why the maintainers favor remote endpoints for speed.
  • Server capacity sets the ceiling: Adding client concurrency past what the vLLM server can batch usually adds queueing rather than throughput.
  • Network path counts too: A vLLM server on a separate host adds round trips that a local test would not see.
  • Rate limits belong to your gateway: If a reverse proxy sits in front of vLLM, its limits apply to the scan as well.

Confirm the concurrency options available in your installed garak version in the user guide before you set them in a config file.

How a garak probe reaches your vLLM server

The run starts in the garak harness, which sends each probe's prompts to the OpenAICompatible generator. The generator calls the base URI on the vLLM API server under /v1, and the request crosses from the scanner host into the inference host, which is where the trust boundary sits. The API key is checked at the vLLM server when the request arrives, before the model generates anything. Responses return through the generator to the detectors, which write each attempt and its evaluation to the JSONL report. Check that the endpoint path is reachable from the scanner host and that the key is accepted before a full run.

The request path from garak probes to the vLLM server and back to the report.

Mapping garak settings to vLLM server values

This table pairs each garak OpenAICompatible setting with the vLLM server flag or request field it must match. Read it as a checklist: a mismatch in the base URI, model name or API key usually shows up as connection or authentication errors rather than as weak results, so confirm each pair against the vLLM version you run.

SettingvLLM server valueWhat to confirm
Base URI (uri)Host and port set by --host and --port, with the /v1 pathgarak defaults to which matches vLLM's default port only if you did not change it; set the full address if the server runs elsewhere
Model nameIdentifier the server reports for the loaded modelQuery the /v1/models route on your server and copy the exact string, including any path-style prefix used when the model was loaded
API keyValue passed to the --api-key optionThe key protects /v1 routes only, so confirm the scan path is covered and that the key is supplied through the environment variable garak reads
Generation optionsRequest fields such as max_tokens and temperature accepted by /v1/chat/completions or /v1/completionsCheck which fields your vLLM release accepts and whether garak sends them on the chat or completion route you selected
Parallel attemptsConcurrent requests the server accepts before queuingRaise concurrency only after a small test run succeeds, and watch /metrics for queue depth and error counts during the scan
Target routeChat or completion endpoint served by vllm serveMatch the garak generator type to the route; a chat model served on the completion route may return unexpected output
Server versionRelease running on your host, reported at startupConfirm each mapping against the vLLM release you deploy, since option names and routes can change between minor releases

Protecting the vLLM endpoint during and after the scan

A scan sends attack prompts to your model server and stores what comes back, so the endpoint and the output files both need controls. The cards below cover the vLLM settings that protect the server, the network layout for multi-node runs, and the handling of keys and reports after the scan finishes.

Know what --api-key covers

The vLLM --api-key option protects the endpoints under /v1, but not /metrics, /health, /invocations, /pause, /resume or /abort_requests. A scanner that only uses /v1 can run correctly while those other routes stay open to anyone who can reach the port. Before the scan, list every route the server exposes and confirm which ones answer without a key. Ask your platform team to verify this with a request from outside the allowed network.

vLLM security docs

Put a reverse proxy in front

The vLLM security docs do not recommend relying on --api-key alone. Place a reverse proxy in front of the server that allowlists only the endpoints users and the scanner need, such as /v1/completions and /v1/chat/completions, and blocks everything else. Keep the vLLM port itself off public and shared networks so the proxy is the only path in. Test the proxy by requesting a blocked route and confirming it is refused.

Isolate multi-node traffic

In a multi-node deployment, communication between nodes is insecure by default, with no authorization or encryption between them. Place all nodes on an isolated network that only cluster members can reach, and keep that network separate from the scanner's path to the API. If your team runs vLLM across nodes with Ray or the built-in multiprocessing backend, ask who owns that network segment and how its access is reviewed.

Node-to-node traffic
Insecure by default

Keep the scanner's key out of logs

The API key you pass to garak should come from an environment variable or a secrets store, not from a command line or a checked-in config file. Shell history, CI logs and process listings can expose a key passed inline. Check the JSONL report and garak.log for any copy of the key before you share them, and rotate the key after any suspected exposure. Use a key scoped to the scan so it can be revoked without affecting production users.

garak user guide

Control prompts and outputs at rest

Each garak run writes a JSONL report of every attempt and its evaluation, and a garak.log file that continues across runs. Together they hold the attack prompts you sent and the model's replies, which can include sensitive text the model produced. Store these files in a location with access limits and encryption, set a retention period your compliance team agrees to, and do not copy them to general chat or ticket systems. Confirm where your scanner host writes these files before the first run.

Confirm access before the run

Before a scan, confirm who can read the vLLM logs, the /metrics output, and the scan artifacts. vLLM's metrics expose request counts and token throughput, which can reveal usage patterns even when prompts are not logged. Agree on a named owner for the endpoint, a window for the scan, and a way to stop the server if the scan causes unexpected load. Record these decisions so an auditor can trace who had access.

vLLM metrics docs

Common vLLM and garak connection failures and fixes

This table lists the failures teams most often hit when garak's OpenAICompatible generator talks to a vLLM server, with the likely cause and fix for each. Work down the rows in order, starting with the base URI and model name, because most failed first runs trace back to one of those two settings. When a row does not match what you see, open garak.log, which keeps debugging detail across runs.

SymptomLikely causeFix
Connection refused or no responseBase URI points to the wrong host or port, or the server is not runningConfirm the vllm serve process is up and set the base URI to its host and port, such as by default
404 Not Found on every requestBase URI is missing the /v1 path segmentAdd /v1 to the base URI so requests reach the OpenAI-compatible routes
Model not found or invalid model errorModel name in garak does not match the name the server was started withUse the exact model identifier passed to vllm serve, and list served models through the /v1/models route to confirm it
401 UnauthorizedThe server was started with --api-key and garak sends no key or a different keySet the same key in the garak configuration and in the API key variable garak reads, then retry a single probe
Requests timing out under high parallelismParallel attempts exceed what the GPU and batch settings can serve, so queued requests exceed client timeoutsLower parallel attempts and generations, retry with a small probe set, and raise server capacity before increasing concurrency
403 or blocked responses on some endpointsA reverse proxy allowlist permits only the routes meant for users, and garak calls a route outside that listAllow the chat and completion routes garak uses, and check which path the failing request targets in garak.log
Empty outputs or detectors scoring nothingResponse fields are not parsed as expected, often because the chat or completion target type does not match the endpointConfirm the endpoint type, inspect a raw response in garak.log, and verify the probe produced attempts in the JSONL report

Questions teams ask before scanning a vLLM endpoint

Are garak and vLLM free to use?

Yes, both are open-source under the Apache 2.0 license. garak is distributed by the NVIDIA GitHub organization and the maintainers describe it as a free tool, and vLLM has no paid edition. The money you spend comes from the accelerator capacity that runs the model, the surrounding infrastructure, the time your team or a partner spends on the scan and the people who operate the endpoint over time. Licensing costs are zero, so quotes should separate one-time work (setup, first scan, report review) from recurring work (rescans, vLLM upgrades, endpoint monitoring).

How long does a garak scan of a vLLM endpoint take?

The duration depends on the number of probes selected, the generations per prompt, the detectors each probe runs and how many requests the endpoint can handle at once. garak makes 5 generations per prompt by default, so a broad probe set multiplies quickly. The garak maintainers recommend remote endpoint generators over local model generators for speed, because remote endpoints allow parallel requests. Ask for a test run on a narrow probe set first, measure the time per probe on your hardware, and then size the full run. Also plan for the accelerator capacity you can spare during the test window.

What does our team need to provide before a scan starts?

A scan needs a few concrete inputs before work begins:

  • Network access from the machine running garak to the vLLM server, typically on the port the server listens on, with a base URI such as the default ` or your internal address.
  • The exact model name the server reports, which garak sends as the model parameter.
  • An API key if the server was started with --api-key, supplied through an environment variable rather than a config file.
  • A test window agreed with the people who own the endpoint, since probes generate heavy traffic.
  • Written approval from the owner of the model and the accelerators, covering what may be logged.
Can our in-house team run a garak scan against vLLM?

Yes, if your engineers can install garak from PyPI on Python 3.11 or newer, point the OpenAICompatible generator at your endpoint and read the JSONL report and the garak.log file. The harder work is deciding which probes match your model's exposure, keeping the endpoint secure while it is being tested, interpreting failures and deciding what must be fixed before release. Teams without an existing red-team practice often find that the interpretation and remediation steps take the most time, not the command itself. A partner can cover those steps, or your team can take them on in house.

Should the vLLM server be exposed directly to the scanner?

Avoid exposing the raw server. The vLLM security documentation says the --api-key option protects endpoints under /v1, /v2, /inference and /cohere, but not /invocations, /pause, /resume, /abort_requests, /metrics or /health, and it warns against relying on the key alone. The documentation recommends a reverse proxy that allowlists only the endpoints meant for users. Also, communication between nodes in a multi-node deployment is insecure by default, so keep those nodes on an isolated network. Confirm the exposed surface with your security team before the test begins.

What does a partner's scope for this work include?

DeployOpen engagements are fixed-scope, so the scope, deliverables and timeline are agreed in writing before work starts. For a vLLM scan, a typical written scope covers the endpoint review and access setup, selection of probes and detectors for your use case, parallel runs against your own endpoint, triage of the report, a findings summary and retest after fixes. Ongoing scanning, upgrades and continuous testing are available as retainers. Ask for the deliverables list, what is excluded (for example, changes to the model or the serving stack) and who owns the report afterward.

Will the scan results count as compliance evidence?

A scan produces testing evidence, but it does not make a system compliant. DeployOpen prepares systems, controls and evidence for compliance assessments, and independent auditors and certification bodies issue the reports and attestations. Ask your auditor which evidence they will accept, how often they expect rescans, and how the scan configuration and garak version are recorded so results can be compared later. Keep the JSONL reports and the garak.log file with the run details.

Planning a vLLM scan that others can repeat

A scan result is only comparable to another if both runs used the same garak release, the same vLLM release and the same server flags. Pin the garak version in your environment file or lockfile rather than installing whatever pip resolves on the day, and record the exact garak release used (the project publishes tagged releases on its GitHub releases page, and the latest supplied release is v0.17.1). On the serving side, record the vLLM version, the model identifier and revision, the tensor parallel size, the quantization and any --api-key or proxy settings. Store these alongside the run, so a reviewer can reconstruct the setup without asking the engineer who ran it.

Keep the JSONL report from every run, not only the HTML summary, because the JSONL file records each attempt and its evaluation and is the input you need for later comparison. Keep the garak.log file with it, since that log continues across runs and can show which settings were active. Give each run a stable name that includes the date, the model and the release pair, so the archive stays searchable. Confirm with your team which scan settings (probe selection, number of generations per prompt and the system prompt) are fixed in a config file and which are typed on the command line, because undocumented command-line changes are the most common reason two runs cannot be compared.

Plan rescans on a schedule tied to change, not only to the calendar. vLLM ships new minor releases about every two weeks, and the release line includes v0.28.0 on August 26, v0.29.0 on September 9, v0.30.0 on September 22 and v0.31.0 on October 5, 2026. A change in the serving engine, the chat template, the default sampling behavior or the model weights can shift failure rates, so treat any upgrade on either side as a trigger for a rescan against the previous baseline before the new numbers are trusted. Ask your platform team to notify the security owner before each vLLM or model change, and agree in advance who decides whether a score shift is a regression or an expected effect of the new release.

How DeployOpen works on this

DeployOpen plans and runs garak scans of self-hosted models behind vLLM inside your own infrastructure, so the endpoint, its keys and the scan reports stay under your control. Each engagement starts from a written scope that names the endpoint, the probes and the evidence you need from the run.

How we scope

  • Confirm the vLLM endpoint, base URI, served model name and the network path garak will use from the scan host.
  • Agree which probe families, generations per prompt and parallel attempt limits apply to your model and its exposure.
  • Record who issues API keys, where they are stored and how the scan host is authorized to reach the endpoint.

How we build

  • Install garak on the scan host and configure the OpenAICompatible generator with your base URI and model name.
  • Keep API keys out of config files and shell history, and check that the vLLM --api-key option is backed by a reverse proxy allowlist.
  • Tune parallel attempts against your endpoint's capacity, then run a baseline scan to confirm reports and the garak.log file are written.

How we hand over

  • Deliver the written configuration, run commands and the scan schedule so your team can repeat the same scan.
  • Provide the JSONL reports, a summary of failing probes and the evaluation findings with suggested fixes and a retest.
  • Document how to read the reports, how to compare runs over time and which vLLM version and garak version each run used.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after the initial scan is delivered.
  • Retainers can cover rescans after vLLM minor releases, which ship about every two weeks, and after garak releases.
  • Engagements are fixed-scope, so changes to the endpoint, probes or evidence needs are agreed in writing before work begins.

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.