Haystack pipelines on self-hosted vLLM

Haystack reaches a self-hosted vLLM server through its OpenAI-compatible endpoints, so the work is configuration, network placement and access control. This page covers the method, prerequisites, setup sequence and failure points.

On this page

How Haystack pipelines connect to self-hosted vLLM for generation and embeddings

A team running Haystack retrieval and generation that needs its model calls to stay inside its own infrastructure can connect Haystack to a self-hosted vLLM server through its OpenAI-compatible endpoints. The base URL is the single change that points Haystack at vLLM: the generator and embedder components call /v1/chat/completions, /v1/completions and /v1/embeddings on the vLLM server instead of a hosted API. The vLLM server exposes these endpoints when started with vllm serve, and the vLLM online serving documentation describes the request formats Haystack relies on. The vLLM documentation also lists Haystack among its framework guides, so the integration path is documented by the project rather than assembled from workarounds.

The vLLM server also exposes rerank and score endpoints. This page does not cover them, because the pipelines in scope use generation and embeddings. Confirm the exact endpoint paths and request fields against the vLLM version you deploy, since the server adds endpoints between minor releases. Two configuration points need a decision before the first pipeline runs. The generator must target a model name that matches the name vLLM serves, and the chat generator depends on the model having a chat template, or on a template supplied with --chat-template. The embedder must target a model that vLLM serves as an embedding (pooling) model, not a generative model, or the /v1/embeddings calls will fail or return vectors your index cannot use.

Placement decides the security posture. Haystack and vLLM should sit on the same private network segment, with the generator and embedder calls never leaving that segment and only the Haystack application reachable by users. The vLLM --api-key option does not protect every route, so the endpoints Haystack uses should sit behind a reverse proxy that allowlists them. Before go-live, run a test query through each component and confirm that a request from outside the allowed network is refused. Document the base URL, model names and key handling in the deployment record so that the team operating the pipelines can change them without redeploying the retrieval code.

What you need before connecting Haystack to vLLM

A Haystack pipeline on self-hosted vLLM depends on five things lining up: a pinned server version, accelerator capacity, a Haystack release with the right components, a chat template and an embedding model on the server, and a network path that stays inside your boundary. Confirm each one before writing pipeline code, because a mismatch in any of them usually shows up as a failed request rather than a clear error.

Pin the vLLM server version

vLLM ships new minor releases about every two weeks, so the version you test against today may not be the one you run in production next month. Choose one release, record it in your deployment manifest, and confirm the exact tag against the GitHub releases page before you install. Recheck the release notes for changes to the OpenAI-compatible endpoints your pipelines call, and treat any upgrade as a retest of the Haystack pipeline, not just a server restart.

Minor release cadence
About 2 weeks
vLLM releases

Confirm accelerator capacity

vLLM runs on NVIDIA CUDA, AMD ROCm and Intel XPU GPUs, on CPUs including x86, ARM AArch64, Apple silicon and IBM Z, and on other accelerators through third-party hardware plugins. Check the vLLM installation docs for the exact combination of driver, operating system and hardware your chosen version supports. Size the GPU memory for the chat model and the embedding model together if both run on the same host, since Haystack retrieval calls will hit both during each query.

vLLM installation docs

Match the Haystack components

Haystack reaches vLLM through its OpenAI-compatible generator and embedder components. Confirm in the Haystack release you plan to use that these components exist, that they accept a custom api_base_url, and that they pass model names exactly as vLLM registered them. Pin the Haystack and integration package versions together, and record which ones passed your retrieval and generation tests.

Provide a chat template

vLLM serves the chat completions API only when the model has a chat template, either built into its tokenizer configuration or supplied with the --chat-template option. Generator components that send chat messages will fail or produce malformed prompts without one. Before connecting Haystack, send a test chat request to /v1/chat/completions with the same system and user message structure your pipeline uses, and check that the response follows the expected turn format.

Serve an embedding model

