Restricting LiteLLM routes and source IP addresses

Learn how LiteLLM route lists and IP allowlists shrink what a self-hosted gateway exposes, what they require from the Enterprise license, and how to roll them out without breaking callers.

On this page

Why restrict LiteLLM routes and source IP addresses

A self-hosted LiteLLM proxy is often reachable from more places, and exposes more endpoints, than its callers actually need. Route lists and IP allowlists reduce that exposure by limiting which paths answer and which source addresses can reach them, and both controls require an Enterprise license. Before you plan either one, confirm with LiteLLM that your edition and license cover them, because the open source build does not include these settings.

LiteLLM's route controls work in three tiers. public_routes lists endpoints that answer without authentication, which should be limited to health and readiness checks used by load balancers and orchestrators. admin_only_routes lists endpoints restricted to proxy administrators, typically key, team and spend management. allowed_routes is an exact list of the routes the proxy exposes at all. Teams that only serve chat completions from applications usually need a short allowed_routes list, while teams that run the admin UI for their own staff need admin_only_routes to keep those paths away from ordinary API keys. Map each route to a caller group before you write the list, and record the reason for each entry so reviewers can challenge it later.

IP allowlisting adds a network check on top of those route decisions. Setting allowed_ips causes the proxy to reject callers outside the listed addresses with a 403 Access forbidden error. This matters most when the gateway sits behind a load balancer or ingress, because the addresses the proxy sees must be the real client or the trusted proxy addresses, and a misconfigured forwarding chain can either block legitimate callers or allow everyone. Confirm how your ingress passes client addresses before you rely on the allowlist. The LiteLLM docs on IP address filtering describe the setting, and the LiteLLM public routes docs cover the route tiers.

How a request passes route and IP checks

The diagram starts with the caller's source IP address, which the proxy checks against allowed_ips first. A caller that is not on the list receives a 403 Access forbidden error and the request ends there. Callers that pass move to route matching, where the requested path is compared with public_routes, admin_only_routes and allowed_routes. Public routes are served without authentication, admin-only routes are limited to proxy admins, and routes in the protected path need authentication. Review each exposed route against the list it belongs to before go-live.

Request path through the IP allowlist and the three route lists.

Route and IP control options and when each fits

This table compares the four Enterprise controls that narrow what a LiteLLM proxy exposes: public routes, admin-only routes, an exact allowed route list and an IP allowlist. Read each row for what the control does, what a non-permitted caller receives and the deployment situation where it fits. All four require an Enterprise license, so confirm entitlement before you plan around them.

ControlWhat it doesWhat a non-permitted caller getsWhen it fits
public_routesLists routes that the proxy serves without authentication.Not applicable for listed routes, since no key is checked. Unlisted routes still require authentication.Health or readiness endpoints that load balancers and monitors must reach without credentials.
admin_only_routesLimits listed routes to callers who hold proxy admin rights.Callers without admin rights are refused access to those routes.Management endpoints such as key, team or spend administration that application traffic should never call.
allowed_routesDefines an exact list of routes the proxy exposes. Anything not on the list is not served.Requests to routes outside the list are refused.Locked-down gateways that only serve chat and embedding calls, with documentation and admin paths removed.
allowed_ipsAccepts requests only from the source addresses or ranges you list. Other callers are rejected.A 403 Access forbidden error.Gateways reachable only from known office, VPN or application subnets, where network position is a required control.
Enterprise licenseRequired for all four controls.Not applicable.Confirm the license terms and entitlement with LiteLLM before you design the route or network policy around these controls.
Combined useRoute lists and IP filtering apply together, so a request must pass both checks.The first failing check determines the response the caller sees.Expose a small route set to a known network, and keep admin routes off the public path.
Swagger and API docsRoute restriction can keep interactive API documentation off the exposed route list.Requests for the docs path are refused when the path is not allowed.Production gateways where the API schema should not be browsable by unknown callers. Confirm the exact docs paths for your version.

How to decide which routes stay exposed

Build the allowed_routes list from observed traffic, not from the route list in the LiteLLM documentation. Start by inventorying every caller: each application service account, CI job, notebook, and developer tool such as coding assistants or chat clients that points at the gateway. For each one, record the paths it calls (chat completions, embeddings, model listing, key checks, and anything it uses for health), the key or user identity it presents, and the network path it uses. Pull this from gateway access logs over a representative period, then ask owners of each caller to confirm the list, because a monthly batch job or an on-call script can be absent from a two-week sample.

