Mask personal data before it reaches AI with FirmAlways Gate
The AI gets your question, not your customers' data. Gate masks Thai ID numbers, names, phone numbers, bank accounts and PDPA sensitive data before a prompt leaves your organisation, then puts the real values back into the answer. Free, and every line of code is open for review.
See what the AI would receive
This demo runs only in your browser, sends nothing anywhere, and uses a small subset of Gate's real rules.
How FirmAlways Gate works
Gate sits between your apps and your AI provider. It works with any tool that speaks the OpenAI API: change only base_url.
Inspect text and files
Finds Thai personal data with rules that know Thai formats, such as the national ID checksum and names written without spaces.
Mask or block
Replaces real values with «PERSON_1» before sending, and sends nothing at all if it finds passwords, API keys or section 26 sensitive data.
Restore in the answer
When the AI replies, Gate puts the real values back on your side and masks new personal data the AI may have produced.
Personal data FirmAlways Gate detects
Data that identifies a person
Thai national ID
13 digits with checksum, in Arabic or Thai digits, in any grouping.
Person names
Names after a title such as นาย, นางสาว, คุณ or Mr., and untitled names with the Thai NER option.
Phone, email and LINE ID
Mobile, landline and +66 numbers, including text written right next to Thai words.
Addresses
House number, moo, soi, road, subdistrict, district, province and postal code.
Financial, document and system data
Bank accounts and cards
Thai bank account numbers and Luhn-valid card numbers.
Passports and licence plates
Passport numbers, Thai licence plates and company tax IDs.
Secrets and IP addresses
API keys, tokens, private keys and passwords, blocked by default.
Attached files
Reads text from txt, csv, docx and pdf and masks it before sending.
Sensitive data under PDPA section 26
Health, religion, criminal records, disability, biometric and genetic data, political opinions, trade union membership, sexual behaviour and race. Gate blocks these when they appear next to a person. General questions such as "What are the symptoms of diabetes?" still go through.
Install FirmAlways Gate
Requires Python 3.11 or newer, or Docker.
Install script
curl -fsSL https://firmalways.meapplication.co.th/install.sh | sh
The script installs the latest release with uv, pipx or pip. Read it before running it, or use the same script from the GitHub release.
curl -fsSL https://github.com/firmalways/gate/releases/latest/download/install.sh | sh
Docker
docker run --rm -p 8787:8787 -e FIRMALWAYS_GATE_API_KEY=change-me \
-v "$PWD/policy.toml:/etc/firmalways/policy.toml:ro" ghcr.io/firmalways/gate
See what an AI would receive
firmalways-gate scan "ลูกค้าคุณสมชาย ใจดี เลขบัตร 1101700203611"
Use it with your existing apps
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8787/v1", api_key="<FIRMALWAYS_GATE_API_KEY>")
Works with OpenAI, Azure OpenAI in your own subscription, any OpenAI-compatible endpoint and local models such as Ollama. See every option in the README, and the browser extension for ChatGPT, Claude and Gemini in extension.
Benchmark on Thai text
50 prompts with 54 labelled values, compared with Microsoft Presidio in its default English setup. The test set is written by the maintainers and not yet reviewed externally. Method and limits
| Metric | FirmAlways Gate | Gate + Thai NER | Presidio (default) |
|---|---|---|---|
| Values found | 94.4% | 98.2% | 53.7% |
| Precision | 100% | 98.2% | 74.1% |
| Thai national ID | 100% | 100% | 0% |
| Health data (s.26) | 100% | 100% | 33% |
What FirmAlways Gate supports
- Runs on your machine or in your cloud. Gate never contacts our servers.
- If inspection fails, nothing is forwarded. Data never leaves uninspected.
- The audit log records only counts and data types, never prompts, answers or real values.
- Masked values live only in the memory of that one request, then disappear.
- Your AI provider key stays in Gate. Employee apps never need it.
Frequently asked questions
Does using Gate make my organisation PDPA compliant?
No. Gate reduces risk and supports PDPA work, but compliance still needs policies, consent, processor agreements and a record of processing activities (ROPA).
Does it detect 100% of personal data?
No tool can. We publish our test results and limits on GitHub, and you can report a weakness privately as described in SECURITY.md.
What can the AI still learn once names are masked?
The context of the sentence remains, for example business secrets that are not personal data. For very sensitive work, send requests to a local model instead.
How long is it free?
Forever. Gate is Apache-2.0 and free for commercial use. FirmAlways Pro is an add-on for organisations that need per-department policies and reports for their DPO.