Retrieval pipelines need an embedding model that vLLM serves through its pooling model support and the /v1/embeddings endpoint. Not every model that works for generation works for embeddings, so confirm the model type in the vLLM supported models documentation and in your model card. Record the output vector dimension and make sure it matches the index in your document store, because a mismatch will not fail at startup and will quietly reduce retrieval quality.

Plan the network path

The Haystack host and the vLLM server should talk over a private network segment, with only the endpoints your pipelines call exposed. The vLLM security docs say the --api-key option does not cover /metrics, /health or several control endpoints, and recommend a reverse proxy that allowlists user-facing routes. Decide where that proxy sits, how TLS terminates, and whether the Haystack host can reach /metrics for monitoring without the rest of the network doing the same.

vLLM security docs

Configuration sequence for Haystack and vLLM

This sequence takes a self-hosted vLLM server from first start to a working Haystack retrieval and generation pipeline, with a check at each stage so faults are found before the pipelines depend on them. It produces an indexing pipeline that embeds documents through vLLM and a query pipeline that generates answers from retrieved passages.

  1. Start the generation model server

    The platform team starts vllm serve with the chat model that will generate answers, on the accelerator host planned for it, and sets the API key with the --api-key option. Bind the server to the internal interface only and confirm that the chat template for the model is present, because the chat completions endpoint needs one. The step is done when the server log reports that the API server is running and a local request to /v1/chat/completions returns a response.

  2. Start the embedding model server

    Start a second vLLM instance, on a separate process or host, with an embedding model that runs as a pooling model, and serve it through the same OpenAI-compatible server. Keep it on its own port or instance so that embedding traffic from bulk indexing does not compete with interactive generation. The step is done when a local request to /v1/embeddings returns a vector whose length matches what the indexing team has recorded for that model.

  3. Confirm the model list from the Haystack host

    From the host where Haystack will run, call /v1/models on each vLLM endpoint using the same API key that Haystack will use. Confirm that each server lists the exact model identifier the pipeline code will request, since a mismatch is the most common cause of a failed first call. Also confirm that the network path is open from the Haystack host to the vLLM ports and closed from everywhere else. The step is done when both endpoints return their model names over that path.

  4. Run a test call from the Haystack host

    Send one short chat request and one short embedding request from the Haystack host, outside any pipeline, using a plain OpenAI-compatible client with the base URL and key. Compare the responses with the local checks from the server hosts to rule out network or proxy problems. The step is done when both calls succeed from the Haystack host and the returned embedding length matches the earlier local check.

  5. Configure the OpenAI-compatible components

    In the Haystack project, set the base URL for the embedder and the generator to the vLLM endpoints, and load the API key from a secret store rather than from source files. Set the model name on each component to the identifier confirmed in the model list. Keep the two components configured separately so each points at its own server. The step is done when the configuration loads without error and each component reports the model name it will send.

  6. Build the indexing pipeline

    Build the indexing pipeline with document conversion, splitting, the embedder component pointed at the embedding server, and a document writer for the chosen store. Run it on a small, known set of documents first, so that failures are easy to trace to a single component. The step is done when the run finishes with no errors and the document store reports the expected number of indexed documents with embeddings attached.

  7. Build the query pipeline

    Build the query pipeline with a text embedder pointed at the embedding server, a retriever on the same store, a prompt builder, and a generator pointed at the generation server. Use the same embedding model in both pipelines, because vectors from different models cannot be compared. The step is done when the pipeline graph validates and each component's inputs and outputs connect without warnings.

  8. Run an end-to-end query

    Ask a question whose answer is in one of the indexed documents, then check the retrieved passages, the assembled prompt and the generated answer. Repeat the query on the server logs side to confirm that requests reached both vLLM endpoints and that the metrics endpoint shows the counts you expect. The step is done when the answer cites content from the indexed documents and both servers show the corresponding requests.

Where the embedding and generation calls go

