PII masking at the LLM gateway: log the redaction, not the PII Base Interactive built PII masking into BaseLLM, its self-hosted AI gateway, that scans prompts server-side before they reach the model and logs only the redaction events rather than the original text. The gateway offers five masking modes, validates check digits for Turkish ID and tax numbers, IBANs, license plates and Luhn for cards, and blocks secrets by default with a 403 response. In the company's own test set of 22 realistic samples, 20 were detected with no false positives, and audit records are linked with a SHA-256 chain so tampering is visible. If you put an LLM gateway in front of your models, sooner or later someone pastes a customer record into a prompt. Masking it is the easy part. The harder question is what you write to your own logs. A common mistake is to keep the original prompt "for audit". Then your audit log holds the exact personal data you wanted to protect. This is how we handle it in BaseLLM, the self-hosted AI gateway we build at Base Interactive. The gateway scans the text before it reaches the model. Detection is rule based and runs on the server, so the text is not sent to another service for checking. Settings are per project. There are five modes: TCKN 100 46 , 4567