Why LiteLLM guardrail policies per team, key and model matter for shared gateways
When one self-hosted LiteLLM gateway serves several teams, a single guardrail set applied to everything is rarely the right answer. Guardrail policies group guardrails, can inherit from other policies, and are attached with policy_attachments to all requests or to specific teams, keys or models. That lets the platform team set a baseline that every request passes through while giving the team that handles patient notes, customer records or source code its own stricter screening, without forcing the same checks onto a marketing team that only drafts copy.
A global guardrail set stops being enough as soon as the teams differ in data sensitivity, model access or tooling. A common case is a shared PII or secret check that is fine for general use but blocks legitimate work for a security engineering team that must paste logs, or a regulated team whose model needs a vendor-specific detector that other teams should not pay latency for. Policy scoping also matters when a model is exposed to several audiences: a model approved for internal documents may need a tighter policy when a customer-facing team uses the same model name through a different key.
Before you design the attachments, confirm three things with your own environment: which teams and keys handle which data classes, which guardrails each team's data actually needs, and who is allowed to change a policy. Map each data class to a policy, decide what every key inherits and what it may override, and write down the owner of each attachment. Then test each team's keys against the policy they should get, because an attachment that is missing or too broad is the failure a reviewer is most likely to find.
Attachment scopes and when each fits
This table compares the four attachment scopes for a LiteLLM guardrail policy (all traffic, team, key and model) and the inheritance pattern that ties them together. Read each row as a choice you would make for a specific control objective, then check the risk and upkeep columns before you attach anything broadly. The main takeaway is that the narrowest scope that meets the control objective is usually the safest default, with broad attachment reserved for controls every request must pass.
| Scope | Best fit | Main risk | Maintenance cost |
|---|---|---|---|
| All traffic | Controls every request must pass, such as a baseline secret redaction or a logging-only check required by your security policy | Blocks or changes legitimate traffic from every team, so one false positive affects the whole gateway | Low count of policies, but each change needs wide testing and a clear change owner |
| Team | Rules that follow a business unit's data class or use case, such as a stricter check for a team handling customer records | Teams with mixed workloads may get rules that do not match some of their keys or models | Moderate; one policy per data class is usually easier to explain than one per team |
| Key | Service accounts or automations with a narrow purpose, such as a batch job that should only pass tool calls of an approved type | Keys get reissued or shared, so the policy may silently stop applying to the workload it was built for | High if every key needs its own policy; use keys only where the workload genuinely differs |
| Model | Models with different risk, such as a self-hosted model approved for sensitive data versus an external provider model | A caller can reach a model through another route if routing rules are not also restricted | Moderate; tied to the model list, so it changes when models are added or retired |
| Inherited policy | Shared base controls that child policies extend, so a common baseline is maintained in one place | A child policy may override a parent setting in a way reviewers did not expect | Low upkeep for the base; the child set must be reviewed whenever the parent changes |
| Overridden policy | Teams with a justified exception to a shared control, recorded and approved by an admin | Exceptions accumulate over time and weaken the baseline without anyone reviewing the total | Rises with each exception; keep a list and review it on a fixed schedule |
| Many small policies | Narrow controls for a few specific workloads where a broader scope would clearly be wrong | Hard to tell which policy applied to a given request during an incident | High: each policy needs tests, ownership, documentation and a retirement path |
| Team-registered guardrail | A team's own Generic Guardrail API service that needs review before it is used | A registration that stays pending_review can block the team's rollout, and an approved one still needs upkeep | Admin review time per registration, plus the team's ongoing service maintenance |
How teams register their own guardrails for admin approval
A team that wants its own check, such as a domain-specific classifier or a policy service it already runs, can register a Generic Guardrail API guardrail by calling POST /guardrails/register with a team-scoped key. The registration does not activate anything. The submission stays in pending_review until an admin approves it in the UI, so the team lead's job is to make the submission complete enough that the reviewer does not have to guess. Describe what the guardrail inspects, which request stages it applies to, what it returns when it blocks, and which external service it calls. Name the owner who will answer questions and maintain the endpoint after approval.
- Scope of inspection: State whether the guardrail reads prompts, responses, tool calls or all three, and whether it needs the full conversation or only the last message.
- Failure behavior: Specify whether a timeout or error should block the request or let it pass, and confirm that choice with the security team before submitting.
- Named owner: List the person or group responsible for the external service, its certificates and its availability.
- Test evidence: Attach sample requests and expected outcomes, including one clean input and one that should be blocked.
- Change plan: Explain how the team will notify the platform admin before changing the endpoint or response format.
Before submitting, confirm that the team-scoped key covers only this team's registrations and that the endpoint you name is the one you intend to run in production.
The platform admin owns the gateway, so approval is the point where a team's guardrail becomes part of live traffic for every model and key it is attached to. Review the submission in the admin UI and check that the guardrail name, scope and attachment plan match what the team described. Confirm that the guardrail is not attached to more traffic than requested, because a policy that applies to all requests changes behavior for every team on the gateway. Check that the endpoint is reachable from the gateway's network, not only from the team's workstation, and that the gateway can reach it through any egress rules, proxies or firewall policies your organization enforces.
- Network reachability: Test from the gateway pods or hosts, using the same DNS, proxy and certificate trust the gateway uses.
- Attachment scope: Confirm whether the guardrail attaches to a single team, key or model, or to a broader policy.
- Latency impact: Measure the added time per request in a staging environment before approval, since an external call runs in the request path.
- Credential handling: Confirm that any credential the external service needs is stored in your secret manager and not pasted into the registration payload.
- Rollback path: Know how to detach or disable the guardrail quickly if it causes errors.
A useful final check is to run one test request through the guardrail in staging and confirm the gateway logs show the guardrail ran, with the expected result.
The security reviewer decides what data leaves the gateway. A Generic Guardrail API guardrail sends the content it inspects to an external service, so every prompt, response or tool output that passes through it is a data transfer that must be justified. Ask the team to list each data element sent, including user identifiers, metadata and any personal data that may appear in prompts. Check where the external service runs, which jurisdiction holds the data, how long it retains request content, and whether it uses that content for its own purposes. Compare these answers with the data handling terms your organization has agreed for other processors. Review the transport security as well, including TLS version, certificate validation and whether the endpoint accepts only authenticated calls.
- Data inventory: Require a written list of fields sent per request and whether each one is needed for the check.
- Retention and training use: Obtain the provider's retention period and confirm whether content is used for model training.
- Transport and authentication: Confirm encrypted connections, certificate validation and per-team credentials that can be revoked.
- Location: Record the region or data center that processes the content and check it against your residency rules.
- Logging overlap: Check whether the gateway also logs the blocked or inspected content, so the same data is not stored in two places without a retention plan.
Before approving, confirm that the data flow described in the submission matches what the endpoint actually receives by inspecting a test payload.
Set up policies, attachments and team registration in order
This sequence builds guardrail policies from the bottom up, so each scope is attached only after the layer beneath it has been tested. The result is a gateway where org-wide controls, team and key rules, and model-specific rules each behave as intended, and where team-submitted guardrails stay inactive until an admin approves them.
Confirm database and admin UI access
The platform team confirms that the LiteLLM proxy is running against PostgreSQL, since virtual keys need a PostgreSQL database, and that an admin account can sign in to the admin UI. Confirm the master key is stored in your secret manager and not in configuration files. Verify by logging in as an admin, creating a test virtual key, and confirming it appears in the UI and survives a proxy restart.
Define base guardrails
Create the individual guardrails the policies will use, such as a built-in regex or keyword check or a registered external guardrail service. Record for each one its mode (pre_call, during_call or post_call), what it does on a match, and who owns it. Verify by sending a test request that you know should trigger each guardrail and confirming the expected block, mask or log entry in the request logs.
Group guardrails into policies
Combine the base guardrails into named policies that match your control intent, for example a baseline policy for all traffic and a stricter policy for a sensitive workload. Where one policy should extend another, set up inheritance now so the parent rules are not copied. Verify by viewing each policy and confirming it lists the expected guardrails, including those inherited from its parent.
Attach the baseline policy to all traffic
Attach the baseline policy to all requests using policy_attachments before adding narrower scopes. This sets a floor that every team, key and model inherits. Verify by sending requests with two different keys and to two different models, and confirming in the logs that the baseline guardrail ran on each one.
Add team, key and model attachments
Attach stricter or additional policies to specific teams, keys or models. Test each scope separately: a request from the target team, a request with a key in that team, and a request to the target model from another team. Confirm that overrides apply only where intended and that other teams are not affected. Record the results so later changes can be tested the same way.
Enable team guardrail registration
Let team administrators register Generic Guardrail API guardrails with a team-scoped key through POST /guardrails/register, if your model permits it. Confirm the team-scoped key can only register guardrails for its own team. Verify by submitting a test registration and checking it is stored with a pending_review status in the admin UI.
Confirm pending guardrails stay inactive until approval
Send requests that would trigger the pending guardrail and confirm in the logs that it does not run. Then have an admin approve it in the UI, attach it to the intended scope, and repeat the test to confirm it now runs. Keep the approval record with the change ticket so reviewers can see who approved each team-submitted guardrail and when.
How a request resolves its guardrail policies
A request starts with a virtual key sent to the LiteLLM proxy, which resolves the owning team, the key and the requested model. The gateway then collects policy attachments that apply to all traffic and those scoped to that team, key or model, expands inherited parent policies, and runs the approved guardrails. Check that a team-registered external guardrail is listed only after admin approval, and confirm which path returns a block before the provider call.
Policy resolution for one request, with the external guardrail boundary marked.
Security risks in team-scoped guardrail policies
Team-scoped guardrails let each team add checks to its own traffic, which is useful and also widens what the gateway trusts. The risks below cover who can add a guardrail, where prompt data goes, which keys end up screened, and how inherited policies can be weakened without anyone noticing.
External endpoints receive prompt data
A guardrail registered through the Generic Guardrail API sends prompt and response content to the endpoint the team names. That endpoint may sit outside your network, be operated by a vendor you have not reviewed, or log what it receives. Before approval, confirm the hostname, the hosting region, retention on the receiving side and whether the endpoint can be called by anyone holding the team key. Treat every registered endpoint as a new data recipient for personal and confidential data.
Team guardrails docsAdmin-only approval before activation
Registrations stay in pending_review until an admin approves them in the UI, so that approval is the main control between a team's submission and live traffic. Limit approval rights to a named group, separate it from the people who register guardrails, and record who approved each change and why. Without this separation, a team can register a check and promote it to production in the same hands.
Team keys that can register guardrails
Registration uses a team-scoped key at POST /guardrails/register, so that key effectively becomes a privilege to change what screens the gateway's traffic. Store team keys in a secret manager, rotate them when people change teams, and avoid sharing one key across several teams. Ask who can view or regenerate these keys, and confirm that a key scoped for model calls cannot also submit guardrail registrations.
Over-broad or missing attachments
A policy attached to all requests applies everywhere, which can slow every team, while a policy attached only to certain teams or models leaves other keys unscreened. Keys created outside the intended team, or models added later, may fall outside the attachment entirely. Export the list of policy attachments, compare it against your key and model inventory, and run this comparison on a schedule rather than once at go-live.
Guardrail policies docsOverrides that weaken inherited policies
Policies can inherit from other policies, so a child policy that overrides a control may quietly remove a check that a parent expected to apply. Nothing in the attachment list alone shows that a screen was turned off, because the policy still appears attached. Review each child policy against its parent, keep a short list of controls that teams may not override, and require a written reason for any override that reduces screening.
Approved guardrails that drift
An approved guardrail can change behavior after approval if its endpoint, configuration or mode changes on the receiving side. Teams may also keep sending traffic to an old registration after a replacement is approved. Recheck the approved endpoint on a schedule, log changes to guardrail configuration, and retire registrations that no policy uses. Confirm whether your LiteLLM release records configuration history for guardrails before you rely on it for audit evidence.
Questions buyers ask about guardrail policies per team and key
What does a guardrail policy rollout cost and what drives the effort?
The cost depends mostly on how many policies, teams and models you need, how many external guardrail services are involved, and how many approval rules you want. Each external service adds configuration, credential handling and testing work, and each team that registers its own guardrail adds a review step. Ask any partner for a quote built from a written list of policies, attachment points (all traffic, teams, keys or models), external services and approval workflow. Confirm with your own team whether the policy requirements already exist in writing, because undefined requirements are the most common reason effort grows during the build.
How long does a first guardrail policy rollout take?
Duration follows scope. A rollout that attaches one policy to all traffic and uses built-in checks is much shorter than one that defines layered policies, inherits and overrides them per team, connects external guardrail services and sets up team registration with admin approval. The longest phases are usually requirements agreement, testing that each policy blocks or masks what it should without breaking legitimate traffic, and the approval workflow for team-registered guardrails. Ask for a timeline tied to the written scope and to the environments you must test in, including any staging gateway.
What must our team supply before a policy build starts?
Three inputs drive most of the work. First, written policy requirements: which data types, prompt risks and tool behaviors must be screened, and what should happen on a match (block, mask or log only). Second, guardrail endpoints and credentials for any external services, along with their owners and failure expectations. Third, named approvers for team-registered guardrails and for changes to policies that apply to all traffic. Your security and compliance leads should also confirm the teams, keys and models in scope, since policies attach to those objects. Missing approvers are a frequent cause of delay.
Can an internal platform team run guardrail policies without a partner?
Yes, if the team has working knowledge of LiteLLM configuration, a PostgreSQL-backed proxy, and the admin UI. Policy design is the harder part: deciding which checks belong to which team, how policies inherit and override each other, and how a blocked request is explained to a user. Team-registered guardrails also need an approval process that your organization is prepared to run. Internal teams often do well with a short pilot on one model and one team before expanding. Be honest about capacity, since policies need ongoing review as teams, models and threats change.
How do guardrail policies change when we upgrade LiteLLM?
Policy objects and attachments should be exported and tested on every upgrade, because a new release can change how guardrails are evaluated or displayed. Confirm current behavior against the release you plan to run, not an older example. LiteLLM maintains support for the four most recent stable minor versions, so plan upgrades within that window and keep a staging gateway with a copy of your policy configuration. Test blocking, masking and inheritance behavior, plus any external guardrail calls, before promoting the upgrade. Record which version the policies were validated on.
Do team-registered guardrails need admin approval, and what is the risk if they do not?
Team-registered guardrails, submitted through the Generic Guardrail API with a team-scoped key, stay in a pending review state until an administrator approves them in the UI. This keeps a team from adding a check that changes traffic for others without review. Without approval, a misconfigured guardrail could block requests, leak data to an unapproved endpoint or silently allow content. Define who approves, what they check (endpoint ownership, data sent, failure mode) and how approvals are recorded, and confirm the feature set in your edition with the LiteLLM documentation before relying on it.
What should we ask a partner before agreeing to a guardrail policy scope?
Ask for a written scope that lists each policy, what it screens, where it attaches, which external services it calls, and how failures are handled. Ask how the partner will test blocking, masking and logging behavior, and whether testing includes attempts to bypass policies through inheritance or override mistakes. Ask who owns the configuration after handover and how changes are reviewed. Request a clear split of responsibilities for policy requirements, external service setup and approvals. Ask what happens when an upgrade or new team request arrives after go-live.
How DeployOpen scopes and supports guardrail policy work
DeployOpen scopes guardrail policy work as a fixed-scope engagement. Before any configuration starts, the scope, deliverables and timeline are agreed in writing. For this topic, a written scope typically names the policies to build, which ones attach to all traffic and which attach to specific teams, keys or models, how policies inherit from one another, and whether teams may register their own Generic Guardrail API guardrails through the team registration path. It also states which environment the work covers, since the gateway, its PostgreSQL database and any Redis instance run in infrastructure the client controls. A quote follows from that written scope, so the client can compare it with the cost of doing the same work internally.
DeployOpen configures the policies and their attachments on the self-hosted LiteLLM gateway, then tests each scope in the agreed list. Testing means sending requests as each team and key the policy is meant to cover and confirming that the expected guardrails run, that inherited rules apply and that overrides behave as written. It also means confirming that a team-registered guardrail stays in pending_review until an admin approves it, and that a rejected or unapproved guardrail never runs. Each test result is recorded against the scope item it covers, so the client can see what was checked, what failed and what was fixed. The client should ask how many test cases are included and who signs off the results.
Guardrail policies change as teams, models and threats change, so DeployOpen also offers optional retainers for ongoing review. A retainer can cover reviewing new policy attachments, checking approval queues for team-registered guardrails and retesting after LiteLLM upgrades. Retainer scope, frequency and response expectations are set in writing, like the initial project. DeployOpen prepares configuration, test records and review notes that the client's security and compliance teams can examine, but it does not issue audit reports or certifications. Independent assessors decide whether the controls meet a given requirement, so the client should confirm with its assessor which evidence they expect.

