Your engineers’ coding agents already call api.anthropic.com from their laptops, and that traffic never passes through a gateway you configured. An AI gateway for security teams has to sit where those calls start, not only in front of the apps you build.
What is an AI gateway?
An AI gateway is a proxy between the clients that call AI models (apps, agents and employees) and the model providers’ APIs. Every request passes one control point, so you can authenticate it, apply policy, log the prompt and response, and track cost. An LLM gateway and an LLM proxy are the same thing under different names.
Most AI gateways in today’s search results are built for developers. A team points its app’s base URL at the gateway to switch between models, add caching and rate limits, and see token costs per app. That’s a real need, and it’s a different job from the one a security team has. A secure AI gateway, or AI security gateway (an AI agent gateway when agents send most of the traffic), answers LLM security questions: which person or agent sent this prompt, what data was in it, which tools did the model call, and can you stop the request before it leaves? This page covers that side.
Why do security teams need a different AI gateway?
A gateway that depends on a base URL change only sees the clients someone reconfigured. Coding agents such as Claude Code, Cursor and Codex run on laptops and call their providers directly. Employees open chatgpt.com in a browser. None of that traffic crosses a gateway that lives in front of your own apps.
Agents also act: one session reads files, runs shell commands and calls MCP tools, and each tool call arrives inside the model’s response, so the gateway has to parse the provider’s wire format.
Then there’s attribution. A provider log shows the API key, while an enterprise AI gateway has to show the engineer and the agent that acted for them.
How Formal intercepts LLM traffic
Formal enforces LLM traffic in one of two places. On laptops and servers, the Formal Endpoint intercepts it with Transparent Mode on macOS and Linux, and the Formal Endpoint for Kubernetes does the same as a native Pod sidecar. For apps in your own infrastructure, a Formal Connector sits in the path. Both evaluate the same policies, then forward the request to the provider.
On the Endpoint, a network rule picks which flows to intercept. On macOS, Formal recognizes known agents by their code-signed process identity, including the processes they spawn. On Linux, it matches process names or known LLM provider hostnames. This rule from the AI governance docs intercepts LLM and MCP traffic from known agents on macOS:
{
"condition": {
"pre_tcp": process.is_agent || process.has_agent_ancestor,
"pre_tls": true,
"post_tls": technology in ["mcp", "llm"]
}
}
Apps keep calling api.anthropic.com: no SDK or base URL change. Server-side apps take the Connector path instead, with an LLM resource linked to a Connector listener and the provider hostname swapped for the Connector’s, for example https://anthropic.<connector-hostname>/v1/messages. The Endpoint can also forward its LLM traffic to a Connector rather than evaluate it locally.
Transparent Mode terminates TLS with certificates from a local Formal CA. Browsers and Go programs trust it through the OS trust store, and on macOS the Endpoint points Node.js and Python clients at it through environment variables (how TLS inspection works with each client).
Redact sensitive data before the prompt leaves
Redaction at the gateway runs on request-stage policies, before Formal forwards the prompt. A rewrite action can add, replace or remove headers, or replace the body, so you strip a value such as a US Social Security number in prompt text and tool results instead of blocking the whole session (policy evaluation docs). For the full approach, see AI data loss prevention.
Data also leaks through accounts. Anthropic’s tenant restrictions let a proxy allowlist your organization ID, and a Formal rewrite policy injects the anthropic-allowed-org-ids header on Claude traffic. Personal Claude accounts and other orgs then get a 403 from Anthropic (see the setup guide).
Can an LLM gateway detect prompt injection?
Yes, in the traffic it logs. Every 15 minutes, Formal’s Insights engine checks new LLM requests and responses against the OWASP Top 10 for LLM Applications (2025), including LLM01 Prompt Injection, LLM02 Sensitive Information Disclosure, LLM06 Excessive Agency and LLM10 Unbounded Consumption.
Each insight names the risk, the entity involved (such as a user) and the log events behind it, and Formal forwards it to your log integrations, such as Datadog, Splunk, Amazon S3, Google Cloud Storage and Azure Blob Storage, so your SIEM can alert on new findings. To enforce, write a policy. Response-stage rules read the tool calls in the model’s reply, so you can block a response that, for example, calls Bash with a specific command. That’s where prompt injection protection becomes a control rather than a report: you limit what a redirected agent can do.
LLM cost tracking and per-user spend caps
You set token prices per model and provider, Formal estimates the cost of every LLM request from them, and each log carries that cost. The Token Pricing page lists models seen in logs that still need a price, so AI spend tracking per user, model and provider becomes a log query.
Request policies read each user’s spend for today, this week and this month (UTC windows), as cost per currency and as a token count. A policy can block a user after a daily budget, cap tokens per week, or block any model that has no price yet, so a new model needs a price before anyone uses it. The spend docs include both policies.
Discover shadow AI tools and models
The AI usage pages list every model, AI client application and provider in proxied traffic, which makes them the start of AI usage monitoring and the first place shadow AI shows up. Reviewing, approving or blocking those tools is covered on shadow AI detection.
Encrypting prompts in gateway logs
An AI gateway that logs full prompts gives you LLM observability, and a new store of sensitive data. Log schemas let you encrypt prompt text, tool inputs and model replies with an encryption key you configure, or drop prompts from logs entirely. You can scope a schema to Endpoint or Connector logs, so the LLM security controls apply to your own audit trail too.