Next, separate the three route groups the feature supports. Inference routes serve callers and belong in allowed_routes for the teams that need them. Proxy admin routes, which create keys, teams, users and budgets, should appear in admin_only_routes and be reachable only from the administrators' identity and network. Routes in public_routes skip authentication entirely, so keep that list as short as your health probes require and confirm each entry individually with the security team. The decision is not whether a route is useful; it is whether an unauthenticated caller on the network should ever reach it.

An exact list is only as good as the inventory behind it. A route that no one listed will fail for a real caller, and a route that someone added in haste will stay open indefinitely. Re-run the inventory after every LiteLLM upgrade, since route paths and default behavior can change between releases, and after every new application or tool is onboarded. Confirm current route names against the LiteLLM public routes documentation and your pinned version before you edit the configuration, and keep the approved list in version control so each change has a reviewer and a date.

Setting up route and IP restrictions on the proxy

This sequence moves the LiteLLM proxy from exposing every route to a deliberate list of public, admin-only and allowed routes, with source IP filtering that returns a 403 to callers outside approved networks. Each step ends with a check so the result can be shown to the security team.

  1. Confirm the Enterprise license is in place

    Before any configuration, the platform owner confirms that the deployment holds an LiteLLM Enterprise license, since both route controls and IP allowlisting are Enterprise features. Check the license key against the running proxy and record the version in use. The step is done when the proxy starts with the license applied and the admin UI shows the Enterprise features as active. If the license is missing, stop here, because the configuration keys in later steps will be ignored or rejected.

  2. Capture current callers and source ranges

    The platform team pulls request logs for a representative period and lists every client application, developer tool, service account and admin browser that reaches the proxy, along with its source IP addresses or ranges. Include traffic from CI jobs, batch workloads and load balancers, because a load balancer address will appear in place of the real client unless forwarded client addresses are handled correctly. The output is a reviewed inventory with an owner for each caller, and it is done when no known caller is missing from the list.

  3. Define public, admin-only and allowed route lists

    Using the route controls in the proxy configuration, the team sets public_routes for any endpoint that must answer without authentication, admin_only_routes for administrative endpoints, and allowed_routes as an exact list of the routes that callers need. Anything not on the list is not exposed. Copy the configuration key names from the LiteLLM public routes documentation for the pinned version rather than from older examples. The step is done when the configuration file is committed to version control and a review confirms that every inventoried caller still has the routes it uses.

  4. Hide the Swagger documentation endpoints

    The team removes the interactive API documentation from anything reachable outside the administrative network by keeping the documentation routes out of the allowed list. Confirm the documentation endpoints return an error for an unauthenticated caller from an outside address. This step matters because the documentation shows every route and parameter to anyone who can reach it. It is done when a request to the documentation paths from a non-approved address is refused and the same request from an internal admin host behaves as the team has decided.

  5. Set allowed_ips for approved networks

    The team adds the allowed_ips setting to the proxy configuration, listing the approved corporate egress ranges, VPN pools and CI network addresses from the inventory. Entries should be as narrow as the callers allow. Confirm the exact key name and its CIDR syntax in the LiteLLM IP address filtering documentation for the pinned version. The step is done when the configuration is deployed, the proxy restarts cleanly, and the change record lists each range with the owner who requested it.

  6. Test from an allowed and a disallowed address

    The tester sends the same authenticated request twice, once from an address inside allowed_ips and once from an address outside it, such as a laptop on a home network or a host in a non-approved cloud account. The allowed request should succeed and the disallowed one should be refused. Record both responses with timestamps. The step is done when the allowed call returns a normal response and the disallowed call returns a 403 with an access forbidden message, confirming the filter is applied in front of the routes.

  7. Confirm the 403 response and log the refusals

    The team checks that refused requests return the 403 Access forbidden response and that each refusal appears in the proxy logs with the source address and route. Logs should feed the team's monitoring so that unexpected refusals from real callers, or repeated probes from outside, are noticed. Confirm that the log destination is the one described in the logging setup for the environment. The step is done when a refused request is visible in the log with enough detail to identify the caller.

  8. Retest after each deployment or upgrade

    Each proxy image change, configuration change, load balancer change or LiteLLM version upgrade triggers a repeat of the route and IP tests. Upgrades can change route names, default behavior or configuration syntax, so the allowed and disallowed tests and the documentation check are rerun against the new version before the change is accepted. Keep the test script and its expected results in version control. The step is done when the retest results are attached to the change record and any caller that broke is either fixed or formally accepted by its owner.

