Gateway Overview
Learn how the FastPII AI Gateway protects LLM traffic with real-time PII detection, policy enforcement, and audit logging.
Gateway Overview
The FastPII AI Gateway is an AI gateway proxy that sits between your application and your LLM providers. Every request can be inspected before it reaches the model, which lets you detect and protect PII in real time, enforce workspace policies, and record a complete audit trail for compliance and operations.
Use the Gateway when you want one control point for prompt and response traffic across OpenAI, Anthropic, Azure OpenAI, Ollama, and other providers configured in your FastPII workspace.
What the Gateway does
At a high level, the Gateway receives traffic from your application, evaluates it against FastPII detection and policy rules, applies the configured action, then forwards the allowed content to the provider.
Key features
- Real-time PII detection in LLM traffic
- Policy-based enforcement with
ALLOW,WARN,MASK,BLOCK,ESCALATE,LOG, andQUARANTINE - Multi-provider support through workspace-managed LLM provider configs
- Audit logging for every protected request
- Risk scoring and risk-level reporting
- Streaming support for low-latency chat and completion workflows
Architecture
Application
|
v
FastPII Gateway
|-- Detect PII
|-- Evaluate policies
|-- Apply protection action
|-- Write audit event
v
LLM ProviderIn practice, the Gateway becomes the trust boundary between your application and third-party model providers.
Authentication model
FastPII uses two auth patterns, depending on what you are calling:
| Use case | Auth method | Notes |
|---|---|---|
| Gateway admin and operations endpoints | X-Service-Token header | Required for /api/v1/gateway/* endpoints |
| Detection and protection API usage outside the Gateway admin surface | API key | Used for the standard detection and protection APIs |
For the Gateway docs in this section, assume Service Token authentication. Gateway endpoints do not use API key auth.
Example header:
X-Service-Token: your-gateway-service-tokenCore endpoints
| Endpoint | Purpose |
|---|---|
GET /api/v1/gateway/status | Check gateway health |
GET /api/v1/gateway/config?workspace_id=... | Read the current gateway config |
PUT /api/v1/gateway/config?workspace_id=... | Update gateway config |
GET /api/v1/gateway/providers?workspace_id=... | List providers exposed through the gateway |
GET /api/v1/gateway/policies?workspace_id=... | List policies for a workspace |
POST /api/v1/gateway/audit | Log an audit event |
GET /api/v1/gateway/dashboard?workspace_id=...&period=30d | Get summary metrics |
How a request flows through the Gateway
- Your application sends a prompt to the Gateway.
- The Gateway identifies the workspace and loads the gateway config.
- FastPII scans the content for entity types such as email, phone number, address, or national IDs.
- Matching policies are evaluated in priority order.
- The Gateway applies the selected action, such as
MASKorBLOCK. - Allowed traffic is forwarded to the selected provider and model.
- The Gateway writes an audit event with the action taken, risk level, provider, latency, and detected entity types.
Quick request flow example
Suppose your application submits this prompt:
Summarize this support ticket for john.doe@example.com and call back +420 777 123 456.With a masking policy in place, the Gateway can transform it before forwarding it to the provider:
Summarize this support ticket for ******************** and call back ***************.The resulting audit event can record data like:
{
"request_id": "req_01J9X6R6Q3Q9P7E8N6YQ3A7K2M",
"workspace_id": "ws_prod_eu",
"provider": "openai",
"model": "gpt-4o-mini",
"action": "MASK",
"entity_types": ["EMAIL", "PHONE"],
"risk_level": "MEDIUM"
}Typical rollout path
Most teams start with this sequence:
- Add one or more LLM providers.
- Configure the workspace gateway.
- Create a default masking or warning policy.
- Test policy behavior with sample prompts.
- Review audit and dashboard data before expanding coverage.
Continue with Gateway Setup to configure your workspace, then use Policies to define enforcement rules and Audit to review events and metrics.