TL;DR: The OpenAI Python and Node.js SDKs are the most common way applications interact with AI. AI Privacy Gateway is fully OpenAI-API-compatible — just change the base URL..
Integration = one config change. No SDK changes needed.
Why Add PII Masking to OpenAI SDK?
The OpenAI Python and Node.js SDKs are the most common way applications interact with AI. AI Privacy Gateway is fully OpenAI-API-compatible — just change the base URL.
How It Works
Your App + OpenAI SDK
→
Privacy Gateway
(masks PII locally)
→
AI API
(receives clean data)
✓ PII masked before leaving your machine ✓ Zero code changes in your OpenAI SDK integration
Benefits
✓
100% OpenAI API compatible — drop-in replacement base URL
✓
Streaming, function calling, and vision all supported
✓
Works with any OpenAI-compatible provider (DeepSeek, Groq, etc.)
Setup: Connect OpenAI SDK to AI Privacy Gateway
Configuration — Change One Line
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:9999/v1", # Proxy through privacy gateway
api_key="your-openai-api-key"
)
# All PII in messages is auto-masked before reaching OpenAI
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "..."}]
)
Step-by-Step Setup
- 1 Deploy gateway: docker run -d -p 9999:9999 ghcr.io/gunxueqiu6/ai-privacy-gateway:lite
- 2 Set base_url="http://localhost:9999/v1" in OpenAI() client init
- 3 Your OpenAI API key still works — gateway transparently forwards it
Start Protecting Your OpenAI SDK Data
Deploy AI Privacy Gateway in 30 seconds. Free and open source.
Frequently Asked Questions
Does this work with the latest version of OpenAI SDK?
Yes. AI Privacy Gateway works at the HTTP layer as a transparent proxy. It is compatible with any version of OpenAI SDK that makes HTTP API calls.
Will this affect my OpenAI SDK performance?
The gateway adds less than 1ms per request. The PII detection engine is written in Rust for maximum throughput, so your OpenAI SDK application performance will not be noticeably affected.
Can I use this with multiple AI providers through OpenAI SDK?
Yes. Route all your AI API calls through the same gateway. It works transparently with any OpenAI-compatible API — just change the base URL.