Security and operational considerations

Restricting routes and source IPs only protects the gateway if the surrounding setup matches it. The cards below cover the places where a route list or allowlist can quietly fail: documentation endpoints, the proxy's view of client addresses, administrator and health check access, login paths, logging and change control.

Hide Swagger and OpenAPI docs

The proxy serves interactive API documentation by default, which maps every endpoint for anyone who can reach the port. Callers who only send chat completions do not need it. Remove the documentation routes from the allowed list, then request them from outside the permitted network to confirm they return a denial. Keep the docs available to a small internal group if your platform team needs them, and confirm the exact route names against your LiteLLM version before you write the list.

Public routes docs

Confirm the forwarded client IP

An IP allowlist only works if the proxy sees the real caller address. Behind a load balancer or ingress, every request may appear to come from the balancer, so either all callers pass or all fail. Confirm how your ingress sets the forwarded client address header and which proxy hops LiteLLM trusts before you enable allowed_ips. Test with a caller outside the list and check that the 403 comes back, not just a successful internal request.

IP filtering docs

Avoid locking out admins and probes

A route or IP rule that is too narrow can block the administrators who must fix it, along with the health checks your orchestrator uses to decide whether a pod is alive. Before applying a restriction, list every caller that needs access: admin users, CI jobs, monitoring probes, load balancer checks and the Kubernetes probe source. Keep a second admin path, such as a break-glass session from a known network, and test the rollback in a non-production environment first.

Map route lists to SSO and master key

Route restrictions sit beside login methods, so an allowed list that omits a login route can break SSO, and a public route can expose a sign-in path you meant to close. Decide which routes stay public, which are admin only and which are open to all authenticated keys, then check how SSO callbacks and the master key login route behave under that list. Verify each login path with a test account after every change.

Log denied requests to the SIEM

A 403 from an IP rule or a blocked route is a useful signal, because it can show scanning, a misconfigured client or a stolen key being tried from an unexpected place. Make sure denied requests reach your logs with the source address, path and time, then send them to the SIEM that your security team monitors. Ask your team which alerts should fire on repeated denials, and set a retention period that matches your policy.

Manage route lists as code

Route lists and allowed IP ranges change over time, and an unreviewed edit can open an admin route or cut off a team. Keep the proxy configuration in version control, require review for any change to route or address settings, and deploy through the same pipeline as other gateway changes. Record who approved each change and keep a rollback path. Confirm with your platform team where the configuration file is stored and which environments receive each change.

How the controls differ across deployment environments

In a Kubernetes cluster, callers usually reach the LiteLLM pods through an ingress controller or load balancer service, so the address the proxy sees as the TCP peer is often the ingress pod or a node address, not the client. Whether the original client address survives depends on how traffic enters the cluster and how the ingress is configured to pass it along. Confirm with your platform team which address the proxy receives on every path, including internal callers that reach the service directly without passing through the ingress.

  • Peer address: The source IP at the pod is frequently an ingress or node address. An allowlist written against client addresses will match nothing or match the wrong hop.
  • Forwarded headers: Confirm which forwarding headers the ingress sets, whether it overwrites or appends to any value supplied by the caller, and which hop is trusted to set them.
  • Traffic policy: Check whether the service preserves client addresses or rewrites them, since this setting changes what reaches the pod.
  • Internal paths: Pods that call LiteLLM through the cluster service address bypass the ingress, so they need their own entries in the allowlist or a separate route policy.
  • Enforcement point: Enforce the allowlist in LiteLLM only after the source address is proven, and keep a network policy at the cluster layer as a second control.

Before go-live, send requests from an allowed and a disallowed network and confirm the proxy logs the address you expect.

Limits and what to confirm in your environment

The route and IP controls depend on your license, your pinned LiteLLM version and the network layout around the proxy. The cards below list what to confirm before you rely on them, so the controls you document match what the gateway actually enforces.

Enterprise license covers these controls

