piighost-api

A REST server that hosts one piighost pipeline behind HTTP.

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

  • 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 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 de-identification mappings.
  • Pipeline described by a TOML file or a catalog configuration, loaded at startup.

Quick start

docker run -p 8000:8000 -e PIIGHOST_ALLOW_ANONYMOUS=true \
  ghcr.io/athroniaeth/piighost-api:latest

Example request

POST /v1/anonymize
{ "text": "Appelez le 06 12 34 56 78 ou écrivez à jean@exemple.fr", "thread_id": "demo" }

201 Created
{ "anonymized_text": "Appelez le <<FR_PHONE:1>> ou écrivez à <<EMAIL:1>>", "entities": [ ... ] }