aliasgate
A self-hosted gateway that sits between your users and an LLM API. It replaces customer data with placeholders before the request leaves your network and puts the real values back in the answer. The model never sees real data. The user never sees placeholders.
user / app aliasgate LLM provider
─────────── ───────── ────────────
"Email Juan Pérez ──▶ detect + replace ──▶ "Email [PERSON_1]
(juan@acme.es) about ([EMAIL_1]) about
the ACME contract" the [ORG_1] contract"
"Dear Juan Pérez, ..." ◀── restore ◀── "Dear [PERSON_1], ..."
Status: alpha (0.2.0). The gateway pseudonymises OpenAI Chat Completions and Anthropic Messages requests, streaming and tool calls included, with rules, company dictionaries and an optional local ML model, and restores the answers. It has not run in production yet. Start with the usage guide.
Quick start
pip install aliasgate
echo "{}" > aliasgate.yaml # every key is optional: rules only, port 8080 on loopback
aliasgate check --config aliasgate.yaml
aliasgate serve --config aliasgate.yaml
export OPENAI_BASE_URL=http://localhost:8080/v1 ANTHROPIC_BASE_URL=http://localhost:8080
serve keeps running. In another shell, the last line points OpenAI and Anthropic clients at
the gateway, which forwards their usual API key. Dictionaries for your customers' names, the ML model, Docker images, Azure
OpenAI, Claude in Microsoft Foundry and tuning are in docs/usage.md.
Why
Many companies forbid sending customer data to external LLMs, and their staff still need LLMs to work on documents full of customer data. aliasgate is a technical control for that conflict: you point your OpenAI or Anthropic client at the gateway instead of the provider, and nothing else changes.
Design in brief
- Four detection layers. Rules with checksum validation (emails, IBANs, cards, national IDs, phones, secrets), a company dictionary (your customers, projects, codenames and their aliases), a pluggable local ML model for names, organisations and addresses, and propagation of every detected value to all its other occurrences.
- Deterministic mapping. Inside a request the same value always becomes the same placeholder, and placeholders are numbered so the model can tell entities apart.
- Reversible, including streams and tool calls. Placeholders split across streamed chunks are buffered and restored correctly. This is verified with property tests.
- Nothing reversible at rest. The placeholder-to-value mapping exists only in memory while a request is being served. There is no vault to steal.
- Fail closed. If detection fails, or the request carries content the gateway cannot inspect, the request is rejected instead of forwarded.
- Self-hosted. No data is sent anywhere except to the LLM provider you configure, and only after pseudonymisation.
What it does not guarantee
No detector finds everything, and text without any name can still identify a person through context. aliasgate greatly reduces the personal and confidential data that reaches a provider. It does not make data anonymous and it does not, by itself, make a deployment compliant with any regulation. Read the threat model before relying on it.
Documentation
| Document | Content |
|---|---|
| docs/usage.md | Install, configure, point clients at the gateway, tune detection, error codes, metrics |
| docs/deployment.md | Network placement, container, sizing, monitoring, deployment checklist |
| docs/evaluation.md | Measuring detection on your own samples |
| CHANGELOG.md | Changes by version |
| docs/state-of-the-art.md | Existing tools, detection models, research evidence, legal context, feasibility |
| docs/architecture.md | Components, algorithms, data flow, decisions |
| docs/threat-model.md | What is protected, from whom, and the residual risks |
| docs/plan/README.md | Implementation plan in vertical slices |
| AGENTS.md | Working rules for coding agents and human contributors |
Roadmap
| Slice | Deliverable | Status |
|---|---|---|
| 00 | Repository scaffold, tooling, CI | done |
| 01 | Core types, placeholder codec, mapping | done |
| 02 | Rule-based detectors with checksums | done |
| 03 | Pseudonymisation engine and restoration | done |
| 04 | Configuration and company dictionary | done |
| 05 | OpenAI Chat Completions payload handling | done |
| 06 | HTTP proxy (non-streaming) | done |
| 07 | Streaming restoration | done |
| 08 | Anthropic Messages dialect | done |
| 09 | ML detector (GLiNER) | done |
| 10 | Leak audit, policy, metrics | done |
| 11 | Evaluation harness | done |
| 12 | CLI, Docker image, first release | done |
| 13 | Dictionary aliases (entity linking, part 1) | done |
Development
Requires uv.
uv sync
uv run ruff format --check . && uv run ruff check . && uv run mypy && uv run pytest --cov -m "not ml"
See CONTRIBUTING.md.
License
Metadata
Release files for aliasgate 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aliasgate-0.2.0.tar.gz | 456.1 kB | With provenance | Details for aliasgate-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aliasgate-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for aliasgate-0.2.0-py3-none-any.whl |
Total release size: 534.5 kB
Release files / aliasgate-0.2.0.tar.gz
| Download URL | aliasgate-0.2.0.tar.gz |
|---|---|
| Size | 456.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b26e3e7aa33dbf127ae4642792d5ded3ed5e377243cf6290d02264af9f0ccda9
|
|
BLAKE2b-256 checksum How to use checksums |
8e776a15738029a912262364b53f4cc4bbbb94dfb2805ebea86070f90b825e6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logRelease files / aliasgate-0.2.0-py3-none-any.whl
| Download URL | aliasgate-0.2.0-py3-none-any.whl |
|---|---|
| Size | 78.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8bf5a6f718b36a942023ca83d8c1825d9b83262ecc7a264de5c6f2089bf058a2
|
|
BLAKE2b-256 checksum How to use checksums |
02b6c79f2d0e44f3cb48ee51c517d601aab2bf83f15c2a80842be70865359385
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logSecurity for aliasgate 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for aliasgate-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.