Both public route lists and IP allowlisting require an Enterprise license. Confirm with LiteLLM that your contract includes these features before you write them into a design or a security review answer. Ask whether the license covers your deployment model and how it is activated in your environment, since an open source deployment will not enforce these settings even if the configuration keys are present.

Enterprise docs

Confirm key names for your pinned version

Key names and matching behavior for public_routes, admin_only_routes, allowed_routes and allowed_ips should be checked against the exact version you deploy, not against memory or a blog post. Test each key in a staging instance and record the result. A route that works in one release may be named differently or evaluated in a different order in another.

Supported minor lines
4
Public routes docs

Network allowlisting in front of the proxy

Decide whether the proxy's own IP filter is enough or whether a load balancer, ingress or web application firewall must also restrict source addresses. The proxy sees the address that reaches it, so if a load balancer terminates connections, the client address may be the balancer's address unless forwarding headers are configured and trusted. Confirm this path end to end with a test from an allowed and a blocked network.

IPv6 and NAT egress coverage

Allowlists are only as complete as the address ranges written into them. Confirm whether your callers reach the gateway over IPv6, and whether office, VPN or cloud NAT egress addresses are listed as ranges or as single addresses. Shared NAT gateways can make many workloads appear as one source, so an allowlist can admit more callers than intended. Document which ranges you list and who owns them.

Swagger docs visibility per route

Confirm how the interactive API documentation behaves once you restrict routes. Check whether the documentation page itself is reachable without authentication, whether it is listed in your public routes, and whether hiding it removes the schema or only the page. Run a request against the docs path from an unlisted address and record the response, since documentation paths are a common gap in route reviews.

Support and SLA terms for Enterprise

Ask LiteLLM which support and response terms apply to your Enterprise license, including whether 24/7 coverage and the response times for critical issues and security patches are included or optional. Ask who in your team receives notices, how security fixes reach you before public release, and what happens to route and IP settings during an upgrade. Put the answers in your contract file.

Security patch response
72 hours

Questions buyers ask about restricting LiteLLM routes

Do route and IP restrictions require the LiteLLM Enterprise license?

Yes. The public route settings (public_routes, admin_only_routes and allowed_routes) and IP address filtering with allowed_ips both require an Enterprise license according to LiteLLM's documentation. The open-source tier does not include these controls, so a team on that tier has no supported setting that limits which routes the proxy exposes or which source addresses can reach it. Confirm the current edition boundaries with LiteLLM before you buy, because the feature list is maintained by the vendor. Enterprise also adds SSO beyond the free user limit, audit logs and RBAC, which often come into the same review. Ask for the license scope in writing, including which deployments and how many instances it covers.

What makes a route and IP restriction take more or less effort?

Effort follows the size of the route inventory, the number of networks that call the gateway, and the number of environments that need matching rules. A gateway that serves a few known applications over one network is a small change. Effort grows when callers sit on many subnets, when developers reach the proxy from laptops or VPNs, when staging and production need different allowlists, or when some clients use routes that were never documented. Each added caller group adds testing. Ask any partner to break the work into route inventory, allowlist design, change rollout per environment and verification, and to show which of those steps scale with your count of networks and environments.

What does the customer team need to provide for this work?

The work needs four inputs from your side. First, the source network ranges you intend to allow, including VPNs, office egress, CI runners and any cloud NAT addresses. Second, a caller inventory listing which applications, SDK clients, developer tools and service accounts call the gateway and which routes each one uses. Third, a list of the admin routes and the people who need them. Fourth, access to the proxy configuration and to the load balancer or ingress that sets client IP headers, because filtering on the wrong address will block legitimate traffic or let everything through. Ask your team to confirm who owns each of these inputs before work starts.

Can an internal platform team restrict LiteLLM routes without a partner?

Yes, if the team has Enterprise access and the skills to change the proxy configuration, test authentication paths and manage ingress. The settings are configuration rather than code, so the main risk is not the change itself but the caller inventory and testing. Teams often miss a route used by a background job, a monitoring probe or a health check, and then an outage appears after rollout. An internal team can reduce that risk by logging requests for a period, mapping them to callers and rehearsing the change in a non-production environment. A partner is useful when the team lacks time, when many networks are involved, or when the change must be documented as evidence for a security review.

How long do testing and rollout usually take, and what sets that?

No duration is fixed by the vendor documentation, so treat any timeline as something to agree in writing. The main drivers are the number of caller groups to verify, the number of environments that must be tested in sequence, and whether a change window is required in production. Rollout also waits on the network team if allowlists need firewall or load balancer changes. Plan for a staged approach: apply allowed_ips and allowed_routes in a test environment, verify each caller group with a successful and a rejected request, then move to production with a rollback plan. Ask for the proposed sequence and the verification evidence, not just a date.

How do route restrictions fit into LiteLLM upgrades?

Route and IP settings live in the proxy configuration, so each upgrade needs a check that they still behave as intended. Before moving to a newer release, retest the public, admin-only and allowed route lists, because new endpoints or changed paths can fall outside an exact allowed_routes list and break callers or expose admin paths. Keep the route list and allowlist in version control with the deployment configuration so the same rules apply after an image change. Your upgrade plan should include a route regression test that runs against each candidate version, and it should be repeated after any change to the ingress or the source address headers.

Does restricting routes also hide the Swagger documentation?

Hiding the interactive API documentation is part of the same review, because an exposed docs page tells outsiders which routes exist. Whether a given LiteLLM version hides Swagger through the route settings should be confirmed against the current configuration reference for your release, not assumed. Test it directly: request the docs path from an unlisted network and confirm the response, then confirm that authorized callers still reach the endpoints they use. Record the result as part of your change evidence.

Rolling out restrictions without breaking callers

Roll out route and IP restrictions in stages, starting in a non-production environment that mirrors your production gateway configuration. Turn on the controls there first, with allowed_ips and allowed_routes set to the same values you plan to use in production, and run the full set of applications, SDK clients and developer tools against it. The goal is to find out which callers break before any user does. Because allowed_ips and the route lists are Enterprise features, confirm with your LiteLLM account team that the license covers every environment where you test, and confirm the exact configuration keys against the LiteLLM docs: IP address filtering page for the release you run.

Before enforcing anything, log denied requests so you can see what would be blocked. A caller that is refused by the gateway usually fails with a 403 and the message Access forbidden, which often appears in application logs as a generic upstream error rather than an authorization failure. Search those logs for 403 responses from the gateway hostname, group them by caller and route, and treat each group as a decision: add the route or address to the allowlist with a named owner, or fix the caller. Expect gaps in your route inventory. Developer tools, IDE plugins and chat clients often call model listing, health or documentation routes that nobody wrote down, so compare observed routes against your allowed_routes list before the list is final.

Move one caller group at a time, for example internal batch jobs first, then a single product team, then developer tools, and leave the admin paths for last. After each group, confirm its traffic succeeds and that no unexpected 403 responses appear. Keep a rollback path that you have tested: store the previous configuration in version control, know which change reverts the allowlist, and confirm who can apply it during an incident. Record every exception with its owner and a review date, so temporary allowances do not become permanent. Your rollout plan should state the scope of each stage, the success check, and the person who approves moving to the next stage.

How DeployOpen scopes and delivers LiteLLM route and IP restrictions

DeployOpen treats route and source IP restrictions as a written, testable part of a self-hosted LiteLLM gateway, not a switch flipped at the end. We agree which routes stay public, which are admin-only and which callers may reach the proxy, then build and verify those rules in your infrastructure. Engagements are fixed-scope, with the scope agreed in writing before work starts.

How we scope

  • Inventory the routes your callers, admins and monitoring systems actually use on the proxy today.
  • Agree in writing which routes are public, admin-only or allowed, with each route's owner named.
  • Confirm the Enterprise license needed for route controls and IP allowlisting before the build is priced and scheduled.

How we build

  • Write the public_routes, admin_only_routes and allowed_routes settings as configuration kept under version control.
  • Define the allowed_ips list from your documented network ranges, including VPN, office and CI egress addresses.
  • Test that disallowed callers receive a 403 Access forbidden response and that Swagger documentation is not reachable from outside.

How we hand over

  • Deliver the route inventory, configuration files and a record of every allowed and denied path tested.
  • Document how to add a route or address range, including the review step and who approves the change.
  • Walk your platform and security teams through the retest results and the rollback steps for each control.

How we support

  • Retest route and IP rules after LiteLLM upgrades, since route names and defaults can change between releases.
  • Ongoing support, upgrades and continuous testing are available as a retainer, scoped in writing.
  • Confirm with your team how proxy source addresses are seen behind your load balancer before relying on IP rules.

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.