How LiteLLM with self-hosted vLLM models gives teams one governed endpoint
If you run or plan vLLM on your own GPUs, the goal is usually simple: callers should reach those models through the same virtual keys, budgets and request logs that govern your hosted providers. LiteLLM makes that possible by calling vLLM's OpenAI-compatible server through the hosted_vllm/ route. In practice, each self-hosted model is registered in the LiteLLM model list with that prefix and an api_base that points at your vLLM server. The route supports /chat/completions, /embeddings, /completions, /rerank and /audio/transcriptions, so teams can keep one request format across generation, retrieval and transcription. Confirm the exact parameters for each endpoint in the LiteLLM vLLM provider documentation before you publish model entries, since LiteLLM routes can change between releases. Also avoid the older vllm/ SDK route for new work, because LiteLLM has deprecated it.
Be clear about what the software costs. vLLM is licensed under Apache-2.0 and has no paid edition, so the license itself adds no fee. The recurring costs come from accelerator capacity (NVIDIA CUDA, AMD ROCm or Intel XPU GPUs, depending on what you buy), the servers, storage and networking around them, and the engineers who upgrade, monitor and troubleshoot the serving stack. vLLM ships new minor releases about every two weeks, so plan a regular upgrade and model-compatibility check rather than a one-time install. When you request a quote for an implementation, ask the partner to separate one-time work (model onboarding, gateway configuration, GPU node setup) from recurring work (upgrades, capacity changes, on-call coverage), and to state which of those items sit outside the license fees.
Decide early how the vLLM endpoints will be exposed, because the gateway does not close that gap for you. The vLLM security documentation says the --api-key option protects only the /v1, /v2, /inference and /cohere paths, not /metrics, /health, /pause or /invocations, and it recommends placing a reverse proxy in front that allowlists only the endpoints users should call. Keep the vLLM servers on a private network reachable only from the LiteLLM proxy, and treat multi-node traffic as unauthenticated and unencrypted unless you isolate it. Then confirm, in your own environment, that every path a caller could reach is either intended or blocked. Your security team should also decide whether vLLM's Prometheus metrics at /metrics feed your monitoring stack, since those metrics expose operational detail that should stay inside your network.
What you need before connecting vLLM to LiteLLM
Connecting vLLM to LiteLLM touches four layers: the inference servers, the gateway and its data stores, the network between them, and the exposure of each vLLM endpoint. Settle each layer before you add the first route, because the gateway inherits any gap in the layers beneath it.
Running vLLM server and accelerator
Each replica needs a working vllm serve process on an accelerator backend that matches your hardware: NVIDIA CUDA, AMD ROCm, Intel XPU or CPU. Confirm that the model loads, answers a request from the server host, and reports the throughput you expect before LiteLLM sends it traffic. Record the GPU model, driver and memory per replica, because these limit which models and context lengths each replica can serve.
Pinned vLLM version
vLLM ships new minor releases about every two weeks, so pin an exact version in your image or package set rather than tracking the latest tag. Check the release notes for changes to the OpenAI-compatible endpoints and flags before each upgrade, and retest the model and route after every change. Confirm the exact version you run against the vLLM release page you use.
- Minor release cadence
- About 2 weeks
LiteLLM proxy and PostgreSQL
The gateway needs PostgreSQL as its primary database, because virtual keys, budgets and spend records all depend on it. Plan the database before you add vLLM routes so that keys and cost history survive redeploys. Confirm the LiteLLM version you deploy against its release page, and keep the master key in a secret manager.
LiteLLM production guideRedis for multiple proxy instances
Once more than one LiteLLM proxy instance runs, Redis 7.0 or newer holds shared rate limits, router state and cache. A single proxy can start without it, but a second instance without shared state gives each replica its own view of limits and cooldowns. Confirm the Redis version your platform team supports before you scale out the gateway.
Network paths to each replica
The gateway must reach every vLLM replica on its serving port, and nothing else should reach those ports. Map each source and destination pair, including health checks and metrics scrapes, and confirm DNS names resolve from the gateway subnet. Multi-node vLLM deployments communicate between nodes without authorization or encryption by default, so those nodes need an isolated network of their own.
vLLM security docsReverse proxy in front of vLLM
The --api-key option does not protect every endpoint, so vLLM should sit behind a reverse proxy that allowlists only the paths your users and the gateway need, such as the OpenAI-compatible /v1 routes. Deny /metrics, /health, /pause and /abort_requests to general traffic, and expose metrics only to your monitoring network. Test the allowlist from outside the gateway subnet before go-live.
How to configure the hosted_vllm/ route step by step
This sequence takes a vLLM server from a single local test to a load-balanced, budget-governed route in LiteLLM, with a check at each stage so a failure is caught where it starts. The result is a model group that callers reach through virtual keys, with self-hosted models carrying zero cost and hosted API fallback in place.
Start vLLM on each replica
The platform or ML operations team starts the model on every GPU host with vllm serve, setting the model name, port and, if used, the --api-key value that callers will present. Run each replica on its own address and keep the GPU host on an isolated network segment, since the vLLM security docs treat inter-node traffic as insecure by default. Done means each replica starts, loads the model and logs that it is listening on its port without memory errors during model load.
Confirm the endpoints respond locally
From the GPU host itself, call the /v1/models endpoint and then send a small request to /v1/chat/completions using the model name returned by the first call. Repeat the check on every replica, because a single healthy replica can hide a misconfigured neighbor. Done means each replica returns the served model name and a completion, which proves the server works before LiteLLM is involved and separates model faults from gateway faults later.
Add the model with the hosted_vllm/ prefix
The gateway administrator adds an entry to the LiteLLM proxy configuration with the model set to hosted_vllm/ followed by the served model name, and sets api_base to the replica address or to a reverse proxy that exposes only the endpoints users need. Keep the URL in configuration rather than hard-coding it in client applications. Done means the proxy starts without configuration errors and the model appears in the model list for the master key.
Store secrets in a secret manager
The platform team moves LITELLM_MASTER_KEY, which must start with sk-, and any vLLM --api-key value into a secret manager rather than plain configuration files or shell history, and injects them into the proxy and vLLM processes at start time. Rotate the vLLM key through the same path so the proxy and the servers change together. Done means the configuration file contains references instead of literal values, and a proxy restart picks up the secret without manual edits.
Set zero-cost pricing with custom pricing
The FinOps or gateway owner defines custom pricing for the self-hosted model with a zero input and zero output cost, so requests to it do not count against team or key budgets. Remember that the GPU capacity is still a real cost, so track it through infrastructure accounting rather than gateway spend. Done means a test request to the model logs a spend value of zero in the proxy, and a key with a small budget can keep calling the model after its budget is otherwise exhausted.
Test through the proxy with a virtual key
Create a virtual key restricted to the new model, then send a chat completion request to the proxy using that key and the OpenAI-compatible request format. Include a request that the key should be refused, such as a model it is not allowed to use, to confirm that restrictions apply. Done means the permitted request returns a completion, the refused request is rejected, and the request appears in the proxy logs with the key and model recorded.
Add load balancing and fallback
Add the second and later replicas under the same model name so the router spreads requests across them, and choose a routing strategy after reviewing the recommended simple-shuffle default against your latency needs. Then add a hosted API deployment as a lower-priority fallback, with retries and cooldown settings reviewed by the engineers who run the cluster. Done means that stopping one replica shifts traffic to the others without client errors, and that stopping all replicas sends requests to the fallback model and logs the change.
How load balancing across GPU replicas works in LiteLLM
In LiteLLM, load balancing across vLLM replicas happens at the router, and it works by giving every replica the same model_name in the proxy configuration. Each entry points to one vLLM server through the hosted_vllm/ route and its own api_base, and the router treats the entries that share a name as one deployment group. A caller sends a request for that model name once and never sees which replica answered. The router's simple-shuffle strategy is the recommended default and spreads requests across the group. The other strategies are usage-based, latency-based, least-busy and cost-based. Each one changes how the router chooses a replica, so the choice should follow the traffic you actually expect, such as long generations, bursty batch jobs or many short chats.
Parallelism inside vLLM is a separate concern from LiteLLM routing. Tensor parallelism splits one model across the GPUs in a node, and pipeline parallelism spreads it across nodes. Both happen inside a single vLLM endpoint, so LiteLLM sees one server. The gateway therefore needs one api_base per replica group, not one per GPU or per node. If a replica spans several nodes, the nodes must be isolated on their own network, because vLLM's security documentation says inter-node traffic is insecure by default. Confirm the vLLM endpoint address and any proxy in front of it before adding it to the group, since LiteLLM can only balance across the URLs it is given.
The router also retries failed calls and places a replica in a cooldown after repeated failures, so a crashed or overloaded GPU server is removed from rotation for a period. Test this with a deliberate stop of one replica during a load test. Confirm the retry count, cooldown behavior and fallback order in the LiteLLM routing documentation for your release, then watch the request logs to see whether callers saw errors. Choose the strategy by measuring two or three candidates on your own traffic pattern, and confirm the settings for your LiteLLM version before rollout.
Which LiteLLM settings map to vLLM model names, endpoints and costs
This table maps each LiteLLM configuration field for a vLLM model to the value it needs and the mistake teams usually make. Read it while writing the model_list entry, so callers, replicas, keys and budgets all point at the same model.
| Setting | What to set | Common mistake |
|---|---|---|
| model_name | The caller-facing alias, such as a stable name your teams use in requests | Using the vLLM served path here, which couples every caller to the server's model name |
| litellm_params model | The hosted_vllm/ prefix followed by the served model name exactly as vLLM reports it | Using the deprecated vllm/ route or omitting the prefix, so LiteLLM picks the wrong provider |
| api_base | One entry per vLLM replica, each pointing at its OpenAI-compatible /v1 address | Pointing at a load balancer that hides replica health, or leaving one replica's address out |
| api_key | The value passed to vLLM --api-key, stored in your secret manager and referenced from LiteLLM | Assuming the vLLM key protects every path, when it does not cover /metrics or /health |
| Supported endpoints | /chat/completions, /embeddings, /completions, /rerank and /audio/transcriptions through the hosted_vllm/ route | Routing an endpoint the vLLM server does not expose for that model, then debugging it as a gateway fault |
| Zero-cost pricing | Custom pricing entries set to zero input and output cost for on-premises models, so budget checks skip them | Leaving the model unpriced, which can produce spend values that do not match what you expect |
| Virtual key model restrictions | The model_name alias, not the hosted_vllm/ path or the vLLM served name | Restricting keys to the vLLM path, so requests are rejected even though the model is allowed |
When to fall back from vLLM to a hosted API and when not to
Fallback to a hosted provider makes sense when your own vLLM capacity is the constraint, either because traffic exceeds what the GPU replicas can serve or because a replica or node is down. In LiteLLM, you define a model group where the vLLM deployments are listed first and a hosted model with the same public name sits at a lower priority. The router uses priority ordering for failover, so requests move to the hosted target only after the local deployments fail or enter cooldown. Confirm the failover conditions you need, including which error types trigger retries and how long a failed deployment stays out of rotation, against the routing documentation.
- Priority ordering: Keep local vLLM deployments at the top of the failover order so the hosted API is a true last resort.
- Cooldown behavior: Check how long a failing replica is removed from rotation before traffic returns to it.
- Capacity, not quality: Use fallback for availability, and do not rely on it to hide a model that is too slow or too small for the workload.
- Spend exposure: Every request that spills over is billed by the hosted provider, so set budgets on the fallback key or team.
- Test the failover path: Stop one replica in a non-production environment and confirm where requests land.
Before enabling this path, confirm with your data classification owner that the prompts covered by this model group are allowed to reach the hosted provider.
A second case is a model that your team does not host on vLLM at all, for example a frontier model that is only offered as a hosted API. Here the hosted route is not a fallback but a separate model choice, and it should be exposed under its own name so callers and budgets can tell the two apart. Keep the hosted model out of the private model group so that a local outage never silently changes which model answers a request. Each hosted provider brings its own pricing, rate limits, regional availability and data-handling terms, so the cost and compliance review belongs to that provider, not to the vLLM deployment.
- Separate names: Expose hosted models under distinct model names so applications know which system they are calling.
- Provider terms: Read the provider's data use, retention and region terms for the specific model and plan you buy.
- Pricing configuration: Confirm that LiteLLM has accurate pricing for the hosted model so budgets and reports match the provider invoice.
- Access limits: Restrict the hosted model to the keys and teams that have a documented need for it.
- Model behavior drift: A hosted model can change under the same name, so record the version your applications depend on where the provider allows it.
Ask the provider to confirm, in writing, the retention and training terms that apply to API traffic on your agreement before any team sends data to the model.
Some prompts must never leave the private environment, for example records that your data classification places in a restricted tier. For these workloads, the correct configuration is no fallback at all. The model group should contain only private vLLM deployments, and the key used by those applications should be restricted to those models so that a misconfigured route cannot send traffic elsewhere. If local capacity fails, the request should fail with a clear error and not be retried against an external endpoint. This keeps the availability trade-off explicit and gives the security team a configuration they can review.
- No hosted entries: Leave hosted providers out of the model group serving restricted data, rather than relying on a later code change to avoid them.
- Key restriction: Limit each key to the private model names so that a request for a hosted model is rejected at the gateway.
- Visible failure: Return an error the application can handle, and alert the platform team when local capacity is exhausted.
- Separate groups: Keep restricted and general workloads in different model groups and different keys to reduce the chance of cross-routing.
- Review on change: Re-check the routing config each time a new deployment or hosted route is added.
Before you go live, ask the team that owns your data classification to sign off on the exact model names and keys allowed to handle each tier.
Securing the vLLM endpoints behind the gateway
A vLLM server is only as protected as the endpoints it exposes and the network it sits on. The cards below cover which routes the API key actually guards, how a reverse proxy should narrow what the gateway and users can reach, and where node-to-node traffic and metrics need isolation. Each one is a check to complete before LiteLLM routes production traffic to the replicas.
The API key does not cover every route
The --api-key option does not protect every endpoint. It guards the /v1, /v2, /inference and /cohere paths, but not /invocations, /pause, /resume, /abort_requests, /metrics or /health. Treat the key as one layer, not the perimeter. Before go-live, list every route the server exposes and confirm which ones the key protects, using the vLLM version your replicas run.
vLLM security docsAllowlist only user-facing endpoints
vLLM's security guidance recommends a reverse proxy that allowlists only the endpoints meant for users. In this design the LiteLLM gateway is the main client, so the proxy should pass the chat, completions, embeddings and other routes LiteLLM calls, and reject control routes such as /pause, /resume and /abort_requests. Test the allowlist with direct requests to each blocked path and confirm they fail from outside the gateway's network.
Isolate multi-node communication
In multi-node runs, node-to-node traffic is unauthenticated and unencrypted by default, with no authorization or encryption between nodes. Place the nodes on an isolated network segment that only cluster members can reach, and keep it off the network that serves the LiteLLM gateway. Ask your platform team to confirm the segment's firewall rules before the Ray or multiprocessing backend starts.
Keep metrics internal
The /metrics endpoint exposes request counts, token throughput, latency histograms and KV cache use, which reveal workload patterns and capacity limits. It is not covered by the API key. Expose it only to your Prometheus scraper on an internal address, block it at the reverse proxy, and confirm that the scrape job reaches it over the cluster network rather than through the gateway's public path.
Store LiteLLM and provider keys in a secret manager
The LiteLLM master key, which must begin with sk-, and the API keys that LiteLLM uses to reach each vLLM replica should live in a secret manager, not in the proxy configuration file or environment variables committed to source control. Rotate the master key on a schedule your security team sets, and record who can read the secret. Confirm that the replica API keys differ per environment.
How a request moves from caller through LiteLLM to vLLM replicas
The request starts at a caller holding a virtual key, which LiteLLM checks against budgets and rate limits before routing. The router picks one vLLM replica, and the request crosses a reverse proxy that allowlists only user-facing endpoints before reaching the GPU server. Check the boundary between the private network and the gateway, and confirm that replicas accept traffic only from the proxy. If the replicas fail, the router can fall back to a hosted provider, which is the point where data leaves your infrastructure.
Request path from caller to vLLM replicas, with the private network boundary and the hosted fallback branch.
Common vLLM and LiteLLM connection failures and their fixes
This table lists the failures teams most often hit when putting vLLM behind LiteLLM, with the likely cause and the fix for each. Read it when a request fails, when a replica seems to be ignored, or before exposing the vLLM server to users. The main takeaway is that most failures trace to three places: the route prefix, the base URL and model name, and endpoints or budgets that were left at their defaults.
| Failure | Likely cause | Fix |
|---|---|---|
| Requests fail with an unknown provider or wrong endpoint | The model is configured with the deprecated vllm/ SDK route instead of hosted_vllm/ | Change the model entry to the hosted_vllm/ prefix and confirm the route in LiteLLM's vLLM provider documentation |
| 404 or connection errors on every call | api_base is missing the /v1 path that vLLM's OpenAI-compatible server exposes | Set api_base to the full base URL ending in /v1 and test the endpoint directly with a chat completion request |
| Model not found from vLLM | The model name in LiteLLM does not match the name vLLM was started with | Compare the model entry with the served model name in the vllm serve command and align them exactly |
| 401 or 403 from the vLLM server | The vLLM --api-key value is not passed through LiteLLM, or the key was rotated on one side only | Store the key in the LiteLLM model configuration or secret manager, rotate both sides together, and verify with a direct call |
| Traffic goes to some replicas but errors appear intermittently | A dead GPU replica is in cooldown, so the router skips it while others keep serving and the failure stays hidden | Check router cooldown state and per-replica health, then fix or remove the failing server and review cooldown settings |
| Budget blocks on a model that runs on your own hardware | No zero-cost pricing is set for the local model, so LiteLLM charges it against the team or key budget | Add custom pricing with zero input and output cost for the local model entry, then confirm spend stays at zero in test requests |
| Users can reach /metrics, /health or admin paths on the vLLM server | The --api-key option does not cover these endpoints, so they stay open on the network | Place a reverse proxy in front of vLLM that allowlists only the endpoints users need and restrict network access to the GPU nodes |
| Multi-node replicas fail or behave inconsistently | Node-to-node traffic is unauthorized and unencrypted by default | Place multi-node vLLM nodes on an isolated network segment and confirm the configuration against vLLM's security guidance |
Questions teams ask before connecting vLLM to LiteLLM
What drives the cost of running vLLM behind LiteLLM?
The largest cost is accelerator capacity, because vLLM has no paid edition and its cost comes from the GPUs or other accelerators it runs on. Cost then grows with the number of replicas, the model sizes you serve, and the surrounding infrastructure such as networking, storage and monitoring. Implementation and operating staff are a further cost. LiteLLM itself is licensed under MIT for most of its code, with enterprise/ content under a separate license, so the gateway software is not a per-token fee. Ask any partner for a quote that separates one-time work (design, build, testing, handover) from recurring work (upgrades, monitoring, model changes) and that lists the accelerator hardware assumed. Confirm the hardware pricing with your cloud or data center team, since it varies by environment.
Can our own team connect vLLM to LiteLLM without outside help?
Yes, a team with Linux, container and GPU operations experience can do the connection itself. The LiteLLM side is a configuration entry that uses the hosted_vllm/ route and an api_base pointing at your vLLM server. The harder work is usually operational: running vLLM reliably on GPUs, setting up a reverse proxy that exposes only the endpoints users need, handling multi-node networking, and keeping the stack current as vLLM ships new minor releases about every two weeks. Ask yourself whether you have on-call capacity for GPU hosts and whether someone will own model compatibility testing. A partner can take over design, build and handover, or run a retainer for upgrades and testing.
How long does a vLLM and LiteLLM connection take?
The duration depends on your environment and model count more than on the LiteLLM configuration itself. Factors that extend the work include the number of GPU hosts and replicas, whether multi-node serving is needed, the state of your existing Kubernetes or VM platform, how many models and endpoints must be registered, and how much load and failover testing you require. Procurement of accelerators and network changes often take longer than the software work. Ask for a written scope with phases and milestones before committing, and treat any duration without a stated scope as an assumption to test.
What do we need to provide before the work starts?
Most delays come from access and approvals, so gather these early:
Do we need LiteLLM Enterprise to use SSO with the admin UI?
It depends on the number of users. According to LiteLLM's documentation, from v1.76.0 SSO is free for up to 5 users, and an Enterprise license is needed beyond that. The admin UI supports SSO with Google, Microsoft Entra ID, Okta and generic OIDC providers. Enterprise also adds SCIM, JWT authentication with identity provider tokens, audit logs, organization and team RBAC and IP allowlisting. Confirm the current limit and terms with LiteLLM before purchasing, because licensing terms change between releases. Note that SSO for the admin UI is separate from how vLLM itself authenticates callers, which you still need to design.
Could a fallback to a hosted API send our data outside our environment?
Yes, if you configure it that way. LiteLLM's router can fail over from a self-hosted vLLM deployment to a hosted provider, so any request that falls back leaves your infrastructure and goes to that provider under its terms. Control this with explicit routing rules: restrict which keys or teams may use fallback routes, mark data classes that must never leave, and review fallback logs. Confirm with your privacy and compliance teams which providers and regions are approved, and check that the provider's contract covers the data you send. Zero-cost pricing for vLLM models only affects budget checks, not data handling.
How should we secure the vLLM endpoints LiteLLM calls?
Treat the vLLM API key option as one layer, not the full control. According to vLLM's security documentation, the --api-key option protects endpoints under /v1, /v2, /inference and /cohere, but not endpoints such as /metrics, /health or /pause. The documentation recommends a reverse proxy that allowlists only the endpoints meant for users. Also place nodes in a multi-node deployment on an isolated network, because inter-node communication is insecure by default. Keep LITELLM_MASTER_KEY in a secret manager, and confirm that /metrics is reachable only by your monitoring system.
How DeployOpen works on this
DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside your own infrastructure. For a vLLM behind LiteLLM integration, we start from the models you serve, the endpoints your callers need and the controls your security team will review, then build the gateway and inference servers together.
How we scope
- Inventory the vLLM models, GPU hosts and endpoints that callers need, and confirm which ones must stay off the network.
- Agree in writing which hosted APIs, if any, serve as fallbacks and which budgets and keys apply to each team.
- Confirm the target platform, Kubernetes or VM layout, PostgreSQL and Redis hosting, and who operates each component after go-live.
How we build
- Configure hosted_vllm/ routes, zero-cost pricing for on-premises models and fallback order to hosted APIs in version-controlled config.
- Place vLLM endpoints behind a reverse proxy that exposes only the paths users need, then test the allowlist from the caller side.
- Test replica load balancing, cooldowns and failover under load, and check that budgets and spend logs reflect the agreed behavior.
How we hand over
- Deliver the configuration, network diagrams, runbooks for restarting replicas and rotating keys, and a record of tests performed.
- Walk your platform, security and finance teams through how spend is recorded for free self-hosted models and where logs are stored.
- Document upgrade steps for both LiteLLM and vLLM, including which release lines you have agreed to track.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer, scoped separately from the initial engagement.
- Retesting after vLLM or LiteLLM upgrades confirms that routes, endpoint exposure and budget behavior still match the written scope.
- Ask for a quote built from the written scope, including which parts are one-time work and which recur under a retainer.

