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.

for additional dependencies with transformers:
pip install anontex[transformers]

🚀 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.6.tar.gz (16.9 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.6-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: anontex-0.2.6.tar.gz
  • Upload date:
  • Size: 16.9 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.6.tar.gz
Algorithm Hash digest
SHA256 8e3931d063ac1cb95b75288aa68daac95bf2c0ee083e0350d0026d81c5bb3bd2
MD5 be986f2a2e3d38b27901899570362030
BLAKE2b-256 62815058a1bf00387e8ec88036ed657d405f72ea315ff0670f5d03938fa71874

See more details on using hashes here.

File details

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

File metadata

  • Download URL: anontex-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 19.7 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1c5acd6374bc9ec8c5719b6cb31d9ef73d54af95ece79e563cdac2b0a3696b96
MD5 f7cbbee777e40deb51930d0b516adb72
BLAKE2b-256 2fd34a48e226b61a7783d4d9bd4038e0d14155f5615bfd53d770c39b7374e642

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