Skip to main content

aliasgate

CI License

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.10.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
14 Rule coverage gaps done
15 Person mentions evaluation set (entity linking, part 2) done
16 Person name tokens and linking (entity linking, part 3) done
17 Lower-case, one-word, hyphenated and Don person forms (entity linking, part 4) done
18 Organisation mentions evaluation set (entity linking, part 5) done
19 Organisation name forms and linking (entity linking, part 6) done
20 Request fields forwarded unchanged (names, metadata, stop sequences, location) done
21 Object keys and label slots (tool-call arguments, tool inputs, metadata) done
22 Schema values (enum, const, default, examples, title) done
23 Role words (user, assistant) never replaced on their own done
24 Parameter, tool and model names not taken for names 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

Apache-2.0.

Metadata

Release files for aliasgate 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aliasgate 0.10.0
File Size Uploaded Provenance Actions
aliasgate-0.10.0.tar.gz 732.7 kB With provenance Details for aliasgate-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aliasgate 0.10.0
File Interpreter ABI Platform Actions
aliasgate-0.10.0-py3-none-any.whl Python 3 none any Details for aliasgate-0.10.0-py3-none-any.whl

Total release size: 833.2 kB

Release files / aliasgate-0.10.0.tar.gz

Download URL aliasgate-0.10.0.tar.gz
Size 732.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0ed8ac293cd767ba16dfdaca77190d9f04f33847e91d54e9609970c7414e0fca
BLAKE2b-256 checksum
How to use checksums
e01aea07f50c1e71a13daf0958ef34ee41e61479c789b4f5263645e5f97c717e
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 28, 2026.

Transparency log

Release files / aliasgate-0.10.0-py3-none-any.whl

Download URL aliasgate-0.10.0-py3-none-any.whl
Size 100.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d84d3ba46fd074044ebf846462ed3c59c99b12a0fa5523cfcc2843b238f0897e
BLAKE2b-256 checksum
How to use checksums
8047cac1292cd6ed1a1fbf685b79df13369f3229fe2d4e24e222ab5c212b399b
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 28, 2026.

Transparency log

Security for aliasgate 0.10.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.

Select from 2 files

Attestation for aliasgate-0.10.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 28, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page