How PyRIT reaches self-hosted Ollama and vLLM models
PyRIT's OpenAI-compatible chat target can call Ollama's REST API on port 11434 or the /v1 endpoints of a vLLM server, so the prompts, responses and scores in a red teaming run never need to leave your network or touch a public model API. The method is configuration of an existing target, with the endpoint URL, model name and key values changed for the local service, rather than a custom connector you have to write and maintain. PyRIT's configuration guide already names Ollama as an example provider, and the same pattern applies to vLLM because it serves OpenAI-compatible routes.
A PyRIT run uses separate model roles: the objective target being tested, an adversarial model that writes attack prompts, and a scoring model that judges responses. Each role takes its own endpoint setting, so the target can be a vLLM server on an accelerator host while the adversarial and scoring models run on a smaller Ollama instance, or any other combination you approve. Choose the roles deliberately, since a weak or permissive adversarial model changes the attack results and a poorly calibrated scorer changes what counts as a finding. Confirm which model each role uses and record it with the run.
Before the first run, check the network path rather than assuming it. Ollama binds to 127.0.0.1 by default and accepts local requests without authentication, so a change to OLLAMA_HOST that exposes it to other hosts needs a reverse proxy and access control in front of it. vLLM's --api-key option does not cover every route, so the vLLM security documentation recommends a reverse proxy that allowlists only the endpoints your testers need. Keep credentials for these endpoints in ~/.pyrit/.env rather than in scripts, and confirm that the scoring and adversarial calls go to your internal addresses and nowhere else.
What you need before connecting PyRIT to a local model server
Connecting PyRIT to a self-hosted model server depends on five things lining up: the Python and PyRIT versions, a running server, model files, a network path, and enough compute. Each card below is one item to confirm with your infrastructure team before you edit any target configuration.
Supported Python version
PyRIT installs from PyPI on Python 3.10 up to but not including 3.15, and the documentation recommends Python 3.13. Check the interpreter on the machine that will run PyRIT, not the model host, and use a virtual environment so PyRIT's dependencies stay separate from other tools. Confirm the version your security team has approved for scanning workstations or build runners.
PyRIT docsPinned PyRIT release
Record the PyRIT version you install and read the documentation for that same version, since configuration keys and target classes change between releases. The current release at the time of writing is v1.1.0, and the original Azure/PyRIT repository is archived, so install from the maintained microsoft/PyRIT project. Keep the version in your test record so results can be reproduced later.
PyRIT releasesRunning model server
You need either an Ollama instance or a vLLM server already serving the models you plan to test, with a confirmed OpenAI-compatible endpoint. Ollama exposes its REST API on port 11434, and vLLM serves /v1/chat/completions once started with vllm serve. Send one test request with curl from the PyRIT machine before configuring anything, so you know the server answers.
Model files already downloaded
Pull the objective, adversarial and scoring model files before the test window opens, because a test run should not depend on a download. Ollama keeps models in a directory that depends on the operating system and can be moved with OLLAMA_MODELS. Confirm with the platform team where model weights live, who can read them, and whether the disk has room for every model in the plan.
Deliberate network binding
Ollama binds to 127.0.0.1 on port 11434 by default, so a PyRIT machine on another host cannot reach it until you change the bind address with OLLAMA_HOST. That change exposes an API that has no authentication for local use, so put it behind a reverse proxy or a network boundary your security team has reviewed. Ask who approves the firewall rule and which hosts may connect.
GPU or CPU capacity
Size the host for the models and the request concurrency you plan to run. Ollama defaults to one parallel request per model, and vLLM needs accelerator support that matches its installation docs, covering NVIDIA CUDA, AMD ROCm, Intel XPU, or supported CPU and Apple silicon targets. Ask your infrastructure team to confirm driver versions, GPU memory, and whether the host can run the scoring model alongside the target.
vLLM installationConfiguring the OpenAI chat target against Ollama or vLLM
This sequence takes a team from a clean PyRIT install to three separate targets, objective, adversarial and scoring, all pointing at OpenAI-compatible endpoints on infrastructure the team controls. Each step ends with a check that confirms the path works before the next one begins.
Install PyRIT in a supported Python environment
The engineer who runs the red team creates a virtual environment on a workstation or jump host inside the network and installs PyRIT with pip. The PyPI package supports Python 3.10 up to but not including 3.15, and the PyRIT documentation recommends Python 3.13, so pin the interpreter to one of those. The step is complete when importing the package from Python runs without error and the installed version matches the release you intend to test against, such as v1.1.0.
Set endpoint, key and model values in configuration files
Write the chat endpoint, API key and model name into ~/.pyrit/.env for credentials and into ~/.pyrit/.pyrit_conf for settings, following the PyRIT configuration guide, which says to replace these values for your provider and names Ollama as one example. For Ollama, the key can be a placeholder because the local API does not require authentication. For vLLM, use the value you set with the --api-key option if you enabled it. Confirm the model name matches exactly what the server reports, because a mismatch fails later with an error that looks like a PyRIT problem.
Start the model server on the internal address
On the inference host, bind the server to an internal interface rather than all addresses. Ollama binds to 127.0.0.1 on port 11434 by default, so set OLLAMA_HOST to the internal address if PyRIT runs on another machine. For vLLM, start the server with vllm serve and the chosen model, binding it to the internal address and port. Confirm the bind from a second host on the same network. Ask the platform owner which reverse proxy and allowlist will sit in front of the endpoint, since the vLLM security documentation recommends allowlisting only the endpoints users need.
Confirm the model list from the endpoint
From the machine that runs PyRIT, request the model list from the OpenAI-compatible endpoint, for example with curl against the /v1/models path on the server. The response should list the model name you placed in the configuration. This check separates network and naming problems from PyRIT problems. If the list is empty or the request times out, fix the bind address, firewall rules or model loading before touching PyRIT again.
Send one test prompt through the chat target
Create a single OpenAIChatTarget instance using the configured values and send one harmless prompt, such as a request to repeat a short phrase. Run it with a simple script so the response path is isolated from attack logic. The step is complete when the call returns text and the conversation is written to PyRIT memory, which you can confirm by querying the stored conversation for that prompt. Keep this prompt benign, since it runs before any scoring is configured.
Create the objective target
Define the objective target as the model under test, pointing at the same or a separate OpenAI-compatible endpoint from the test prompt step. Give it a clear name in your run configuration so results can be traced back to the system being tested. Send one prompt through it again and check that the stored conversation is labeled as the objective target role. Record the endpoint, model name and server version in your run notes, because vLLM and Ollama both release frequently and results can shift between versions.
Add the adversarial and scoring targets separately
Create the adversarial target and the scoring target as their own instances, even if they point at the same server, so each has its own system prompt, model name and conversation history. Send one test prompt through each and confirm in memory that the three roles are stored separately. Ask your team to decide whether the adversarial and scoring models run on different hardware, since shared capacity can slow multi-turn runs, and confirm concurrency limits such as OLLAMA_NUM_PARALLEL or vLLM serving capacity before scaling up.
Mapping objective, adversarial and scoring roles to local endpoints
A single Ollama host can serve all three PyRIT roles at once. Each role points at the same OpenAI-compatible base URL but names a different model, so the objective model, the adversarial model and the scorer share one process, one disk for model storage and one set of queue settings. This is the lowest-effort shape to stand up and the easiest to reproduce on a workstation or one server. The cost is contention: all roles compete for the same request slots, so a slow scorer call can hold up an attack loop.
- Concurrency levers:
OLLAMA_NUM_PARALLELsets parallel requests per model (the documented default is 1),OLLAMA_MAX_LOADED_MODELSlimits how many models stay in memory, andOLLAMA_MAX_QUEUEcaps queued requests. - Model storage:
OLLAMA_MODELSmoves the model directory to a volume you control, which matters for audit copies of model files. - Evidence trail: all roles log to one host, so reviewers must use PyRIT memory labels to separate which model produced which response.
- Isolation: a shared host is a shared failure domain. A crash or a misconfigured model affects every role.
- Network exposure: Ollama binds to 127.0.0.1 by default. Changing
OLLAMA_HOSTexposes the unauthenticated local API, so put a reverse proxy with authentication in front of it.
Before you rely on this shape, confirm the concurrency values you set against your hardware and the queue depth your attack runs will generate.
Running one vLLM server per model gives each role its own process, configuration and accelerator allocation. Because vllm serve exposes OpenAI-compatible endpoints, PyRIT's OpenAI chat target can point at each instance by changing only the endpoint and model name. This shape suits adversarial models that need dedicated GPUs and scorers that must not slow down attack traffic. It also makes it easier to show a reviewer exactly which model version and settings handled which role.
- Parallelism: vLLM scales a model across GPUs with tensor parallelism within a node. Review the parallelism and scaling documentation before sizing each instance.
- Isolation: each instance has its own memory and accelerator pool, so one role cannot starve another.
- Evidence trail: instance-level configuration, such as model path and launch flags, can be recorded alongside PyRIT memory for each run.
- Operations cost: more instances mean more ports, more upgrades and more monitoring. Metrics are exposed at
/metricson each server. - Access control: the
--api-keyoption does not protect every endpoint, so the vLLM security documentation recommends a reverse proxy that allowlists only the paths PyRIT needs.
Confirm accelerator capacity for each instance and the exact endpoints your PyRIT configuration calls before you commit to this layout.
A mixed layout places roles according to their sensitivity and load. A common pattern, shown here as an illustrative example, keeps the scorer on a small shared Ollama host because it runs many short classification calls, while the objective and adversarial models run on a dedicated vLLM instance that handles longer multi-turn generations. Each role still uses its own endpoint, model name and concurrency setting, so the configuration reflects what each role actually does.
- Role-based routing: assign each PyRIT role its own target object with its own endpoint and model string, so a change to one role does not alter the others.
- Throughput: match concurrency to the role. Keep scorer parallelism high enough to avoid a bottleneck, and keep adversarial generation on hardware sized for long outputs.
- Isolation trade-off: a mixed layout reduces blast radius for the most important model but adds a second runtime to secure and patch.
- Evidence trail: keep a manifest listing each endpoint, model identifier, version and concurrency setting, then link it to the run records in PyRIT memory.
- Configuration drift: two runtimes means two sets of environment variables and flags, so store them in version control.
Before you finalize the layout, ask your team to confirm which model versions each role uses and how the manifest will be kept current after upgrades.
The right shape depends on how many models you test, how long attacks run and how much evidence reviewers will expect. A single shared host is the simplest starting point for a small test set. Separate vLLM instances fit teams with accelerator capacity and a need to isolate roles. A mixed layout fits teams that want to protect the scorer or the adversarial model from load spikes without running a full cluster. None of these choices changes PyRIT's attack logic, only where its calls go and how they are recorded.
- Start small: test one role on one endpoint, then split roles when queueing or isolation becomes a measured problem.
- Plan for upgrades: Ollama and vLLM both ship frequent releases, so each role should be pinned to a tested version.
- Record the mapping: keep the endpoint, model and concurrency for every role in the test plan.
- Keep scoring separate in reports: label scorer results distinctly so reviewers can tell judge output from target output.
- Estimate effort with a partner: ask for a written scope that covers hardware sizing, endpoint hardening and the run manifest.
Before you choose, confirm the hardware available to each role and the review standard your results must meet.
How requests flow from PyRIT to models inside your network
The flow starts on the PyRIT host, where the attack orchestrator sends prompts through the objective target and records every turn in memory. Adversarial and scoring models are called from the same host, and the internal reverse proxy is the only path to the Ollama or vLLM servers. Check that the trust boundary sits where you expect, that only allowlisted endpoints are reachable from the test host, and that the memory store is placed under your data controls.
Test traffic stays inside the internal network, with prompts and results stored on the PyRIT host.
Which PyRIT settings map to which local server values
This table pairs each value you set in PyRIT's configuration with the Ollama or vLLM setting it has to match. Read it as a checklist: a mismatch on the endpoint URL, port or model name is the most common reason a first run fails, while the key row depends on which server and which route you call. Confirm exact key names against the configuration guide for your PyRIT version before you write them into ~/.pyrit/.env.
| PyRIT value | Ollama side | vLLM side |
|---|---|---|
| Endpoint URL (base URL) | Ollama REST API on port 11434, usually with the /v1 OpenAI-compatible path | Address and port set when running vllm serve, with the OpenAI-compatible path such as /v1 on that host |
| Port | 11434 by default, bound to 127.0.0.1 unless OLLAMA_HOST changes the bind address | Set by the serve command; choose a port that your reverse proxy and firewall rules allow |
| API key | Not required for the local API on localhost; a key is only needed for direct cloud inference at ollama.com | Set with --api-key, which protects /v1 routes only; /health, /metrics and other routes are not covered by it |
| Model name | The name of a model pulled into the local store, matching what ollama list shows | The model identifier the server loaded at startup, which must match the name PyRIT sends |
| Objective, adversarial and scoring targets | Each target can use the same local base URL with a different model name, provided the models are pulled | Each target can use the same base URL; check that the server exposes the chat completions route each target calls |
| Routes to allowlist | Keep the local API on loopback or behind a proxy that exposes only the routes PyRIT uses | Allowlist /v1/chat/completions and any other route PyRIT calls, and block /metrics and /health from users |
Keeping attack and scoring traffic off public APIs
Once PyRIT talks to self-hosted Ollama and vLLM, the attack, objective and scoring traffic stays inside your network only if each serving layer is locked down. The cards below cover the Ollama and vLLM settings to change, the proxy rules that expose only user-facing endpoints, and the PyRIT files that hold conversations and keys.
Turn off Ollama cloud features
A default Ollama install can reach cloud-hosted models, which sends prompts outside your network. Set OLLAMA_NO_CLOUD=1 in the environment or the server configuration file, then confirm no request leaves the host during a test run. Keep in mind that Ollama states that local runs do not expose your prompts or data, so the risk comes from cloud features you enable by mistake. Record the setting in your deployment baseline so reviewers can verify it.
Bind Ollama to a controlled interface
Ollama listens on 127.0.0.1 port 11434 by default, which suits a single workstation running both PyRIT and the model. If PyRIT runs on another host, change the bind address with OLLAMA_HOST and place a reverse proxy such as Nginx in front to enforce access. The local API has no authentication, so anyone who reaches the port can send prompts. Test the bind address from a host that should not have access and confirm the connection is refused.
Allowlist vLLM endpoints at a proxy
The vLLM --api-key option covers /v1 endpoints but not /metrics, /health or /invocations, and the vLLM docs warn against relying on the key alone. Put a reverse proxy in front that forwards only the chat and completion routes PyRIT uses and blocks the rest from user networks. Test each blocked path with a request from the PyRIT host to confirm the proxy returns a denial. Keep metrics scraping on a separate internal path if your monitoring needs it.
Isolate multi-node vLLM traffic
In a multi-node vLLM deployment, communication between nodes is insecure by default, with no authorization or encryption. Place the nodes on an isolated network segment that only cluster members and the operators can reach, and keep PyRIT's HTTP traffic on a separate, proxied path. Ask your platform team to confirm which ports carry inter-node traffic and that firewall rules block them from other networks. Review these rules whenever you add a node or change the parallelism setup.
vLLM security docsProtect the PyRIT memory database
PyRIT stores conversations and results in SQLite or Azure SQL, and those records include the attack prompts and model replies your team reviews. Store the database file on an encrypted volume with restricted permissions, and limit who can read or copy it. Set a retention rule that matches your evidence policy, and decide before testing whether prompts containing sensitive test data are acceptable in memory. Check that backups of the database follow the same access rules.
PyRIT documentationSecure the PyRIT .env file
PyRIT reads credentials from ~/.pyrit/.env and settings from ~/.pyrit/.pyrit_conf. Even when the local endpoints need no key, the file may still hold provider keys or tokens for other targets used in the same engagement. Restrict the file to the tester's account, keep it out of source control and shared images, and rotate any key that was copied to a shared machine. Review which keys are present before each run so no unused credential stays in the file.
How to verify the red team run reaches only your models
Verify the boundary with evidence from three places, not from the configuration file alone. First, check egress. Confirm with network logs or firewall egress rules that the PyRIT host and the model servers make no outbound calls to public model endpoints during the run. Pay particular attention to any cloud endpoint that a default setting or a leftover environment variable could still reach. Ollama's documentation states that local runs do not send your prompts or data anywhere, and that cloud features can be disabled with OLLAMA_NO_CLOUD=1, but confirm that behavior on your own build and version rather than assuming it. If your policy requires it, record the deny rules that were in force during the run.
Second, check memory. Open the PyRIT memory for the run and confirm that the objective, adversarial and scoring roles each appear in the expected conversations, with the model name you intended for each role. A role that silently fell back to a different target is the most common misconfiguration this check catches. Keep the exported conversations with the run record so a reviewer can trace each finding to the endpoint that produced it.
Third, check the server side. Compare request counts in the vLLM /metrics endpoint, which exposes Prometheus-format request and token counters, or in the Ollama server logs, against the number of requests recorded in PyRIT memory. The two numbers should roughly match, and a gap points to requests that went somewhere else or retries you did not expect. Measure scorer accuracy separately against a labeled sample, because a scorer that looks correct in a single run may be wrong on the harms you care about. Finally, an integration test prompt that returns a reply shows the wiring works. It does not show that your attack set has been covered, so keep coverage claims tied to the dataset and attack list you actually ran.
Why the connection fails and how to fix it
This table lists the failures teams hit most often when PyRIT calls Ollama or vLLM, with the likely cause and the fix for each. Check the rows in order, since a refused connection or a 401 usually stops a run before model settings or capacity matter.
| Failure | Likely cause | Fix |
|---|---|---|
| Connection refused | Ollama binds to 127.0.0.1 port 11434 by default, so PyRIT on another host or container cannot reach it | Set OLLAMA_HOST to an address on your test network, or place a reverse proxy in front of Ollama and allowlist only the chat route PyRIT uses |
| 401 Unauthorized from vLLM | The vLLM --api-key option was omitted, or the key was sent to an unprotected route such as /metrics or /health | Send the key as a Bearer token on /v1 routes, and confirm that the reverse proxy exposes only the endpoints PyRIT needs |
| Model not found | The model name in PyRIT's configuration differs from the name pulled in Ollama or the name served by vLLM | List the served names with the Ollama model list or the vLLM /v1/models route, then copy the exact string into the model value |
| Queue rejected or requests time out | OLLAMA_NUM_PARALLEL (default 1 per model) or OLLAMA_MAX_QUEUE (default 512) is reached while PyRIT sends concurrent objective and scoring calls | Lower PyRIT concurrency, raise OLLAMA_NUM_PARALLEL within available memory, and separate objective and scorer calls so they do not compete for one slot |
| Out-of-memory errors | Several models are loaded at once, up to OLLAMA_MAX_LOADED_MODELS (default 3 per GPU or 3 on CPU), so the attacker, target and scorer exceed device memory | Reduce OLLAMA_MAX_LOADED_MODELS, use smaller quantized models for scoring, or run the target on separate hardware. Confirm sizing with your own hardware tests |
Questions teams ask before running PyRIT against self-hosted models
Can our team run PyRIT against self-hosted models without outside help?
Yes, if your engineers can install PyRIT from PyPI, run a local model server and manage the network path between them. PyRIT's configuration guide says to replace the chat endpoint, key and model values for your provider, and it names Ollama as one example. The harder parts are usually outside PyRIT: keeping the model server off public networks, setting authentication for vLLM, choosing which models act as objective, adversarial and scoring models, and recording results in a form your compliance team can use. A team with those skills in-house can do the work alone. A team without them may prefer a fixed-scope engagement with written deliverables.
What drives the effort of a self-hosted PyRIT setup?
Effort rises with the number of models, the complexity of the network and the evidence you need at the end. The main drivers are:
- How many models you test, and whether objective, adversarial and scoring roles each run on a different model.
- Network design, including whether Ollama or vLLM sits behind a reverse proxy and how nodes are isolated.
- GPU capacity and how many requests the models must serve at once during multi-turn attacks.
- Authentication, since local Ollama has no built-in authentication and vLLM's --api-key option does not cover every endpoint.
- Evidence requirements, such as memory records an auditor can follow.
Each driver should be written into the scope before work starts so the estimate reflects your environment.
Does running Ollama or vLLM locally cost anything beyond hardware?
Running locally has no license fee in the sources we use, but it still has operating costs. Ollama's pricing page states that running models on your own hardware is always unlimited, while its paid plans cover cloud models. vLLM has no paid edition. Its cost comes from GPU or other accelerator capacity, surrounding infrastructure, implementation and the people who operate it. Ask your team to budget for hardware (one-time or leased), power and cooling, staff time for upgrades (both projects ship releases often), monitoring and backups, and any paid cloud models you still call through a separate account.
How long does a self-hosted PyRIT red teaming setup take?
The duration depends on your environment, and no reliable figure applies across organizations. Time is set by how quickly you can provision compute, obtain network and security approvals, confirm which models and endpoints are in scope, and agree on how results will be reviewed. A single model on an existing server with approved access will take far less time than a multi-model vLLM cluster that needs isolated node networking and a reverse proxy. Ask for a timeline built from a written scope, with each approval and dependency listed as a milestone.
What do we need to provide before the work starts?
You need to provide hardware or cloud capacity you control, network access, and named owners. Specifically, confirm the following before work starts:
- Servers or GPUs where Ollama or vLLM will run, with storage for model files.
- Network approvals for the PyRIT host to reach the model endpoints, and a decision on whether endpoints stay off public networks.
- A named owner for the model servers, another for identity and access, and one for the security findings.
- Approval to send test prompts to the models, including the categories of harm to be tested.
Missing owners are the most common cause of delay, so name them early.
Are Ollama and vLLM secure enough to keep test traffic inside our network?
Both can keep traffic inside your network, but neither should be exposed without controls. Ollama binds to 127.0.0.1 on port 11434 by default, and its local API does not require authentication, so any change to OLLAMA_HOST needs a proxy with access control. The vLLM security documentation says node-to-node communication in multi-node deployments is insecure by default and must sit on an isolated network. It also warns that --api-key does not protect /metrics, /health or several other endpoints, and recommends a reverse proxy that allowlists only the endpoints users need. Confirm these settings with your security team before any adversarial prompts are sent.
How do the results feed compliance evidence?
PyRIT stores conversations and scores in SQLite or Azure SQL memory, which gives you a record of what was tested, with which model and what the scorer decided. Those records can support evidence for frameworks such as the EU AI Act or NIST AI RMF, but the framework owner decides what counts as sufficient. DeployOpen prepares systems, controls and evidence for compliance assessments; it does not issue audit reports, attestations or certifications. Independent auditors and certification bodies do that work. Ask early which controls the evidence must support, so the test plan, model versions, configuration and memory exports are recorded in a form the assessor can follow.
Which open-source model versions should we pin for repeatable test runs?
Pin the exact server version and model build for every test run, because both projects release often. Ollama shipped v0.40.5 on 14 October 2026 and published v0.40.6 as a pre-release on 16 October 2026. vLLM has moved to new minor releases about every two weeks, from v0.28.0 on August 26 to v0.31.0 on October 5, 2026. Record the version of PyRIT as well, since PyRIT v1.1.0 was released on 4 September 2026. Without pinned versions, a later rerun may not reproduce earlier results, which weakens the evidence trail.
How DeployOpen works on this
DeployOpen plans and runs red teaming of self-hosted Ollama and vLLM models inside your own network, so the objective, adversarial and scoring models stay off public APIs. We agree the scope in writing before work starts, then build, test, document and hand over the setup for your security and compliance teams to review.
How we scope
- Engagements are fixed-scope, with the models, endpoints and PyRIT roles to test agreed in writing before work starts.
- The written scope names which Ollama or vLLM endpoints are in bounds, and which models serve as target, attacker and scorer.
- We confirm your network boundaries, egress rules and whether any cloud features of Ollama must be turned off for testing.
How we build
- We configure PyRIT's OpenAI chat target against your internal endpoints, with keys, model names and base addresses kept out of source files.
- We check that vLLM's /metrics and management routes are reachable only from approved hosts, since the API key option does not cover them.
- We run the agreed attack strategies and scorers, recording conversations in PyRIT memory so each run can be reproduced.
How we hand over
- You receive a findings report with reproduction steps, affected endpoints, scorer results and suggested fixes for each issue.
- We document the deployment: model storage locations, concurrency settings, network paths and the PyRIT configuration used for each run.
- We retest the agreed fixes and record the results, so your compliance team can trace what was tested and what changed.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer, covering new Ollama and vLLM releases as they ship.
- A retainer can cover re-running the test suite when you change models, quantizations, GPU capacity or PyRIT versions.
- Ask any provider for a written quote that lists the scope, deliverables, retest terms and what recurs after the first engagement.

