Privacy-first LLM gateway — anonymize PII before it leaves your system.
Important
This is a MVP Version — Currently supporting only Google Gemini API and Polish-language prompts.
piast-gate sits between your app and the model. It strips sensitive data before sending, then restores it after the response. The model never sees real PII.
Input:
Mam na imię Jan Kowalski, mój email to jan@example.com, a PESEL: 85010112345
Sent to LLM:
Mam na imię <PERSON_1>, mój email to <EMAIL_1>, a PESEL: <PESEL_1>
Returned to client:
Mam na imię Jan Kowalski, mój email to jan@example.com, a PESEL: 85010112345
The recommended way to run this project is using uv.
Using uv (fast & recommended):
git clone https://github.com/your-org/piast-gate.git
cd piast-gate
uv syncUsing standard pip:
python -m venv .venv
.venv\Scripts\activate # Windows alternate: source .venv/bin/activate
pip install -e ".[dev]"cp .env.example .envEdit the .env file and provide your GEMINI_API_KEY.
Using uv:
uv run uvicorn main:app --workers 4Using standard python:
uvicorn main:app --workers 4uv run pytest # using uv
pytest # using venvExample configuration in .env:
LLM_PROVIDER=gemini
GEMINI_API_KEY=your_api_key_here
MODEL_NAME=gemini-2.5-flash
PL_NER_MODEL_NAME=pl_core_news_lg
RATE_LIMIT_PER_MINUTE=60
API_KEYS=["your-secret-key"]curl -X POST http://localhost:8000/v1/api/chat \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secret-key" \
-d '{
"model": "piast-gate",
"messages": [
{"role": "user", "content": "Mam na imię Jan Kowalski, email: jan@example.com"}
]
}'Response:
{
"response": "Cześć Jan Kowalski! Jak mogę Ci pomóc?"
}Benchmarks run with uvicorn main:app --workers 4.
| Characters | avg | min | median | p(90) | p(95) |
|---|---|---|---|---|---|
| 1290 | 391 ms | 144 ms | 236 ms | 339 ms | 367 ms |
| 12900 | 1.46 s | 839 ms | 1.47 s | 1.78 s | 1.86 s |
| 64500 | 7.32 s | 5.45 s | 7.33 s | 8.70 s | 9.11 s |
| Placeholders | avg | min | median | p(90) | p(95) |
|---|---|---|---|---|---|
| 3 | 162 ms | 97 ms | 164 ms | 182 ms | 186 ms |
| 15 | 177 ms | 102 ms | 179 ms | 198 ms | 206 ms |
| 60 | 260 ms | 127 ms | 257 ms | 323 ms | 333 ms |
| 300 | 809 ms | 562 ms | 805 ms | 916 ms | 946 ms |