Privacy-preserving AI chat interface that masks sensitive data before it reaches the LLM.
PromptShield acts as a security firewall between users and GPT/LLM APIs, ensuring personal information never leaves the system.
Users frequently paste real-world information into AI tools without realizing the risks.
Sensitive data commonly exposed:
- Code Secrets
- Names
- Emails
- Phone numbers
- Addresses
- Employee IDs
- Medical or financial information
- Internal or confidential company data
Since prompts are sent directly to third-party APIs, this data leaves the device — creating serious privacy, compliance, and enterprise security risks.
Most AI systems rely on user caution.
There is no architectural guarantee that personal data is protected.
PromptShield enforces privacy by architecture, not policy.
Before any prompt leaves the device:
- Sensitive data is detected
- It is replaced with placeholders (
<NAME_1>,<PHONE_1>) - Only masked content is sent to the model
- Original values are restored locally after response
User → Masking → LLM → Rehydration → User
- LEFT: Human View (Real Data)
- RIGHT: Model View (Masked Data Only)
This guarantees zero raw personal data reaches external APIs.
- 🔒 Real-time sensitive data masking
- 🧠 Compatible with Gemini / OpenAI / any LLM
- 🔁 Deterministic rehydration
- 🧩 Split-screen privacy visualization
- ⚡ Fast local processing
- 🛡 Zero raw data sent externally
- 🧾 Security audit logging
- 🔍 Optional OCR support
- Masking occurs server-side before LLM transmission.
- Only placeholder tokens are sent to external APIs.
- Original sensitive values never leave the system.
- Rehydration happens locally after model response.
- Vault mappings are stateless and scoped per request.
- React
- TypeScript
- Vite
- FastAPI
- Python
- OpenRouter API (model-agnostic LLM routing)
- Compatible with OpenAI, Gemini, Anthropic and other providers via OpenRouter
- Secure masked transmission using HTTPX
backend/
│── app/
│ ├── main.py # FastAPI entry point
│ ├── chat_adapter.py # Frontend compatibility layer (/chat routes)
│ ├── masker.py # PII masking engine
│ ├── rehydrator.py # Local placeholder restoration
│ ├── llm_proxy.py # LLM routing (OpenRouter/httpx)
│ ├── ocr_processor.py # OCR support for files
│ ├── code_masker.py # Secret masking for source code
│ └── __init__.py
│── tests/
│ ├── test_code_masker.py
│ └── test_pipeline.py
frontend/
│── src/
│ ├── components/
│ ├── pages/
│ ├── services/
│ ├── theme/
│ ├── types.ts
│ └── main.tsx
│── index.html
│── vite.config.ts
git clone <repo-url>
cd prompt-shieldcd backend
python -m venv venv
venv\Scripts\activate # mac/linux: source venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000Backend runs at:
http://localhost:8000
cd frontend
npm install
npm run devFrontend runs at:
http://localhost:3000
Create a .env file inside backend/:
GEMINI_API_KEY=your_key
OPENAI_API_KEY=your_key
- Start backend
- Start frontend
- Enter text in the LEFT panel
- Masked content is sent to the model
- Response is rehydrated locally
No personal data ever leaves the system.
Processes text input through masking → LLM → rehydration pipeline.
Processes uploaded image/PDF through OCR → masking → LLM → rehydration.
Basic service status endpoint.
cd backend
pytestPull requests are welcome. Please open an issue before major structural changes.
MIT License