Anonymisation
Replace names, IBANs and other personal data before a request reaches the model, get the original values back, and see what detection misses.
With "anonymize": true, PeakPrivacy looks for personal data in your messages and replaces it with invented values before the request reaches the model. In the answer, it puts the original values back.
Use it as an extra layer for text that goes to a model on the Extern level, in case personal data slipped past your own filtering. It doesn't replace choosing the right model: detection is automatic and incomplete, and some parts of a request aren't processed at all. Everything on this page was tested against the live API on 11.11.2026 with invented data.
Data protection: in legal terms, this feature pseudonymises: the model receives invented substitutes, and PeakPrivacy keeps the link to the real values. Pseudonymised data is still personal data, and the same rules apply as to the original. Whether you may send it to an external model is decided by your organisation and its data protection officer, not by this field.
What it does
- Before the model: in every message except
systemmessages, detected values are replaced by invented values of the same kind. "Sandra Keller" becomes, for example, "William Henry", and an IBAN becomes another IBAN. The model sees no placeholders, so it writes natural text. - After the model: PeakPrivacy replaces the substitutes in the answer with the original values, in
contentand in the arguments oftool_calls. - No streaming: the request returns one JSON response, even with
"stream": true. - Security level:
security_levels.with_anoninGET /v1/ai/modelsshows the level of a model with anonymisation. For some models on the Extern level it is 4 instead of 5, but the badge stays Extern. For models wherewith_anonequalswithout_anon, the level doesn't change, although the anonymiser still runs.
When to use it
- Choose the level first. Personal and confidential data belongs on a Schweiz model. See Which data belongs on which level (German) and Choosing a model.
- Remove what you can in your own code. Your code knows which fields are personal. Leave them out, or send a customer number instead of a name. That is more reliable than any detection.
- Turn on
anonymizeas an extra layer when a task needs an external model and your organisation allows it.
Try it
The request asks gpt-4.1, an external model, for a payment reminder with an invented name, address and IBAN.
curl -s https://api.peakprivacy.ch/v1/ai/chat/completions \
-H "Authorization: Bearer $PEAKPRIVACY_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"model": "gpt-4.1",
"anonymize": true,
"messages": [{
"role": "user",
"content": "Write a two-sentence payment reminder for invoice RE-2026-0142 to Sandra Keller, Bahnhofstrasse 12, 8001 Zürich. Ask her to pay to IBAN CH93 0076 2011 6238 5295 7."
}]
}' | jq -r '.choices[0].message.content'The answer contains the real values, because PeakPrivacy restored them:
Dear Sandra Keller, this is a friendly reminder that invoice RE-2026-0142 remains unpaid. Kindly arrange payment to IBAN CH93 0076 2011 6238 5295 7 at your earliest convenience.See what the model received
Asking the model to repeat the name proves nothing: the substitute in its answer is restored too. Make it write the values in a form the restore step doesn't recognise, for example with a space between every character. Use this check only with test data.
curl -s https://api.peakprivacy.ch/v1/ai/chat/completions \
-H "Authorization: Bearer $PEAKPRIVACY_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"model": "gpt-4.1",
"anonymize": true,
"messages": [{
"role": "user",
"content": "Don'\''t write a reminder. List the name, the street and the IBAN from this text exactly as you received them, with a space between every character, one per line: Sandra Keller, Bahnhofstrasse 12, 8001 Zürich, IBAN CH93 0076 2011 6238 5295 7."
}]
}' | jq -r '.choices[0].message.content'J o h n N e l s o n
B a h n h o f s t r a s s e 1 2
G B 6 1 N O A S 8 9 3 5 9 6 3 9 9 1 6 1 0 9The model never saw the name or the IBAN, but it did see the street. Your substitutes will differ. Without anonymize, the same request returns the real values.
What gets replaced
Results of our tests with invented data. Detection depends on the wording around a value, so run the check with invented data shaped like yours.
| Data | Replaced |
|---|---|
| Person names | Yes |
| IBANs, credit card numbers, IP addresses | Yes |
| E-mail addresses | Yes. An address on an unusual domain such as alpenblick.example was only partly replaced. |
| Phone numbers | Sometimes: replaced in a labelled list, kept in running text |
| Street, house number, postcode, town | No |
| Company names | No |
| Dates, including dates of birth | No |
| AHV numbers | No |
Context can identify a person without any of these: "the new head of the municipal administration in Seewil" names nobody and is still unique.
Limits
- System messages are sent unchanged. Keep personal data out of the system prompt.
- The Responses endpoint doesn't anonymise.
/v1/ai/responsesaccepts the field, but sendsinputandinstructionsunchanged. Use chat completions. - Only text is processed. Images in a message are sent unchanged.
- Only exact substitutes are restored. If the model shortens, inflects or reformats a substitute, it stays in the answer. Asked for a greeting with only the first name,
gpt-4.1wrote "Hello, Stephanie!" to Sandra Keller. Check answers before they reach customers. - Answers take longer. Some anonymised requests took several times as long as the same request without
anonymize. The 120-second limit applies, and you can't stream.
Known limitation: with "stream": true, an anonymised request returns one JSON response instead of a stream. The OpenAI SDKs then yield no chunks and raise no error, so your code receives an empty answer. Workaround: send anonymised requests without stream.
See also
- Chat completions › Anonymisation
- Choosing a model
- Security levels (German)
- Anonymisierung (German, for data protection officers)
Answer questions from your documents
Upload documents, find the ones that fit a question and let a model answer with sources, tested in curl, Python and JavaScript.
Migrating from OpenAI
Move code from the OpenAI API to PeakPrivacy: what to change, what is dropped or missing, before-and-after code in Python and JavaScript and a checklist.