A Haystack pipeline on vLLM makes two different kinds of model call, and they reach the server through different endpoints. At indexing time, each document chunk is sent to the /v1/embeddings endpoint, which the vLLM server serves when the loaded model is a pooling (embedding) model. At query time, the user question is embedded the same way, the document store returns the closest chunks, and the assembled prompt is sent to /v1/chat/completions for generation. Retrieval itself never touches vLLM, so the document store, its index and its own failure modes sit outside the inference path. Before you build, confirm in the vLLM online serving docs that the embedding model you chose is supported as a pooling model on the vLLM version you will pin, and confirm which generation model exposes a working chat template.

The embedding model and the generation model can run on one vLLM server or on two separate instances, and the choice shapes capacity and failure isolation more than it shapes code. On one server, both models compete for the same accelerator memory, so the team must confirm that the generation model's weights and KV cache leave room for the embedding model before it sizes either one. Two instances give each model its own GPUs, its own scaling and its own restart schedule, so an embedding backlog during a bulk re-index does not slow answer generation, and a failed generation instance does not stop indexing. The cost is more accelerator capacity and one more endpoint, base URL and API key to configure in Haystack. Ask the infrastructure owner to confirm the GPU layout for each option and to decide which pipeline components are allowed to fail independently.

Whichever layout you choose, the network path matters as much as the model layout. Both endpoints carry prompts and document text, so the Haystack application, the document store and each vLLM instance should sit on a network segment that only those services can reach, with the vLLM endpoints placed behind a proxy that allowlists the /v1 paths the pipeline actually uses. The vLLM --api-key option is not enough alone, because the security docs warn against relying on it by itself. Plan for the operational checks that follow from this placement: latency for each embedding batch, generation latency per request, and the /metrics endpoint scraped from inside the trusted network only.

How the Haystack host, document store and vLLM servers fit together

The diagram starts with users reaching a reverse proxy that allowlists only the endpoints meant for them. The proxy forwards query traffic to the Haystack host, which calls the vLLM generation server for answers and the vLLM embedding server for vectors, and writes and reads vectors in the document store. The indexing pipeline runs on the same host and feeds the same store. Check that the vLLM servers, the store and the Haystack host sit inside the internal network boundary, and that no path reaches vLLM's unprotected routes from outside.

Query and indexing paths through the proxy, Haystack, the document store and two vLLM servers.

Mapping Haystack settings to vLLM endpoints and models

This table maps each Haystack component setting to the vLLM endpoint it calls and the value you must confirm on your own server. Read it before wiring pipelines, because a mismatch in the model name or endpoint path is the most common cause of failed requests. The main takeaway is that the generator and the embedder are separate vLLM endpoints, so each needs its own base URL, model name and dimension check.

Haystack settingvLLM endpoint or valueWhat to confirm in your environment
API base URLRoot of the vLLM server, ending in /v1, for example the address where vllm serve listensConfirm the host, port and /v1 suffix from the server that runs vllm serve, and that the pipeline host can reach it
API keyValue passed to the vLLM --api-key option, checked on /v1 routesConfirm the key is stored in your secrets manager, not in pipeline code, and that a reverse proxy also restricts access
Generator model nameMust equal the model identifier that vllm serve loaded, sent with /v1/chat/completionsConfirm the exact served name by calling the models list on the server, since a path or alias mismatch returns errors
Generator chat templateChat completions need a chat template in the model or one supplied with --chat-templateConfirm the model serves chat requests with a test call before wiring the generator into a pipeline
Generation options (max tokens, temperature)Passed as request fields to the chat completions endpoint and bounded by the server's context lengthConfirm values with your team's latency and output targets, and test long prompts that retrieved context can make large
Embedder model nameMust equal the pooling model served with vllm serve, called on /v1/embeddingsConfirm the embedding model is loaded as a pooling model on the same or a separate server, not only as a chat model
Embedding dimensionSet by the embedding model, not by vLLM, and must match the document store indexConfirm the output vector length from one test request and set the store index to that value before indexing
Reranker endpoint (if used)vLLM exposes rerank and score endpoints, which are separate from /v1/embeddingsConfirm the reranker is served and that your Haystack component calls the endpoint your server provides

Securing the Haystack to vLLM path

The Haystack to vLLM path touches a model server, a document store and a Haystack host, and each has its own exposure. The cards below cover the controls that connect them, starting with the vLLM endpoints that the API key does not protect.

Scope the API key correctly

The --api-key option protects the /v1 endpoints that Haystack calls, but it does not protect /metrics, /health, /invocations, /pause, /resume or /abort_requests. The vLLM security docs warn against relying on the key alone. Confirm which paths your Haystack pipelines use, then treat every other path as reachable by anyone who can reach the port.

vLLM security docs

Put a reverse proxy in front

The vLLM docs recommend a reverse proxy that allowlists only the endpoints meant for users. For this path, that usually means passing /v1/chat/completions, /v1/completions and /v1/embeddings from the Haystack host and blocking everything else at the proxy. Test the allowlist with requests to the blocked paths, since a proxy that forwards a prefix can expose more than intended.

Keep metrics scoped to monitoring

The /metrics endpoint exposes request counts, token throughput, latency histograms and KV cache use. None of that should be reachable from the Haystack application network. Limit scraping to the monitoring host by source address, and confirm that your Prometheus job is the only client that reads it.

Isolate the Haystack and vLLM network

Place the Haystack host, the embedding and generation traffic, and vLLM on the same isolated network segment, with no route from user networks to the vLLM port. For multi-node vLLM, the docs state inter-node traffic is insecure by default, so that traffic needs its own isolated network. Confirm firewall rules in both directions before any pipeline goes live.

Restrict the document store

Retrieval pipelines hold the source documents that the model reads, so the document store needs the same access scope as the source systems it came from. Limit which service accounts can write to it and which can query it, and record which pipelines read which collections. Retrieved text is sent to vLLM as prompt content, so store access is part of the model's data exposure.

Manage keys outside pipeline config

Keep the vLLM API key, document store credentials and any identity provider secrets out of Haystack pipeline files and version control. Load them from a secrets store at runtime, scope them to one pipeline each, and rotate them on a schedule your security team sets. Confirm that logs and error traces from Haystack do not echo the key value.

Network placement options for Haystack and vLLM

Running Haystack and vLLM on the same machine is the simplest placement. Haystack calls the vLLM server over the loopback interface or a local Docker network, so model traffic never crosses a network segment the organization has to segment or monitor. The trade-off is that both workloads compete for the same CPU, memory and accelerator resources, and a fault in one can affect the other.

  • Latency: Calls stay on the host, so network overhead between the pipeline and the model is minimal.
  • Exposure: Only the port that Haystack needs is reachable, and it can be bound to 127.0.0.1 so the vLLM API is not published to the network.
  • Resource contention: Document processing, indexing and model serving share memory and GPU capacity, so the host needs sizing for both.
  • Operations: One team usually patches the host, the GPU driver and both services, which shortens the change path but concentrates responsibility.
  • Scaling limits: Adding vLLM replicas or moving Haystack to another host later requires a change to its endpoint configuration.

Before choosing this placement, confirm with the vLLM installation documentation which accelerator stack your hardware needs and how much memory the chosen model leaves for everything else on the host.

Common failures when Haystack calls vLLM

This table lists the failures teams most often hit when a Haystack pipeline calls a self-hosted vLLM server, with the cause and fix for each. Read it while testing the pipeline end to end, since several failures look alike from the Haystack side but have different fixes on the vLLM or proxy side.

