Skip to main content

PII anonymizer as a LLM proxy

Project description

AnonTex

AnonTex is a privacy-first experimental LLM proxy that anonymizes Personally Identifiable Information (PII) before forwarding requests to the OpenAI Completion API. It is designed to be compatible with the /v1/chat/completions endpoint, making it a drop-in proxy with minimal integration effort.

⚠️ Note: This is an experimental project. Use with caution in production environments.


✨ Features

  • Acts as a transparent proxy for OpenAI's chat completion endpoint.
  • Automatically anonymizes user input using PII detection.
  • Redis-backed for entity management and fast caching.

📦 Installation

Install via pip:

pip install anontex

Note: Redis is a required external dependency for caching and PII management. Make sure you have Redis running locally or remotely.


🚀 Usage

Once installed and configured, AnonTex runs a proxy server compatible with OpenAI’s Chat Completion API.

🔁 Example with curl

curl --request POST \
  --url http://localhost:8000/v1/chat/completions \
  --header 'Authorization: Bearer YOUR-OPENAI-API-KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-4o-mini",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Hello! My name is John Smith"
      }
    ]
  }'

⚙️ Configuration

Running Locally

Start the proxy via CLI:

anontex run

CLI Options

  • --host: Server host (default: 0.0.0.0)
  • --port: Server port (default: 8000)
  • --config: Path to configuration file (default: spacy engine configs)
  • --log-level: Logging level (default: info)

Config File (Optional)

You can pass settings via a YAML config file. Read the following documentation to customize the config file.

This project uses the presidio-analyzer Python package as an entity detector. You can use the default config file without specifying a custom file or point to a presidio-analyzer supported config file.

.env File (Optional)

Additional configurations can be done via environment variables in a .env file. If .env is not set, default values will be used. Read the following documentation to customize the .env file.


🐳 Docker Deployment

You can deploy AnonTex with Docker using Docker Compose.

Clone repo:

git clone https://github.com/ChamathKB/AnonTex

Run:

docker compose up -d

🚧 Limitations & Future Improvements

  • ❌ No support for multi-turn PII tracking (PII memory is per-message only).
  • 🔗 Only supports OpenAI API compatible endpoints.
  • 🌐 Limited language support (primarily English).
  • 📈 Planned support for:
    • Multi-turn entity memory
    • Custom anonymization rules
    • Model switching and vendor abstraction
    • Analytics & tracing integration

🤝 Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you’d like to change.


📄 License

This project is licensed under the Apache 2.0 License.


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

anontex-0.2.5.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

anontex-0.2.5-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file anontex-0.2.5.tar.gz.

File metadata

  • Download URL: anontex-0.2.5.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.11 Linux/6.8.0-58-generic

File hashes

Hashes for anontex-0.2.5.tar.gz
Algorithm Hash digest
SHA256 f983fbc902fd704889dbffee96216f8eeb8cec69436efb8bcd2887c4cf26490e
MD5 8f3c1ac6ecbf07cc60b0eb0b782ab7e7
BLAKE2b-256 8973f9c1497d8634f79b4ca349278ec7508514a42f0764a1a863dc7f190215e0

See more details on using hashes here.

File details

Details for the file anontex-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: anontex-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.11 Linux/6.8.0-58-generic

File hashes

Hashes for anontex-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 48ed30de1d214f5162fc5ffbd9a0a926a41236e68ddc3a3264eaa9fcac8c10dd
MD5 3fa13b24d1c05dd45a410f59ac9cc543
BLAKE2b-256 0e52f815f23e311b845e44172ac1a53a4801b67f65ccf579ed9bb9e1bc58c8a2

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