TL;DR: LlamaIndex RAG applications often process sensitive documents. AI Privacy Gateway ensures PII is masked both during embedding and during LLM generation — without changing your LlamaIndex code..
Integration = one config change. No SDK changes needed.
Why Add PII Masking to LlamaIndex?
LlamaIndex RAG applications often process sensitive documents. AI Privacy Gateway ensures PII is masked both during embedding and during LLM generation — without changing your LlamaIndex code.
How It Works
Your App + LlamaIndex
→
Privacy Gateway
(masks PII locally)
→
AI API
(receives clean data)
✓ PII masked before leaving your machine ✓ Zero code changes in your LlamaIndex integration
Benefits
✓
Protects sensitive documents in RAG pipelines
✓
Works with all LlamaIndex LLM backends
✓
No changes to ingestion or query pipelines
Setup: Connect LlamaIndex to AI Privacy Gateway
Configuration — Change One Line
from llama_index.llms.openai import OpenAI
llm = OpenAI(
model="gpt-4o",
api_base="http://localhost:9999/v1", # Route through privacy gateway
api_key="your-api-key"
)
Step-by-Step Setup
- 1 Deploy the privacy gateway as a Docker container
- 2 Set api_base="http://localhost:9999/v1" in your LlamaIndex LLM config
- 3 Documents are now PII-masked before embedding and generation
Start Protecting Your LlamaIndex Data
Deploy AI Privacy Gateway in 30 seconds. Free and open source.
Frequently Asked Questions
Does this work with the latest version of LlamaIndex?
Yes. AI Privacy Gateway works at the HTTP layer as a transparent proxy. It is compatible with any version of LlamaIndex that makes HTTP API calls.
Will this affect my LlamaIndex performance?
The gateway adds less than 1ms per request. The PII detection engine is written in Rust for maximum throughput, so your LlamaIndex application performance will not be noticeably affected.
Can I use this with multiple AI providers through LlamaIndex?
Yes. Route all your AI API calls through the same gateway. It works transparently with any OpenAI-compatible API — just change the base URL.