FailureLikely causeFix
Chat completions failThe served model has no chat template, so vLLM cannot build chat prompts for the chat completions API.Confirm the model ships a chat template. If not, start vLLM with a template via the chat-template option, then retest the chat generator.
Embedding dimension mismatchDocuments were indexed with one embedding model or pooling configuration, and queries are embedded with another, so vectors differ in size or meaning.Use the same embedding model and settings for indexing and querying. Record the model name and output dimension with the index, and reindex after any model change.
Wrong model nameThe model name in the Haystack component does not match the name the vLLM server reports, often after a path or alias change.List the served models from the server, then copy the exact name into the Haystack generator or embedder configuration.
API key rejectedThe key set in Haystack does not match the vLLM --api-key value, or the key was rotated on one side only.Align the key in both places through your secrets store. Test with a single direct request before running the pipeline.
Timeouts under loadLong prompts or many concurrent pipeline runs exceed the client timeout while vLLM queues requests or sits at its KV cache limit.Raise the client timeout for generation, cap concurrent pipeline runs, and watch queue depth and KV cache use on the metrics endpoint before scaling capacity.
Blocked routes at the proxyA reverse proxy allowlist permits only some paths, so /v1/embeddings or /v1/chat/completions returns an error while other calls work.Allow the exact OpenAI-compatible paths Haystack calls, and keep administrative and metrics paths off the user-facing allowlist.

Questions teams ask before connecting Haystack to vLLM

Does running vLLM with Haystack cost money in licensing?

No license fee applies to vLLM itself. vLLM is open source under the Apache-2.0 license and has no paid edition, so the money goes to accelerator capacity, the infrastructure around it, implementation work and the people who operate the stack. Haystack is also open source, so the recurring costs sit in GPUs or other accelerators for the generation model, any separate embedding capacity, storage for the document index, network links and staff time. Ask any partner for a quote that separates one-time implementation from recurring infrastructure and support, and that names the GPU type and count it assumes.

How long does a Haystack and vLLM integration take?

Duration depends on how many pipelines you connect, whether embeddings run on vLLM or elsewhere, how many network zones are involved, and whether the target hosts are already provisioned with accelerators. A single generation pipeline against an existing vLLM endpoint is the smallest scope. Adding a pooling model for embeddings, private network placement for both components, authentication in front of the endpoints and monitoring adds steps, and each needs its own review. Ask for a phased plan in the written scope so that the first pipeline can be tested before the rest of the work starts.

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

Plan to provide four things: the models you intend to serve, with their licenses and approved sources; the network design, including which subnets host vLLM and Haystack, and which users or services may reach each endpoint; the document data and its classification, so the index and its access rules can be designed; and named owners for the GPU hosts, the Haystack application and the security approvals. Haystack pipelines call the vLLM server through its OpenAI-compatible endpoints, so the team also needs to confirm which endpoints the application will use before any firewall rules are written.

Can our own engineers build this without an outside partner?

Yes, a team with Haystack and Linux operations experience can build it, and the vLLM server and Haystack components are both documented for this use. The work most often stalls on accelerator driver setup, model loading, chat template configuration for chat pipelines, and placing the server behind a proxy that allowlists only user-facing endpoints. Consider a partner when the team lacks GPU operations experience, when the deployment must pass a compliance review on a tight schedule, or when the same pattern must be repeated across several applications. Whichever path you choose, agree on who owns the runbook and the upgrade process before go-live.

Why does the integration need an upgrade plan every two weeks?

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, so a deployment left unplanned will drift behind quickly. Each upgrade can change flags, model support, the OpenAI-compatible behavior that Haystack depends on, and the metrics names your dashboards read. Pin the vLLM version in your configuration, test each candidate release against a fixed set of Haystack pipelines and embedding checks in a staging environment, and decide on a cadence you can sustain, such as tracking every release but promoting only selected ones.

Which network placement risks should we review before go-live?

Keep the vLLM server reachable only from the Haystack application and the services that must call it, and do not expose its management endpoints to users. The vLLM security documentation says that the --api-key option does not cover every route, such as /metrics and /health, and recommends a reverse proxy that allowlists only the endpoints meant for users. If the model runs across several nodes, the inter-node traffic is insecure by default and must sit on an isolated network. Confirm these rules with your network and security teams in the design review, not after deployment.

