Skip to main content

Other languages

anonyma's detectors, token format, presets and receipts are available outside JavaScript in two ways. Both give the same results as the TypeScript package, because every implementation runs one shared conformance suite.

WayLanguagesDetectorsState
The sidecarany language that speaks HTTPall 27available
The Python packagePython 3.10+all 27alpha
Go, Node.js, WebAssembly bindingsGo, JavaScriptas the Rust corein development

The sidecar​

The sidecar is a small service that runs next to your application, as a container in the same pod or a process on the same host. Your application sends it text over localhost, and the data never leaves the machine.

docker build -f packages/sidecar/Dockerfile -t anonyma-sidecar .
docker run --rm -p 127.0.0.1:7878:7878 anonyma-sidecar

Shield a prompt, send it to the model, and restore the answer from the same session:

curl -s localhost:7878/v1/shield -H 'content-type: application/json' \
-d '{"text": "Mail ana@example.com", "categories": ["email"]}'
# {"text":"Mail {{EMAIL_1}}","session":"…","counts":{"email":1}}

curl -s localhost:7878/v1/restore -H 'content-type: application/json' \
-d '{"text": "Sent to {{EMAIL_1}}.", "session": "…"}'
# {"text":"Sent to ana@example.com.","restored":1,"unresolved":[]}

POST /v1/detect and POST /v1/anonymize take the options of a pipeline (preset, categories, defaultStrategy, rules), and POST /mcp serves the MCP tools. Set ANONYMA_SIDECAR_TOKEN whenever another host can reach the port. The sidecar README lists every endpoint and setting.

Python​

The Python package runs on the Rust core: no runtime dependencies, no model to download.

from anonyma import Anonyma

engine = Anonyma(categories=["email", "credit-card"])
shielded = engine.shield_prompt("Mail ana@example.com about card 4111 1111 1111 1111.")
shielded.text # 'Mail {{EMAIL_1}} about card {{CREDIT_CARD_1}}.'
engine.restore("Sent to {{EMAIL_1}}.", shielded.vault) # 'Sent to ana@example.com.'

Every category and every compliance preset works as is: Anonyma(presets=["lgpd", "hipaa"]) detects all their categories, with the same results as the TypeScript package.