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
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. See
maskflow-core for detection internals.
Tests
uv run pytest
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maskflow_sdk-0.1.0.tar.gz.
File metadata
- Download URL: maskflow_sdk-0.1.0.tar.gz
- Upload date:
- Size: 123.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
850e7573f2231187cecf1ea4067f06ebe01e88133cb078d3c49963406055946f
|
|
| MD5 |
ec4df50effc899b08b6e9f06e5e2610b
|
|
| BLAKE2b-256 |
43b0868bb6acde2d516f7a5f0dd98290a9f5b0da7b9d5e913a40ec0678a28495
|
Provenance
The following attestation bundles were made for maskflow_sdk-0.1.0.tar.gz:
Publisher:
release-sdk-python.yml on maskflow/maskflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
maskflow_sdk-0.1.0.tar.gz -
Subject digest:
850e7573f2231187cecf1ea4067f06ebe01e88133cb078d3c49963406055946f - Sigstore transparency entry: 2359192714
- Sigstore integration time:
-
Permalink:
maskflow/maskflow@3255258d27a688409aef077f82b987c93fd06979 -
Branch / Tag:
refs/tags/sdk-py-v0.1.0 - Owner: https://github.com/maskflow
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-sdk-python.yml@3255258d27a688409aef077f82b987c93fd06979 -
Trigger Event:
push
-
Statement type:
File details
Details for the file maskflow_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: maskflow_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f77db93874622f2de80cf89a7f4f163567fa2485d8ecdfec22d552b614f2ddb
|
|
| MD5 |
3b451e895764d4a9db3d548a0d3314c8
|
|
| BLAKE2b-256 |
b8267c6433ebf5c59f804f11f1916aeda22ff0a98c5015de9d90789dd021f2dc
|
Provenance
The following attestation bundles were made for maskflow_sdk-0.1.0-py3-none-any.whl:
Publisher:
release-sdk-python.yml on maskflow/maskflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
maskflow_sdk-0.1.0-py3-none-any.whl -
Subject digest:
3f77db93874622f2de80cf89a7f4f163567fa2485d8ecdfec22d552b614f2ddb - Sigstore transparency entry: 2359192739
- Sigstore integration time:
-
Permalink:
maskflow/maskflow@3255258d27a688409aef077f82b987c93fd06979 -
Branch / Tag:
refs/tags/sdk-py-v0.1.0 - Owner: https://github.com/maskflow
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-sdk-python.yml@3255258d27a688409aef077f82b987c93fd06979 -
Trigger Event:
push
-
Statement type: