How Guardrails AI validators run at the LiteLLM gateway
LiteLLM's guardrails_ai integration calls a self-hosted Guardrails AI server by guard name, so the validators themselves live on the Guardrails AI side and the gateway only forwards content to them. Consider a team that already routes its developer and application traffic through a LiteLLM proxy and wants the same Guardrails AI checks applied there, without changing each application. The working pattern is to run a Guardrails AI server in infrastructure you control, define one or more guards on it, and register each guard in the LiteLLM guardrail configuration with its guard name and the api_base of that server. The api_base defaults to ` which is a local address, so set it explicitly to the address your gateway pods can reach. Confirm the exact configuration keys against the LiteLLM docs: Guardrails AI page for your LiteLLM version.
The most important constraint is the input format. Today, llmOutput is the only input format that works with this integration, which means the checks are designed for model output content. Before you plan prompt screening with Guardrails AI, test that your intended guard behaves correctly on prompt text sent through the gateway, because a guard built for another input shape will not be a supported path here. Ask the vendor or your own test results to confirm the current behavior, since the format list can change between releases.
The validators are where the detection logic sits. Guardrails AI guards are built from validators published on Guardrails Hub, such as regex matching or toxicity detection. Each validator is installed separately after pip install guardrails-ai and can be chained into a single guard. Your team owns the choice of validators, their thresholds, their license review and their version pinning on the Guardrails AI server, so a change to a validator changes what the gateway blocks without any LiteLLM change. Plan a test suite of known-good and known-bad samples for each guard, and rerun it whenever you upgrade the server or add a validator.
What the Guardrails AI integration needs before setup
The Guardrails AI integration depends on five things being in place before anything is configured: a supported LiteLLM proxy, a self-hosted Guardrails AI server, the validator packages you choose, a network path between the two, and a recorded decision about telemetry. Confirm each one against the release pages before you pin versions.
Supported LiteLLM release line
The gateway that calls the guard must run a release line LiteLLM still supports. LiteLLM maintains support for the four most recent stable minor versions for both open source and Enterprise deployments, and the GitHub releases page lists v1.105.1 as published October 14, 2026. Pin the minor version you deploy, record it, and check it against the releases page before the integration is built and again before each upgrade.
LiteLLM releasesSelf-hosted Guardrails AI server
The guardrails_ai integration calls a Guardrails AI server by guard name, so that server must exist as its own service in your environment. Guardrails AI is Apache-2.0 licensed and can run as a standalone Flask REST service started with guardrails start. Confirm which version your team will pin, since v0.11.0 was published August 14, 2026, and check the release notes before choosing it.
Guardrails AI releasesValidators from Guardrails Hub
Guards are built from validators published on Guardrails Hub, such as regex matching or toxicity detection. Each validator is installed separately after the core package, and validators can be chained within one guard. Inventory every validator the guard needs, record its source and version, and confirm that the validator's license and maintenance status fit your policy before it runs against production prompts.
Guard names and input format
LiteLLM calls each guard by name, so the names defined on the Guardrails AI server must match what the gateway configuration references. The integration currently accepts llmOutput as its only working input format, which shapes which validators can be attached and how results are read. Write the guard names and the format decision into the configuration plan before setup starts.
Network path from gateway to guard
The gateway reaches the guard over HTTP, and the integration's api_base defaults to In a cluster or a restricted network, that default will not point at the guard server, so set the address explicitly. Confirm the firewall rules, service discovery and any TLS termination between the two, and decide whether the guard server is reachable only from the gateway.
Anonymous metrics decision
The guardrails configure step asks whether to enable anonymous metrics reporting. Make this decision before the server is deployed in a regulated environment, and record it with the rest of the configuration. Whichever choice you make, confirm with your security and privacy teams that outbound reporting from the guard host matches your data-flow policy.
Guardrails AI quickstartConfiguring the Guardrails AI guard and LiteLLM connection
This sequence builds a Guardrails AI guard on a self-hosted server, registers it in LiteLLM by name, and confirms with test requests that the gateway blocks and passes traffic as intended.
Install guardrails-ai and the chosen validators
The platform team installs the guardrails-ai package in a Python environment that the gateway can reach over the internal network, then installs each validator from Guardrails Hub that the guard will use, such as a regex or toxicity check. Validators are installed separately from the core package, so the team should record the exact validator names and versions in its configuration repository. Confirm the installed set with a local import test before moving on. The step is done when every planned validator loads without error in that environment.
Define and test the guard locally
A developer defines the guard in Python by chaining the installed validators and sets the on-fail behavior for each one. Run the guard against a few sample strings in a local shell: one that should trigger each validator and one that should pass. The team also runs guardrails configure at this point and makes an explicit decision about the anonymous metrics reporting prompt, recording the answer in its deployment notes. The step is done when the guard flags the failing samples and passes the clean ones.
Start the guard as a Flask REST service
Run guardrails start to expose the guard as a standalone Flask REST service on the server the team controls. Keep the service on a private address, and place it behind the same network controls as the gateway rather than exposing it to user networks. Check that the service responds to a direct request from the gateway host, using the guard name and a sample payload. The step is done when a direct call to the service returns a validation result for both a blocked and an allowed sample.
Register the guard in LiteLLM by name
Add the Guardrails AI integration to the LiteLLM proxy configuration, referencing the guard by its name and setting api_base to the internal address of the service. The default api_base is which only works when the service and proxy share a host, so the team must replace it with the internal service address in every environment. Set the guard to run at the point in the request lifecycle the team has chosen. Restart or reload the proxy and confirm in its logs that the guard loaded without a connection error. The step is done when the proxy reports the guard as registered and reachable.
Use llmOutput as the input format
Confirm the input format the integration expects before wiring the guard into requests. At the time of the researched documentation, llmOutput is the only input format that currently works with LiteLLM's Guardrails AI integration, so the guard must be designed to receive that shape. Send a test request through a non-production route and check the proxy log to see which text the guard received. The step is done when the team has a written note of the format it verified and has confirmed the guard receives the text it was built to check.
Attach the guard to a test key
Create a virtual key for testing, restrict it to one non-production model, and attach the Guardrails AI guard to that key only, so that no other team's traffic is affected. Keep the key's budget and rate limits low while testing. Keep the master key in a secret manager and do not reuse it for these tests. The step is done when the key is scoped and the guard is visible as attached to it in the admin view.
Verify with a blocked and an allowed request
Send one prompt that a configured validator should block and one benign prompt through the test key. The blocked request should return a guardrail error from the gateway without reaching the model provider, and the allowed request should complete normally. Review the gateway logs for both requests to confirm the guard ran and recorded its decision. Repeat the pair after any validator or api_base change. The step is done when both test outcomes match expectations and the logs show the guard's decision for each.
Why llmOutput is the only input format that works today
The LiteLLM Guardrails AI integration currently accepts only llmOutput as its input format, so the guard you call from LiteLLM receives model text, not the user's prompt. For prompt screening, this means a Guardrails AI validator configured through LiteLLM cannot be relied on to inspect what users send in. Plan prompt-side checks with a different control, and treat the Guardrails AI path as a response screen until you have confirmed otherwise in your own tests.
Before design sign-off, list every validator you intend to install from Guardrails Hub and confirm, by reading its documentation and testing it against a sample of model output, that it evaluates the text it is given in the way your policy needs. A validator that works well on a standalone Guardrails AI server does not automatically work through this integration, and the guard name, the api_base (which defaults to in the LiteLLM documentation) and the input field must all match what the server exposes. Record which validators screen responses only, so reviewers do not assume prompt coverage that does not exist.
Because this input limit is a current-state fact, check the LiteLLM Guardrails AI documentation again on the day of design sign-off and on every LiteLLM upgrade, and note the LiteLLM release you tested against. Guardrails AI itself is released often, so pin the server version you validated and retest after any change. If prompt screening is a hard requirement for your organization, decide now whether a different guardrail provider or a separate pre-call control will cover it, rather than discovering the gap during a security review.
How a request moves through LiteLLM and the Guardrails AI server
The request starts at the client, which sends an OpenAI-format call to the LiteLLM proxy inside your network. The proxy calls the Guardrails AI server by guard name, and the guard runs its validators on the llmOutput text. If a validator fails, the proxy blocks the call; if the guard passes, the request continues to the model provider across the trust boundary. Check which direction the guard is applied to, and confirm the block response your callers receive.
Guard call path through the LiteLLM proxy and the trust boundary to the provider.
Mapping guards, keys, teams and models to LiteLLM settings
This table maps each part of a Guardrails AI setup to the LiteLLM setting that controls it, and notes which fields to confirm against your LiteLLM version. Read it as a checklist before you write the guardrail entry, because the guard name, api_base, key scope and model scope each affect what gets screened. The main takeaway is that LiteLLM controls where a guard applies, while the guard service controls what its validators check.
| Item | LiteLLM setting or owner | What to confirm |
|---|---|---|
| Guard name | Guard name passed to the guardrails_ai integration, which the LiteLLM server calls by name | The guard must already exist on the Guardrails AI server with the validators you expect; a name mismatch fails the call |
| api_base | Points LiteLLM to the internal Guardrails AI server, defaulting to if unset | Set it to your internal service address, not the default, and confirm the host and port reachable from every gateway pod |
| Input format | llmOutput is the only input format that currently works with this integration | Confirm the format against current LiteLLM docs before relying on prompt-side screening of other payload shapes |
| Virtual keys | Where the guardrail is attached to traffic from specific keys, if your LiteLLM edition supports key-level attachment | Confirm in your version whether guardrails attach per key, per team or only globally, since this decides which callers are screened |
| Teams | Team-level guardrail scoping, which LiteLLM Enterprise documents as a feature | Confirm whether open source supports team scoping; if not, plan team separation through separate guard entries or Enterprise |
| Models | Model routes in the LiteLLM model list that the guardrail should cover | Check that every route serving sensitive traffic is included, including fallback and failover routes from the router |
| Validator packages | Owned by the team that installs and versions them on the Guardrails AI server, installed separately from the core package | Record the owner, pinned version and Guardrails Hub source for each validator so changes go through review |
| Guard service version | Guardrails AI releases such as v0.11.0 (August 14, 2026) change behavior and dependencies | Pin the guardrails-ai version in your image and test each upgrade against your guard names before rollout |
Hardening the guard server and its connection
The Guardrails AI server sits between user traffic and the model call, so anyone who can reach it or change its guards can alter what the gateway allows. The controls below cover network placement, secrets, change control, package review and decision logging, and they work best applied together.
Restrict the guard server to the gateway network
Guardrails AI runs as a standalone REST service, and the LiteLLM integration calls it by guard name at an api_base that defaults to Bind the server to a specific private interface rather than all interfaces, and allow inbound connections only from the LiteLLM proxy hosts or pods. Confirm the bind address and port in your deployment, then test from a host outside the gateway network to show the connection is refused.
LiteLLM Guardrails AI docsProtect the LiteLLM master key
The LITELLM_MASTER_KEY must start with sk- and grants administrative control of the gateway, including the guardrail configuration that calls the guard server. Store it in a secret manager and inject it at runtime rather than placing it in configuration files or container images. Limit who can read the secret, and rotate it through a documented procedure that updates every proxy instance together.
Limit who can change guard definitions
A guard definition decides which validators run and what happens when one fails, so a silent edit can weaken screening for every team that uses it. Keep guard configuration in version control, require a reviewer for changes, and restrict admin access on the gateway to the people who own the policy. Ask who can edit guard names and api_base values and whether those edits are recorded.
Review validators and packages before install
Validators come from Guardrails Hub and are installed separately with pip, and custom validators are plain code that runs inside your environment. Review the source of each validator, pin package versions, and check the license of each dependency before it reaches the guard server image. Guardrails AI is Apache-2.0 licensed, but individual validators may carry their own terms, so confirm them before approval.
Guardrails AI on GitHubLog blocked decisions for review
A blocked request is the evidence that a guard is working, and it is also the record a security reviewer needs when a user disputes a refusal. Record the guard name, the validator that fired, the request identifier and the decision, but avoid storing the full prompt unless your retention rules allow it. Route these events to the log store your team already reviews, and confirm which fields the integration emits in your version.
Failure points when Guardrails AI checks break
This table lists the failures most likely to stop Guardrails AI validators from screening traffic at the LiteLLM gateway, with the cause and fix for each. Read it during build and again during testing, since several failures look like a working gateway while screening is silently skipped or delayed. The main takeaway is that a request can pass through LiteLLM without the intended check running, so confirm screening with a test prompt before go-live.
| Failure | Likely cause | Fix |
|---|---|---|
| api_base points at the wrong host | The default api_base is which inside a container refers to the container itself, not the Guardrails AI server. | Set api_base to the service name or cluster address of the guard server, and test reachability from the LiteLLM container or pod. |
| Guard name mismatch | The guard name in the LiteLLM config does not match the guard deployed on the Guardrails AI server, so the call fails or no guard is found. | List the guards the server exposes, copy the name exactly, and confirm the config key and guard name match in a test call. |
| Unsupported input format means no screening | Only llmOutput currently works as the input format for this integration, so other formats may not be screened as expected. | Set the format the integration supports, then send a known-bad test prompt and confirm it is flagged or blocked in logs. |
| Validator packages missing on the server | Validators come from Guardrails Hub and are installed separately, so a guard that references an uninstalled validator will not run. | Install each validator on the server image used for the guard, rebuild the image, and verify each validator with a test call before go-live. |
| Timeouts add latency | The guard server is a separate network hop, and slow validators or undersized server resources add time to every request. | Measure added latency under realistic load, size the guard server and its workers, and confirm the timeout value with your load test results. |
| Guard server unreachable under fail behavior | If the guard server is down, the gateway either blocks all traffic (fail closed) or passes it unscreened (fail open), depending on configuration. | Decide the fail behavior per use case in writing, test a deliberate outage, and set alerts on guard server health and gateway errors. |
| Validator results not visible to operators | Logs do not show which guard ran or what it returned, so failures are hard to trace. | Enable request logging for guardrail outcomes and confirm the fields your security team needs appear in your log store. |
When Guardrails AI fits and when to compare NeMo Guardrails
Guardrails AI fits teams that want to screen prompts and responses with discrete checks, such as regex matching or toxicity detection, and combine them into one guard. Validators are published on Guardrails Hub, installed separately after pip install guardrails-ai, and can be chained together. Through LiteLLM's integration, your gateway calls a Guardrails AI server by guard name, so the checks stay in one place and your application teams do not need to change how they call models.
- Hub validators: Review each validator's license, maintainer and detection method before adding it to a guard, since quality varies between hub entries.
- Chaining order: Decide which validators run first and which findings should block a request versus log it, and test the combined behavior rather than each validator alone.
- Custom validators: Plan an owner, test set and review process for any validator your team writes, since the README allows contribution to the hub but you will maintain your own code.
- Input format: Confirm that the LiteLLM integration accepts the input format your guard needs, because the documented format that currently works is llmOutput.
- Server operation: Budget for running the Guardrails AI server as a service, including its availability, logging and upgrades.
Before committing, test your chained guard against your own prompts, including attack and false-positive samples.
Guardrails AI also generates structured data from LLMs, matching output to Pydantic models using function calling or prompt optimization. This suits workloads where downstream systems expect a fixed schema, such as extraction into tickets, records or forms. The question here is less about blocking unsafe text and more about whether model output is well formed and complete enough to process.
- Schema ownership: Name the team that owns each Pydantic model and who approves changes, since schema edits change what the application accepts.
- Failure handling: Decide what happens when output does not validate after retries, such as rejecting the request, returning an error or routing to a person.
- Provider behavior: Confirm whether your chosen model providers support function calling or whether the prompt optimization path is needed.
- Validation scope: Separate schema conformance from content safety in your test plan, so a valid but harmful answer is not treated as passing.
- Logging: Record validation outcomes next to the gateway's request logs so auditors can trace a rejected or repaired response.
Ask the vendor or your own team to run representative extraction tasks through the planned models before fixing the schema design.
NeMo Guardrails is the project to compare when you need programmable rails over a conversation. It configures input, dialog, output, retrieval and execution rails in the Colang language, which lets you define how a bot should steer topics, respond to certain intents and call actions. Like Guardrails AI, it is Apache-2.0 licensed, so licensing alone does not separate them. The difference is the kind of control you are writing: flow logic in Colang versus validators applied to text.
- Rail types: Check whether you need input, dialog, output, retrieval or execution rails, since not every use case requires all five.
- Colang skills: Confirm that your team or partner can write, test and maintain Colang flows, which is a separate skill from Python validator work.
- Integration path: Verify how NeMo Guardrails would sit with LiteLLM, because this topic's integration documentation covers Guardrails AI, not NeMo Guardrails.
- Version tracking: Record the release you evaluate and plan upgrades, since both projects publish releases frequently.
- Test coverage: Build conversation test cases that cover off-topic, multi-turn and adversarial paths.
Compare both projects on the same set of representative prompts and responses, and confirm the license terms of any hub content you plan to use.
Questions buyers ask about Guardrails AI with LiteLLM
What drives the cost of adding Guardrails AI validators to LiteLLM?
The main cost drivers are which validators you need, how much server capacity the Guardrails AI service requires, how much testing you run before go-live, and how many changes you make to guards afterward. Validator selection sets the scope: each validator is installed separately from Guardrails Hub and can be chained with others, so every added check adds design, configuration and test work. Server sizing depends on the traffic each guard screens. Testing volume depends on how many prompt and response samples you need to confirm false positives and misses. Change control adds recurring effort, because every guard edit needs review and retesting. Ask any partner for a quote that lists these items separately, and confirm who pays for the Guardrails AI server, the LiteLLM gateway and the validator maintenance.
How long does it take to get a tested Guardrails AI setup running behind LiteLLM?
No duration is fixed for this integration, and the time depends on the validators chosen, the number of guards, whether the gateway already runs, and how much test data your team can supply. A typical sequence is to stand up a self-hosted Guardrails AI server, configure the guard by name in LiteLLM, send representative prompts and responses through it, review what it blocks, and then adjust validators before enabling it for production traffic. Each step depends on decisions made earlier, so ask for a written timeline tied to a written scope rather than a generic estimate. Confirm the current release you plan to run, since the Guardrails AI project publishes new versions regularly.
What does our team need to provide for a Guardrails AI integration?
Your team needs to provide several inputs before work starts:
- Access to the LiteLLM gateway and the environment where the Guardrails AI server will run.
- A test model behind LiteLLM that can receive sample traffic without touching production users.
- Decisions on which validators to use, what each should block, mask or only log, and what content counts as a policy violation.
- A named owner for reviewing blocked traffic, tuning false positives and approving validator changes.
- Sample prompts and responses that reflect your real use cases, so testing covers the traffic you expect.
Can an internal platform team set up Guardrails AI with LiteLLM alone?
Yes, a platform team with Python, container and LiteLLM experience can install the Guardrails AI server, install validators and configure a guard. The harder parts are usually outside installation: choosing validators that match your policy, writing test cases that reflect real traffic, deciding how blocked requests are handled, and keeping the guard configuration under change control. If your team lacks capacity for those tasks, or needs an independent test of the setup, a partner can take on part of the work under a written scope. Whichever route you choose, confirm who owns the server after go-live and who handles upgrades.
Which input format works with the LiteLLM Guardrails AI integration?
The LiteLLM Guardrails AI integration currently works only with the llmOutput input format, according to the LiteLLM documentation. The integration calls a Guardrails AI server by guard name, and the api_base defaults to ` unless you change it. Because the format is limited, check whether a validator you need depends on other input shapes before you commit to a design, and confirm the current support with the LiteLLM documentation for the version you run. Plan tests against the exact request and response shapes your applications send, including any tool calls.
What should we check before putting Guardrails AI validators into production?
Before production, check that the guard blocks the content you intend to block, that it does not block legitimate requests at an unacceptable rate, and that failures in the Guardrails AI server behave the way your policy requires. Test with a sample set that includes normal prompts, edge cases and known attack patterns. Confirm how LiteLLM handles a server that is slow or unavailable, and record what the logs show for blocked requests. Also confirm the Guardrails AI license terms, which are Apache-2.0 according to the project repository, and review any validators you install from Guardrails Hub for their own terms and maintenance status.
What ongoing work follows after the Guardrails AI integration goes live?
Ongoing work includes reviewing blocked traffic, tuning validators to reduce false positives, updating the Guardrails AI server and validators when new releases appear, and retesting after each change. Guardrails AI published v0.11.0 on August 14, 2026, after v0.10.2 on June 4 and v0.10.0 on April 3, 2026, so release tracking is a real recurring task. Plan who reviews release notes, who tests upgrades in a non-production gateway, and how rollbacks are handled. These tasks recur for as long as the guards run, so include them in any support arrangement or retainer you agree with a partner or your own team.
Do we need Guardrails AI or a different guardrail for LiteLLM?
Choose Guardrails AI when you want validators from Guardrails Hub, such as regex matching or toxicity detection, that you can chain and customize. The project also supports custom validators and works with proprietary and open-source models. NeMo Guardrails is a different option, configured in the Colang language with input, dialog, output, retrieval and execution rails. Compare them on the checks you need, the team skills available and the input formats each integration accepts with LiteLLM. The LiteLLM guardrail documentation and your own test results should drive the decision.
How DeployOpen scopes a Guardrails AI integration
A DeployOpen engagement for this integration starts with a written, fixed scope that names every guard, the validators inside it, the LiteLLM routes that call it, and the test cases that prove each one behaves as intended. The scope also records the input format limit as a design constraint: according to the LiteLLM Guardrails AI documentation, llmOutput is the only input format that currently works through the guardrails_ai integration. That single fact shapes the build, so it is written down before any validator is chosen, not discovered during testing. Each guard is listed with the route or key scope it applies to, the validators chained into it, and the action taken on failure.
The scope separates the components DeployOpen will build and the ones the client already owns. DeployOpen implements and documents the Guardrails AI server inside the client's infrastructure, installs the validators from Guardrails Hub that the agreed guards need, registers each guard by name in the LiteLLM configuration, and sets the api_base for the server instead of relying on the default ` Validator choices are confirmed against the installed Guardrails AI release, since the guardrails-ai releases page is the place to check which version is current and what changed. Where a required check does not exist as a published validator, the scope states that a custom validator is needed and prices it as a separate item.
The test plan in the scope covers prompt and response screening through the gateway, failure behavior when the Guardrails AI server is unreachable, and confirmation that unsupported input formats are not silently passed through. Clients should ask for the test cases to be written out as part of the scope, with expected results for blocked, allowed and masked traffic, and should confirm that the handover includes runbooks for the server, its validator versions and the configuration keys that connect it to LiteLLM. Ask the vendor to state which parts of the work recur, such as validator upgrades and retesting after a Guardrails AI release, and which parts are one-time.
How DeployOpen works on this
DeployOpen scopes, builds, tests and hands over Guardrails AI validators with LiteLLM inside infrastructure you control, including the self-hosted Guardrails AI server and the LiteLLM gateway that calls it. Engagements are fixed-scope, so the validators, routes, keys and evidence are agreed in writing before work starts.
How we scope
- We confirm which guard names, validators and LiteLLM keys, teams or models the written scope covers.
- We record which prompts and responses are screened, and confirm the llmOutput input format fits each use case.
- We agree in writing how the Guardrails AI server is hosted, reached and monitored before any build begins.
How we build
- We install the Guardrails AI server in your environment and install the chosen validators from Guardrails Hub.
- We configure the guardrails_ai integration in LiteLLM with the guard name and api_base pointing at your server.
- We test blocking behavior, error handling and latency on representative prompts and responses before handover.
How we hand over
- We deliver configuration, validator versions, runbooks and test results so your team can review and operate the setup.
- We document the llmOutput limitation and which traffic falls outside the integration, so reviewers see the real coverage.
- We walk your platform and security teams through the configuration and the evidence they need for internal review.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after handover.
- Retainers can cover Guardrails AI and LiteLLM version changes, validator updates and retesting after configuration changes.
- Any change to guard names, validators or routing can be scoped in writing and retested before it reaches production.

