Three layers, each with one job
Layer 1, access: Kong AI Gateway. Open-source Kong sits in front of every model. It authenticates the caller, applies rate limits and quotas, validates the request, routes it to the right model provider, holds the provider credentials in one place, counts tokens, and opens the trace every later step writes into. I also evaluated Portkey, Gloo Gateway, Tyk, LiteLLM and TrueFoundry for this layer.
Layer 2, governance: Open Policy Agent. Policies live as code in Rego, so they are reviewed, versioned and audited like any other code. For each request the policy engine computes a risk score from four factors: who is asking (identity), from where (environment), whether this matches their usual activity (behavior), and what they are asking for (resource: data classification, tools, attachments). The weights come from the organization's risk appetite. The score decides which Layer 3 checks run, and a request whose remaining risk is still above the threshold after those checks is blocked. The same logic runs again on the answer before it is released. The process follows the NIST AI Risk Management Framework: map, measure, manage, govern.
Layer 3, guardrails: NVIDIA NeMo Guardrails and the Twin Gatekeeper. PII and PHI detection and redaction, topic control, output validation and hallucination checks. The Twin Gatekeeper is a second model, the checker, that inspects what goes into and comes out of the main model, the generator. The checker is smaller, runs locally and has a narrower job: decide whether an input carries instructions it should not, and whether an output is safe to release. A vision checker does the same for images.