Skip to content

Latest commit

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

image

Masker

Python 3.11+FastAPIspaCyLicense: AGPL-3.0Docker

PII redaction API for LLMs. Remove personal data before sending to ChatGPT, Claude, or any AI.

Open the project site · Run locally

Docs · Examples · API quickstart

What it does

Input: "Contact John Doe at john@example.com"
Output: "Contact <PERSON> at <EMAIL>"

Masker detects and redacts:

  • EMAIL — email addresses
  • PHONE — phone numbers
  • CARD — credit card numbers
  • PERSON — person names (AI-powered)
  • SENSITIVE_WORD — custom words and phrases configured by the operator

Quick Start

docker run -p 8000:8000 ghcr.io/kikuai-lab/masker
curl -X POST http://localhost:8000/v1/redact \
-H "Content-Type: application/json" \
-d '{"text": "Email me at john@example.com", "mode": "placeholder"}'

LLM Proxy (OpenAI-compatible)

Drop-in replacement for /v1/chat/completions that automatically redacts PII:

importopenaiclient=openai.OpenAI(
base_url="http://localhost:8000/v1",
api_key="your-openai-key",
default_headers={"X-Api-Key": "your-masker-key"}
)
response=client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "My email is john@example.com"}]
)
# PII redacted before reaching OpenAI

Features

  • Text & JSON — process plain text or nested JSON
  • Policy system — configure mask/drop/placeholder per PII type
  • Audit logging — JSONL logs without storing raw text
  • Fail modesclosed (block) or open (pass-through)
  • Multi-tenant — API key authentication
  • Multi-language — English & Russian NER

Installation

git clone https://github.com/KikuAI-Lab/masker.git
cd masker
cp .env.example .env
docker-compose up -d

Configuration

MASKER_API_KEYS=sk-key1:tenant1,sk-key2:tenant2
MASKER_UPSTREAM_URL=https://api.openai.com/v1/chat/completions
MASKER_DEFAULT_FAIL_MODE=closed
MASKER_SENSITIVE_WORDS=secret,confidential,internal project

MASKER_SENSITIVE_WORDS is a comma-separated, case-insensitive list.

See .env.example for all options.

Documentation

📖 Wiki — full documentation

API

EndpointDescription
POST /v1/redactRedact PII from text or JSON
POST /v1/chat/completionsOpenAI-compatible proxy
GET /healthHealth check
GET /metricsPrometheus metrics

Security & Architecture


Stateless by Design. Masker is a firewall, not a storage bucket.

  • No raw payload storage by design — Payloads are processed in RAM and are not intentionally persisted.
  • Local PII detection path — Redaction logic does not require third-party AI calls.
  • Self-hostable boundary — The redaction service can run without internet access; proxy mode still calls the configured upstream provider.

📖 Read about our Stateless Architecture to understand the intended privacy boundary and deployment assumptions.

Follow the work

Project notes and new tools: Telegram · LinkedIn · KikuAI

License

AGPL-3.0 — KikuAI OÜ

KikuAI websiteTelegram @kiku_aiGitHub @kiku-jw

Follow new projects and updates from @kiku-jw.

About

PII redaction API for masking obvious personal data before LLM workflows.

Topics

Resources

Contributing

Security policy

Stars

6 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages