maskflow
Mask PII before it reaches an LLM. Unmask the response. Works with any provider.
from maskflow import mask_and_call
def call_claude(masked_prompt: str) -> str:
return (
anthropic_client.messages.create(
model="claude-sonnet-5",
max_tokens=1024,
messages=[{"role": "user", "content": masked_prompt}],
)
.content[0]
.text
)
response = mask_and_call(
"Hi, I'm Jane Doe (jane@example.com). My order shipped to 123 Main St but never arrived.",
call_claude,
)
# Claude only ever sees "Hi, I'm <PERSON_NAME_1> (<EMAIL_1>). My order shipped to
# <ADDRESS_1> but never arrived." -- response comes back with the real values restored.
Install
pip install maskflow-sdk
python -m spacy download en_core_web_sm
Why this shape
mask_and_call takes a plain function, not a specific provider's client. You write the one line
that actually calls your LLM (Claude, OpenAI, Gemini, a local model, anything) -- maskflow never
parses or depends on any provider's SDK, so it doesn't break when a provider changes their API and
works with providers it's never heard of.
response = mask_and_call(prompt, lambda masked: my_llm_client.generate(masked))
Lower-level API
For more control than the wrapper gives, mask/unmask are available directly and are pure,
stateless functions -- no files, no database. Persisting the mapping between calls is your
responsibility.
from maskflow import mask, unmask
result = mask("Email me at alice@example.com.")
result.masked_text # "Email me at <EMAIL_1>."
result.mapping # {"<EMAIL_1>": "alice@example.com"}
unmask(result.masked_text, result.mapping) # original text, restored
What gets detected
Email, phone, SSN, credit card, IP address, AWS access key, API key / generic secret, JWT, IBAN,
street address, person name, date of birth -- via regex + structural validation (Luhn, mod-97,
etc.) plus spaCy NER for names and dates, with keyword-context confidence boosting. These 12
recognizers ship in maskflow-pack-intl, which maskflow-sdk
depends on automatically; the engine itself lives in maskflow-core and
ships with none built in.
Tests
uv run pytest
Release files for maskflow-sdk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| maskflow_sdk-0.1.1.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| maskflow_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.4 kB
Release files / maskflow_sdk-0.1.1.tar.gz
| Download URL | maskflow_sdk-0.1.1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6902a6cda6808e74935b11f46ec3a7334878241e3914e853e78096aa89ab6137
|
|
BLAKE2b-256 checksum How to use checksums |
096059f522c6f03910c2599d21a9b76f93c66c731cdde6137af96b291e1013c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 19, 2026.
Transparency logRelease files / maskflow_sdk-0.1.1-py3-none-any.whl
| Download URL | maskflow_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
899486bba7dec3934dfb30b50c39fc5dbfb63336de8b8f0c764599e9bcab75f3
|
|
BLAKE2b-256 checksum How to use checksums |
aba77d9739270a3b2ab036ff4c1fb5e575977334b297b4af434b878a559a49e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 19, 2026.
Transparency log