Introduction
What is Rdakt AI and why it exists
Rdakt AI is a composable anonymization middleware for LLM interactions. It sits between your application and the LLM provider, automatically detecting and anonymizing personally identifiable information (PII) in outbound requests and deanonymizing it in streaming responses.
Why Rdakt AI?
When you send user data to an LLM, you're sending it to a third-party service. Rdakt AI ensures sensitive data never leaves your infrastructure:
- Emails, SSNs, credit cards, phone numbers — detected and replaced before the request is sent
- Names, organizations, locations — replaced with realistic synthetic values so the LLM still produces coherent responses
- Streaming responses — tokens are deanonymized in real-time as they arrive, with zero perceptible latency
How It Works
Rdakt AI implements the httpx transport protocol. You pass it as the transport layer to any SDK that uses httpx internally — OpenAI, Anthropic, and Google Gemini all do.
from openai import AsyncOpenAI
from rdakt_ai import RdaktMiddleware
import httpx
client = AsyncOpenAI(
http_client=httpx.AsyncClient(
transport=RdaktMiddleware(inner=httpx.AsyncHTTPTransport()),
),
)That's it. Every request through this client is now anonymized automatically.
Request Flow
Your App → SDK → RdaktMiddleware → Detect PII → Anonymize → LLM Provider
↓
Your App ← SDK ← RdaktMiddleware ← Deanonymize ← Stream Response ←┘Key Features
- Provider-agnostic — works with OpenAI, Anthropic, and Google Gemini
- Streaming-first — deanonymizes SSE streams in real-time
- Configurable strategies — token replacement, synthetic data, or hybrid
- Multi-turn sessions — entity mappings persist across conversation turns
- Audit mode — detect PII without anonymizing, for assessment
- Pluggable stores — in-memory, SQLite, or Redis session persistence
- Zero SDK lock-in — standard httpx transport, no monkey-patching