piighost-api

A REST server that hosts one PIIShade pipeline behind HTTP.

What it does

piighost-api is a REST server that hosts one configurable PIIShade 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

  • De-identify and restore endpoints over the full pipeline.
  • OpenAI-compatible (under /openai/v1) and Anthropic-compatible proxies: an existing client only changes its base_url.
  • Any PIIShade 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 de-identification mappings.
  • Pipeline configured at startup with a module:variable import path.

Quick start

uv add piighost-api
piighost-api serve pipeline:pipeline --port 8000

Example request

POST /v1/anonymize
{ "text": "Email Patrick at patrick@acme.com" }

200 OK
{ "anonymized_text": "Email <<PERSON:1>> at <<EMAIL:1>>", "entities": [ ... ] }