AI Gateway policy
The AI Gateway is a component of Stacklok Enterprise. For a full comparison of ToolHive Community and Stacklok Enterprise capabilities, see Stacklok Enterprise.
The AI Gateway sits between your AI tools and your large language model (LLM) providers, so every model request passes your policy, identity, and audit controls before it leaves your environment. This section covers the day-to-day governance decisions: which providers you connect, which models your users can reach, what gets screened out of prompts, and what any one person or team is allowed to spend.
How configuration works
Gateway configuration is declarative. A single AIGateway custom resource
describes the whole gateway, and the operator reconciles the running
infrastructure to match it. You apply changes with kubectl apply (or through
whatever GitOps flow you already use) and the operator converges.
Two things do not live on that resource:
- Budgets and pricing are rows you manage through a REST API, not manifest fields. A budget is created, edited, and deleted independently of every other budget. See Budgets and pricing.
- Access lists and MCP policy live on a separate
AIPolicyresource, so they can be edited frequently without touching gateway infrastructure.
For every field on both resources, see the AI Gateway CRD reference. The pages in this section cover the tasks; the reference covers the fields.
Before you start
The AI Gateway must already be installed. See Configure the AI Gateway for the install-time settings, and Deploy the platform for the full sequence.
Examples on these pages use -n <NAMESPACE>, where <NAMESPACE> is the
namespace your AI Gateway is installed into.
Contents
Model providers
Connect OpenAI, Anthropic, AWS Bedrock, Azure OpenAI, Google Vertex AI, and OpenAI-compatible providers to the AI Gateway, and rotate their credentials.
Model routing
Map model names onto providers with a default route, weighted load balancing, priority failover, retries, and timeouts on the AI Gateway.
Budgets and pricing
Cap LLM spend per user or group in USD, publish a pricing catalog, and understand why an unpriced model is refused at the gateway.
Prompt injection screening
Screen inbound prompts for injection attacks with AWS Bedrock Guardrails, including rollout from monitor to enforce, IAM setup, and cost.
PCI/PII controls
Scan prompts and responses for credit cards, national identifiers, and other sensitive data, and block, redact, or log what is found.
Audit logs
Enable structured audit events for model requests, detections, and key lifecycle, then ship them to Splunk, Elastic, Kafka, or Loki.