What evidence will the compliance team need from this setup?

Compliance reviewers usually ask where the models run, who can call each endpoint, how requests and logs are retained, and how changes are approved and tested. For this integration, prepare the network diagram, the allowlist at the proxy, the API key and secret handling records, the vLLM version history and upgrade test results, and the Prometheus metrics you collect from /metrics. DeployOpen prepares systems, controls and evidence for compliance assessments, but independent auditors and certification bodies issue the audit reports and certifications, so confirm early which evidence your assessor expects.

Keeping Haystack compatible as vLLM releases change

vLLM ships new minor releases about every two weeks, so a pinned vLLM version is the only thing that keeps a Haystack deployment predictable. The releases listed in the vLLM GitHub repository in late 2026 included 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, which shows how quickly the server behind your OpenAICompatibleGenerator or embedder can change. Pin the image tag or package version in your deployment manifest, record it next to the Haystack version, and treat any move to a newer vLLM tag as a change that needs its own test run before it reaches production.

Each upgrade test should hold the Haystack side constant. Keep the same Haystack release, the same component configuration, the same api_base_url and the same served model name, and change only the vLLM version. Run a fixed set of embedding requests against the /v1/embeddings endpoint and compare vector dimensions, normalization and ranking of a known query set against the stored baseline, because a changed embedding result silently degrades retrieval without raising an error. For generation, run the chat pipeline against a fixed prompt set and check that the response structure, tool-call output and stop behavior still match what your pipeline parses. Confirm the chat template behavior for your model with the release notes of the vLLM version you are moving to, since template handling is one of the areas that changes between versions.

Write the results down as a go or no-go record for each version: the pinned tags tested, the test set version, the differences found and who approved the change. Keep the previous image available so you can roll back, and check the vLLM GitHub releases page on a regular schedule so you learn about new minor versions before they reach your environment. If your team cannot test every two-week release, decide in advance which versions you will adopt, for example by planning a quarterly review, and confirm that decision with your Haystack and vLLM owners.

How DeployOpen scopes and delivers the Haystack and vLLM integration

DeployOpen approaches Haystack pipelines on self-hosted vLLM as a fixed-scope engagement inside your own infrastructure. We agree the pipelines, endpoints, embedding model and network placement in writing before work starts, then build, test, document and hand over the result for your team to operate.

How we scope

  • Inventory the Haystack pipelines, their retrieval and generation steps, and which vLLM endpoints each one calls.
  • Confirm the vLLM version, chat template, embedding model and whether /v1/embeddings runs on a pooling model.
  • Map network placement for Haystack, vLLM, the vector store and the document source, and agree the access paths between them.
  • Write the scope, deliverables and timeline into an agreed document before any build work begins.

How we build

  • Configure Haystack generators and embedders to point at the self-hosted OpenAI-compatible base URL and model names.
  • Set up the vector store, indexing job and retrieval settings against the embedding dimensions the vLLM model returns.
  • Place a reverse proxy in front of vLLM so only the endpoints the pipelines need are reachable from the application network.
  • Test chat and embedding calls end to end, including timeouts, retries and behavior under concurrent pipeline runs.

How we hand over

  • Deliver pipeline code, configuration files and environment settings in your repositories, with the versions pinned.
  • Document the endpoint allowlist, network rules, API key handling and which vLLM metrics to watch at /metrics.
  • Run a walkthrough with your engineers covering pipeline changes, re-indexing and how to point Haystack at a new vLLM version.
  • Provide a runbook for common failures such as missing chat templates, embedding dimension mismatches and unreachable endpoints.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer, scoped separately from the original build.
  • Retesting after vLLM releases or Haystack upgrades, so pipeline behavior is checked before a change reaches production.
  • Ask any quote to state what recurs (retainer, model and infrastructure costs) and what is one-time (build and handover).

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.