What it does
piighost-api is a REST server that hosts one configurable piighost pipeline behind HTTP. The library embeds in your process; the API lets several processes (chat backends, batch jobs, notebooks) hit one inference endpoint without re-loading models or duplicating cache state.
Features
- Anonymize and deanonymize endpoints over the full pipeline.
- Any piighost detector, loaded once and shared across requests.
- Thread-scoped memory so entities stay consistent across a conversation.
- API-key authentication with Argon2 hashing, scopes, and expiration.
- Redis cache for shared anonymization mappings.
- Pipeline configured at startup with a module:variable import path.
Quick start
uv add piighost-api
piighost-api serve pipeline:pipeline --port 8000Talk to it
POST /v1/anonymize
{ "text": "Email Patrick at patrick@acme.com" }
200 OK
{ "anonymized_text": "Email <<PERSON:1>> at <<EMAIL:1>>", "entities": [ ... ] }