Why configure the LLM Guard API server securely now
If your organization still runs an LLM Guard API server in production, the most important thing to know is that the protectai/llm-guard repository was archived by its owner on 9 July 2026, and the project's README states that it is no longer under active development or maintained. This page covers how to lock down that existing API server: bearer token authentication, rate limits, request timeouts, Swagger exposure in debug mode, and metrics and tracing for the guardrail itself. The goal is containment until the deployment is replaced, not a new rollout, because no new LLM Guard rollouts are recommended.
LLM Guard can be used as a Python library installed with pip or deployed as an API server, and the two modes carry different exposure. An API server sits on the network path between your applications and the language model, so every caller that can reach it can also send it traffic, consume scanner capacity and, if debug settings are left on, read its interactive API documentation. Before changing anything, confirm which callers reach the server, which network segments they come from, and whether any settings enable Swagger output outside development. Those answers decide how much of the hardening below is urgent. Because the project no longer receives fixes, the controls you add at the server and network layer are the ones you can still change with confidence.
What the API server exposes and why it matters
An LLM Guard API server is a network service that sits between your users and your models, so every route it serves is part of your attack surface. The cards below separate the scan routes, the documentation and admin routes, the metrics path and the network path from callers, because each needs a different control. Confirm the exact routes in the version you run, since the set changes between releases.
Scan endpoints receive raw prompts
The scan routes accept the full text of user prompts and model outputs, often containing personal data, credentials or confidential business content. Anything a caller can send to a scan route is data your guardrail now holds in memory and may log. Identify every scan route your callers use, record which fields carry user content, and decide whether request bodies are written to any log or trace. Check the exact route names against the API reference for your installed version before you write firewall or gateway rules.
- Input scanners documented
- 15
Interactive API documentation routes
Many API servers built on FastAPI-style frameworks serve an interactive Swagger UI and an OpenAPI schema by default. These routes reveal every endpoint, parameter and expected payload to anyone who can reach the server, which helps an attacker map the service. Check whether your deployment serves these routes in production, and whether debug mode changes that behavior. Treat disabling them, or restricting them to an internal network, as a configuration decision you record and test rather than an assumption.
Metrics endpoint exposure
A metrics route reports request counts, latency, and scanner outcomes, which can reveal traffic volume, which policies block most often and how the service is tuned. Scrapers usually need network access but not user credentials, so the endpoint is often left open. Find out whether your version exposes a metrics path, which port it listens on, and which networks can reach it. Restrict it to your monitoring system and confirm that no public load balancer forwards it.
Authentication on the API surface
Bearer token checks decide which callers can reach scan routes at all. If the token check is missing, misconfigured, or applied to only some routes, any reachable client can use the guardrail as a free scanning service or probe it for bypasses. Confirm which routes require the token, how tokens are supplied to the server, and who holds them. Record the result so a reviewer can see the check was tested, not just configured.
Network path from calling applications
The guardrail sits in the request path of your applications, so the network between them determines who can reach it and what a compromise exposes. A server on a flat network, reachable from developer laptops or the internet, widens the trust boundary considerably. Map each calling service to the guardrail address, decide whether traffic stays inside a private network or service mesh, and confirm that TLS terminates where your policy requires. Verify the path with a reachability test from networks that should not have access.
Configuration options and when each one fits
This table compares the five controls that matter most for a running LLM Guard API: bearer token authentication, rate limiting, request timeouts, docs exposure and guardrail telemetry. For each one it shows what it protects, where it is usually set and when it fits, so you can decide what to lock down first. Confirm exact setting names against the LLM Guard documentation for your installed version before changing anything.
| Option | What it protects and where it is set | When it fits |
|---|---|---|
| Bearer token authentication | Stops callers without a token from submitting prompts or outputs for scanning. Confirm in the LLM Guard documentation whether the server enforces tokens itself or whether the check must sit in a reverse proxy or gateway. | Every deployment reachable from more than one network segment. Treat it as the minimum control for an archived service that will keep running. |
| Rate limiting | Limits how many scan requests one caller can send, protecting model capacity from floods and runaway clients. Usually set at the reverse proxy or API gateway in front of the server, since the scanner itself does not typically provide it. | Shared internal services where one application or agent could exhaust scanning capacity. Pair it with a per-caller identity so limits mean something. |
| Request timeouts | Bounds how long one scan can hold a worker, which limits memory pressure and blocked queues when large inputs or slow scanners run. Set at the proxy, the application server and the calling client, and check that all three agree. | Any deployment with long inputs or slow scanners enabled. Mismatched timeouts cause retries that multiply load, so review them together. |
| Swagger and interactive docs outside debug mode | Keeps the endpoint map and request schema from being browsed by anyone who can reach the service. Confirm how the server enables or disables its docs routes for your version, and block the docs paths at the proxy as a second layer. | Production and any environment reachable beyond the build team. Leave docs on only in isolated test environments. |
| Metrics and tracing for the guardrail | Shows scan volume, blocked counts, latency and errors so you can detect outages and abuse. Metrics endpoints should be reachable only by monitoring systems, and traces must be checked for prompt content before export. | Any production deployment, because an unmaintained guardrail needs visible evidence that it still blocks. Confirm which exporters your version supports before planning dashboards. |
Setup sequence for hardening an existing deployment
This sequence takes an running LLM Guard API from its current state to one with known exposure, a pinned version, an authenticating front door, enforced limits and visible telemetry. Each step ends with a check so the team can show the control works before moving on.
Inventory callers and current exposure
List every service, script and user that sends requests to the LLM Guard API, along with the network path each one uses. Record which ports are reachable from outside the application network, whether the API is exposed through any ingress or load balancer, and which hosts run the container. Ask the platform team to confirm this against the actual routing and firewall rules, not only the architecture diagram. The step is done when you have a written caller list and an exposure map that someone other than the author has reviewed.
Pin the running version and image
Record the exact LLM Guard package version and the container image digest that are running today, and store them in your configuration repository. Confirm the version against the PyPI release history and your build records, since the archived project does not publish new fixes. Redeploy only with the pinned image so that later rebuilds cannot silently pull different dependencies. The check is that the running container's image digest and installed package version match the values recorded in version control.
Place the API behind an authenticating gateway
Move the API so that clients reach it only through a reverse proxy or API gateway that your team operates, and block direct access to the API port from outside the internal network. The gateway should terminate TLS and handle authentication requests before they reach LLM Guard. Your platform or security team owns this change, and the configuration should be reviewed alongside your gateway standards. The check is that a direct connection to the API port from a non-approved host fails, while the same request through the gateway reaches the service.
Enable bearer token checks
Configure the API to require a bearer token on scan endpoints and confirm, in the LLM Guard documentation for your version, how the server is expected to receive and validate the token. Issue tokens per calling service so that revocation affects one caller at a time, and store them in your secrets manager rather than in environment files committed to source control. The check is that a request with no token, an expired or wrong token, and a malformed authorization header are each rejected, while a valid token succeeds.
Set rate limits and timeouts
Apply request rate limits at the gateway so that a single caller cannot exhaust the scanners, and set server and upstream timeouts that match the slowest scanner you run. Agree the limit values with the teams that own the callers, since the right numbers depend on your traffic and hardware, and record them in configuration. The check is a load test from one caller that exceeds the limit and receives throttled responses, plus a deliberately slow input that is cut off at the timeout rather than holding a worker indefinitely.
Confirm debug and Swagger routes are off
Verify that the debug mode is disabled in the running process and that the interactive API documentation routes do not respond on any exposed path. Check the environment variables and start-up command, not only the defaults, and remove any route rules that were added during testing. The check is that requests to the documentation and debug paths return a not-found or access-denied response through the gateway and directly on the container, and that the process logs show debug disabled at start-up.
Enable metrics and logs for the guardrail
Turn on request, latency and error metrics for the API, and send structured access logs to your central logging system with the caller identity, scanner name, decision and response code. Make sure logs do not record raw prompts or model outputs unless your data handling policy allows it, and set retention to match your policy. Add an alert on error rate and on sustained rejections so that a failing guardrail is visible. The check is that a test request appears in the metrics and in the central log with the expected fields, and that a forced error triggers the alert.
Test each control with negative requests
Run a scripted set of negative tests against every control in order: unauthenticated calls, invalid tokens, direct port access, over-limit bursts, oversized or slow inputs, and requests to documentation paths. Keep the test script and its results in the evidence folder for the system, and rerun it after any configuration change. The sequence is complete only when every negative test fails as expected and the results are recorded with the image digest and configuration version they tested.
How a request passes through the hardened API
A request starts in the calling application and crosses into the gateway layer, where TLS ends and bearer tokens and rate limits are checked before anything reaches LLM Guard. Only requests that pass those checks reach the API server, which runs the scanners. Metrics and logs from the gateway and the API server flow to the team's monitoring stack, which should be treated as a separate trust zone. Check that the API server accepts traffic only from the gateway, and that nothing bypasses it.
Trust boundaries between the calling application, gateway, LLM Guard API and monitoring stack.
How the controls differ by environment
On a single host, LLM Guard usually runs as one container, either published directly on a host port or placed behind a reverse proxy that terminates TLS. Authentication and rate limiting most often sit in that proxy, because it is the only layer you fully control on a single machine. Model loading happens inside the container at startup, so requests that arrive shortly after a restart can wait while models load, and that wait has to fit inside the proxy's upstream timeout. Metrics usually come from the container runtime and the proxy, since the guardrail process exposes limited telemetry of its own.
- Token checks at the proxy: Validate the bearer token in the reverse proxy in front of the container, and confirm which token settings the image supports before relying on them.
- Timeouts sized for cold starts: Set the upstream timeout longer than a cold model load measured on your hardware after a restart, not an estimate.
- Per-caller rate limits: Apply limits at the proxy, keyed on the token or client address, and exempt the health check so restarts are not mistaken for abuse.
- Host and proxy metrics: Collect container CPU, memory and restart counts from the runtime, and request latency and status codes from the proxy access log.
- Documentation paths blocked: Confirm whether the image serves interactive API documentation in your configuration, and block that path at the proxy if it does.
Confirm every setting against the exact image version you run, since the last PyPI release is 0.3.16 and the server options should be checked against that version's documentation.
In Kubernetes, the ingress controller or API gateway usually takes over the roles a proxy plays on a single host. Authentication and rate limiting normally sit there, applied per route, while the pod only receives traffic that has already passed those checks. Timeouts now span several objects: the ingress, the service and the pod's probes, and each can cut a request off before the model finishes loading. Readiness probes need particular care, because a pod that is still loading models should not receive traffic, yet a liveness probe that fails too early can restart it in a loop. Metrics are typically scraped by a monitoring system such as Prometheus from the pod and the ingress.
- Gateway-level authentication: Enforce the bearer check at the ingress or gateway so every route carries the same policy, and confirm the API server's own token setting matches it.
- Probe timing for model loading: Configure the readiness probe to pass only after models are loaded, and give the liveness probe a startup allowance so a slow load does not trigger restarts.
- Aligned timeouts: Make the ingress timeout longer than the pod's slowest expected scan, and check that no intermediate component times out first.
- Memory limits and restarts: Watch for out-of-memory restarts in pod events, since model memory use is the most common cause of restarts in this setup.
- Scraped metrics: Collect pod resource metrics and ingress request metrics in your monitoring stack, and alert on restart counts and error rates.
Confirm with your cluster team which component owns rate limiting and which namespace policies apply, because ownership of these settings often differs from the team that deploys the guardrail.
On air-gapped or restricted networks, the same controls exist but the supporting services are internal and the network cannot fetch anything at runtime. Authentication depends on a token issuer or secret distribution inside the enclosure, so the team must confirm how tokens are created, rotated and revoked without internet access. Rate limiting usually sits in an internal gateway or proxy that your platform team already operates. Timeouts still have to cover model loading, but the models must be present locally before startup, so load time reflects disk speed and not download time. Metrics should flow to an internal collector, and no telemetry should leave the enclosure.
- Local token issuance: Confirm which system issues and rotates bearer tokens inside the enclosure, and document the revocation procedure before go-live.
- Models on local storage: Verify that every model the scanners need is present on local storage, so a restart does not attempt a download that the network blocks.
- Timeouts measured on local disk: Test cold-start duration with the models mounted from local storage, since that is the load time users will see.
- Outbound telemetry disabled: Confirm that the image and its dependencies make no outbound calls at runtime, and check this with network logs rather than the vendor's statements.
- Internal metrics pipeline: Send metrics and logs to a collector inside the enclosure, and keep retention aligned with your audit requirements.
Confirm each of these points with your security team and test them on an isolated host, because a setting that works on a connected network can fail silently when the network is restricted.
Security and operational risks to control
The LLM Guard API sits between your applications and the model, so a weakness here affects every caller. The six risks below cover credentials, network exposure, debug features, request handling, failure behavior and monitoring. For each, the control and the evidence to keep are named so the configuration can be reviewed and defended while the deployment runs.
Token leakage in clients and logs
The bearer token that authorizes calls to the API can end up in application configuration, CI logs, reverse proxy access logs or support tickets. Store the token in a secrets manager, inject it at runtime, and confirm that your proxy and application loggers strip or redact the Authorization header. Rotate the token on a schedule you can name and after any suspected exposure. Keep evidence of where the token is stored, who can read it, the rotation record and a sample of redacted log lines.
Unauthenticated access from internal networks
Teams often assume that an API reachable only from the internal network needs no authentication. In practice, any compromised workstation, lateral-movement foothold or misrouted service can call the scanners and read their verdicts. Require the bearer token on every route, restrict the listener to the specific caller subnets or service mesh identities, and test from a host outside that allow list. Keep the firewall rules, the allow list owner and the results of an unauthenticated call test.
Debug mode left on in production
Debug mode can expose the interactive Swagger documentation, detailed stack traces and verbose responses that reveal scanner configuration and internal paths. Confirm that the deployment starts with debug disabled, that no environment variable overrides it in production, and that the documentation route is either closed or behind authentication. Check the running container rather than the image defaults alone. Keep the deployment manifest that sets the value, a request to the documentation route showing it is not served, and the change record.
Unbounded request sizes and abuse
Guardrails process whole prompts and model outputs, so a single oversized or high-frequency caller can consume memory and CPU and slow every other team. Set a maximum request body size at the reverse proxy or gateway, apply per-client rate limits, and cap concurrent workers so one caller cannot exhaust the pool. Verify the limits with a test request above each threshold. Keep the proxy configuration, the limit values with their owner, and the test output showing rejected requests.
Timeouts that hide failures
A scanner that exceeds its time budget and returns a default result can look like a pass, so a stalled model load or slow scanner can silently stop enforcing policy. Set explicit timeouts at the proxy, the client and the API, and decide per deployment whether a timeout blocks the request or allows it. Choose the fail-closed option for scanners that protect sensitive data. Keep the timeout values, the documented fail behavior for each caller, and logs showing timed-out requests and how they were handled.
Blind spots in guardrail metrics
If nobody measures scan outcomes, errors, latency and blocked volume, an archived guardrail can degrade without anyone noticing. Expose the API's metrics and traces to your monitoring stack, alert on error rate, restart count and scanner failures, and record how often each scanner flags content so unusual drops in blocks are visible. Confirm which metrics the running version actually emits before building dashboards. Keep the alert rules, dashboard links, and a record of an alert firing during a test.
Questions teams ask before changing the API server
Can our own team harden the LLM Guard API server without outside help?
Yes, if the team already runs Python services in containers and can read the server's configuration and logs. The work is mostly configuration and testing: adding bearer token checks, setting request limits and timeouts, turning off Swagger in production and adding metrics. The harder part is knowing which calling applications depend on current behavior, because the project is archived and no longer receives fixes. Teams without container or reverse proxy experience usually find the test plan the most time-consuming piece. Ask the team to inventory callers and rehearse changes in a staging copy before touching production.
What access and inputs does a hardening pass need from our side?
A hardening pass needs four things from your side: access to the host or container platform running the API, access to the reverse proxy or ingress in front of it, the current configuration and environment variables, and a test plan that describes the requests your applications send. Read access to logs and metrics helps establish a baseline. A staging environment that mirrors production is strongly preferred, because token checks and timeouts can reject traffic that was previously accepted. Confirm who owns secret distribution for the bearer token so the new credential reaches every caller on the same change window.
How long does a hardening pass take for our environment?
Duration depends mainly on environment complexity: how many applications call the API, whether a reverse proxy or ingress already exists, how the containers are deployed, and how many test cases your callers need. A single container behind a proxy with few callers is simpler than several API replicas across clusters with different owners. Ask any provider for a timeline tied to a written scope, with the environments, number of callers and test cases listed. Rollout windows and approval steps in your change process often add more time than the technical changes themselves.
Will changing the API server break calling applications?
It can. Adding bearer token authentication means every caller must send a valid header, and rate limits or shorter timeouts can reject requests that used to succeed. Applications that expect Swagger pages or specific error formats may also behave differently. Plan a change in stages: introduce the new settings in staging, run your recorded test requests, then enable enforcement with a rollback path. Tell application owners which headers, status codes and timeouts change before the window opens.
Does hardening break a pinned LLM Guard version?
Usually not for settings that sit in front of the scanners, such as a reverse proxy, gateway or a wrapper around the API. Changes made inside the application code or its dependencies are riskier, because the last PyPI release, 0.3.16, was uploaded on 19 May 2025 and the project is archived. Keep the pinned version and its dependency lock file unchanged while you harden, and put new controls outside the scanner code where possible. Record the exact image digest and package versions before and after so any regression can be traced and reversed.
What should a quote for this work include?
A written quote should follow from a written scope and list the components that drive effort: the environments covered, the number of API instances, the reverse proxy or ingress work, the calling applications and test cases, the metrics and tracing targets, and the rollback and handover deliverables. It should state what is one-time work, such as the initial hardening and test plan, and what recurs, such as monitoring and periodic retesting if you want it. Ask who runs staging validation, who approves production changes and what evidence you receive at the end. DeployOpen does not publish a price list, so compare quotes on scope, not on headline numbers.
Should we harden the API or start replacing LLM Guard instead?
Hardening keeps an existing deployment contained while you plan the exit, but it does not make an archived project maintained. The repository was archived by its owner on 9 July 2026, and no new LLM Guard rollouts are recommended. If the API is a long-term dependency, treat hardening as a stopgap and plan a move to a maintained guardrail such as NeMo Guardrails. Ask your provider to scope the hardening and the decommission plan together so controls added now are removed cleanly later.
Limits and what to confirm in your environment
The LLM Guard API server has settings that matter for security, but the archived project gives you no guarantee about how they behave in the version you run. The cards below list what to verify in your own environment before you treat the server's controls as protection. Each check feeds the same decision: whether the current setup is contained enough to keep running until replacement.
Exact keys and defaults
Configuration key names and default values can differ between versions and between the server and the Python library. Read the configuration source of the exact build you deploy, not documentation written for a different release. Record each key, its default and the value you set, including authentication, rate limit, timeout and debug settings. Treat any key you cannot find in the code as unconfirmed, and do not assume a setting is on because a document describes it. Store the confirmed values with your deployment manifest so a rebuild reproduces them.
- Last PyPI release
- 0.3.16
Native authentication or a proxy
Confirm whether the server enforces bearer token authentication itself, or whether it accepts unauthenticated requests and expects a gateway to check credentials. If the server has no native check, the token validation, token rotation and failure logging must sit in a reverse proxy or gateway you operate. Test with a request that has no token, an expired token and a token from another caller. Only the proxied path should be reachable from the network, so confirm that the container port is not exposed directly.
Behavior in your base image
The last PyPI release, 0.3.16, uploaded on 19 May 2025, requires Python 3.10 or newer but below 3.13. Your base image, operating system packages and transitive dependencies may resolve differently from the release environment, so build the image from a pinned lock file and start it in a staging environment. Check that the server starts, answers health checks and returns scanner results for a known test set. A successful build does not prove that the server behaves as documented.
llm-guard on PyPIMetrics and tracing hooks
Confirm whether your version exposes a metrics endpoint, request counters, latency histograms or tracing instrumentation. If it does not, you will need to observe the guardrail from outside, for example through gateway metrics, proxy access logs and synthetic test requests. Decide which signals matter for security: blocked request counts, scanner errors, timeouts and sudden changes in pass rates. Write down what you can and cannot see, because gaps in visibility become part of the risk record.
No upstream security fixes
The project is archived and its README states it is no longer under active development or maintained. Plan on the assumption that no vulnerability in the server, its dependencies or its Hugging Face models will be fixed upstream. Track public advisories for the packages you run, and record who on your side owns the decision when a new one appears. Any fix you apply will be your own patch, so budget for that work and document it in the change log.
protectai/llm-guardUsing hardening work to plan the move to a maintained guardrail
The controls you place in front of the LLM Guard API are the part of this work that survives the move. Bearer token authentication, rate limits, request timeouts and access logs sit at the gateway or service boundary, so they constrain whichever service sits behind them. When the caller later points at a maintained guardrail such as NeMo Guardrails, the same gateway policy, token issuance and log pipeline can be reused with a new upstream, provided the request and response contract is kept stable or mapped explicitly. Confirm with your gateway team which of these controls live in a shared layer and which were written inside the LLM Guard container, because only the shared ones carry over without change.
The caller inventory built while hardening is the main input to the decommission plan. For each route, record the calling application, the bearer tokens it holds, the rate limit and timeout it depends on, the scanners it invokes and the Swagger or metrics endpoints it reads. Each entry shows which callers need a replacement, which ones depend on a specific response field, and which ones can be cut over first. Treat the inventory as a living record: callers discovered during hardening, such as internal jobs or dashboards that poll the metrics endpoint, are the ones most often missed in a migration.
Keep the hardening work proportionate to the move. Changes that only make sense for LLM Guard, such as tuning settings that depend on its scanner internals, should be limited to what keeps the deployment contained until replacement. Spend the effort on the parts that will be reused: documented policy, tested token rotation, and the logging and metrics needed to show that the replacement blocks at least what the current deployment blocks. Ask the team that will own the replacement which of these artifacts they want handed over, and record the answer in the decommission plan.
How DeployOpen scopes, delivers and supports this work
DeployOpen starts by reviewing how your LLM Guard API is exposed, authenticated and monitored today, then agrees a written scope for hardening it in place. The work runs inside your own infrastructure, with each change tested, documented and handed over while the archived guardrail is still in service.
How we scope
- Inventory of the API server, its container or host, the ingress path and every client that calls the scan endpoints.
- Written scope covering bearer token authentication, rate limits, timeouts, debug mode settings and guardrail metrics and tracing.
- Agreed list of tests, change windows and acceptance criteria, confirmed in writing before any configuration changes begin.
How we build
- Apply authentication and rate limiting at the API layer, with token handling checked against your secrets management standard.
- Confirm debug mode and Swagger documentation are disabled in the running configuration, and verify this from outside the container.
- Test timeouts, error responses and metrics output against your own traffic patterns, then record the settings and their reasons.
How we hand over
- Configuration baseline documenting each setting, its value, its owner and the test that proves it works.
- Runbook for rotating tokens, adjusting rate limits and reading the guardrail's metrics and traces during an incident.
- Retest results and a list of open items, including anything that depends on the archived project's unchanged behavior.
How we support
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
- Ongoing support, configuration reviews and continuous testing are available as a retainer, if your team wants them.
- Confirm with DeployOpen during scoping which changes will need retesting when the API image or Python base is updated.

