Skip to main content

Enterprise Zero-Egress Privacy Redaction Proxy Engine for LLMs

Project description

LLM-Shield - Enterprise Privacy Redaction Engine

PyPI Version License Python Version

LLM-Shield is an open-source, zero-egress middleware proxy that intercepts OpenAI-compatible LLM API requests, redacts Personally Identifiable Information (PII) before it leaves your local infrastructure, and deterministically re-hydrates real-time SSE streaming responses without breaking stream latency.

Designed for enterprise privacy compliance (SOC 2 / HIPAA).

Author & Core Maintainer: Ninad Phalak (ninad.phalak@gmail.com)


⚡ Core Features

  • Zero Latency Streaming: Sliding-window tag-safety buffer intercepts SSE streams delta-by-delta without buffering full requests or responses.
  • Zero Cloud / Zero Egress: 100% local processing. No external API calls for PII detection.
  • Two-Tier PII Cascade Engine:
    • Tier 1 (Sub-millisecond Regex): SSNs, Credit Cards, Email Addresses, Phone Numbers, IPv4/IPv6, API Keys.
    • Tier 2 (NER Engine): Person Names and unstructured entities.
  • Deterministic Re-Hydration Vault: Swaps PII with session-bound tokens (e.g., Sarah -> [PERSON_1]). Maps back deterministically when the LLM streams responses. Supports request-scoped and session-scoped (X-Session-ID) vaults.
  • SOC 2 Structured Audit Logging: Emits JSON structured audit logs for compliance monitoring.
  • Opt-In Telemetry: Strictly opt-in (TELEMETRY_ENABLED=false by default) telemetry worker collecting aggregated volumetric metrics with an explicit zero-PII guarantee.

📦 Installation

Install llm-shield-proxy directly from PyPI via pip:

pip install llm-shield-proxy

Or install locally in editable mode:

pip install -e .

🚀 Quickstart

Running via Python / Uvicorn

uvicorn app.main:app --host 0.0.0.0 --port 8000

Running via Docker Compose

docker-compose up -d

Usage with OpenAI Client

Point your base URL to LLM-Shield (http://localhost:8000/v1):

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="your-openai-api-key"
)

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "user", "content": "Contact Sarah Connor at sarah@example.com"}
    ],
    stream=True
)

for chunk in response:
    print(chunk.choices[0].delta.content or "", end="")

🧪 Testing

Run the full automated test suite:

py -m pytest tests/

🏢 Using LLM-Shield in Production?

We are actively working with enterprise security teams to map out advanced compliance features. If your startup or organization is using LLM-Shield to unblock LLM streaming or pass SOC 2/HIPAA audits, I would love to hear from you.

Email the core maintainer at ninad.phalak@gmail.com to share your feedback, request a feature, or feature your team as a case study.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_shield_proxy-1.0.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_shield_proxy-1.0.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file llm_shield_proxy-1.0.0.tar.gz.

File metadata

  • Download URL: llm_shield_proxy-1.0.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for llm_shield_proxy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 56970f63f677163191709f5e27fb511473b29b1f762c4c7524260583e84a4a68
MD5 15c4d7453b29776c0125d1471e83494a
BLAKE2b-256 400538de12f39c6c84bd562d27a0df4676590dc192255ac45cef994562590e6c

See more details on using hashes here.

File details

Details for the file llm_shield_proxy-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_shield_proxy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec4c9b0f493b6df9834da4cf39c45dc7886f051a158438d95385c3a17fb00599
MD5 7100df8874c72436f9399801b6903858
BLAKE2b-256 463f3af84f7033c6b3aeb390a53a090ea73237b2a6dc6454b5a660357e014e76

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page