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

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.3.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.3.0
File Size Uploaded Provenance Actions
aliasgate-0.3.0.tar.gz 468.8 kB With provenance Details for aliasgate-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 548.6 kB

Release files / aliasgate-0.3.0.tar.gz

Download URL aliasgate-0.3.0.tar.gz
Size 468.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0faf7158e842a344e09964a90ccef8174c7b89412a6eab9b468ebe856c5cbaf9
BLAKE2b-256 checksum
How to use checksums
9f327f3be72d5fbd05fd9fc22955eb6b4c614044793b6c8a4aacbdf8f498427f
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 log

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

Download URL aliasgate-0.3.0-py3-none-any.whl
Size 79.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22c5f55dee347b0dfb0f7b35daf7386185f80ce9764dda667abb84ec12d8f64a
BLAKE2b-256 checksum
How to use checksums
43a340f7c010f54c87123441f1b392ed25349fa05967be6a78d50b9f6dc19043
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 log

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