diff --git a/README.md b/README.md
index 8f035cda0..e9f92c5e5 100644
--- a/README.md
+++ b/README.md
@@ -37,6 +37,7 @@ Each agent keeps its model in its own file, in its own format, with its own keys
- **Pick any model for any agent** from one list. magpie edits the one key that matters in the agent's own config.
- **Use one provider everywhere**: an API key, a local model, or the Claude, ChatGPT, Copilot, Gemini or Grok plan you're signed in to.
- **Keep going when a quota runs out**: a routing group moves to the next account or model, and the agent never sees the error.
+- **Keep your secrets off the vendor's servers**: keys, passwords and emails in a prompt are masked on your computer before the request leaves it, and put back in the reply.
It's for you if you use more than one agent, more than one provider, or more than one account. If you use one agent on its vendor's own plan and that's enough, you don't need it.
@@ -122,6 +123,26 @@ Click a value and a searchable list opens: every model of every provider you add
+### Privacy masking
+
+Agents put what they read into the prompt: an `.env`, a config file, a log with a token in it. With masking on, magpie swaps those values for placeholders on your computer before a request leaves it, and swaps them back in the reply. Your agent and your files keep the real values; the vendor never sees them.
+
+
+
+
+
+
+| | |
+| :-- | :-- |
+| **Found two ways** | Rules for what is certain (API keys, private keys, tokens, emails, and card and ID numbers whose checksum adds up), and, if you want it, a model that runs on this computer for the names, addresses and passwords no rule can find (a 1.6 GB download, on the CPU) |
+| **Put back everywhere** | A value becomes a placeholder such as `{{API_KEY_k3v9x2mq}}`, and every placeholder in the reply turns back into its value: streamed text and tool-call arguments too, so a command the agent runs has the real key |
+| **Nothing breaks** | A value gets the same placeholder every time, so the conversation, the prompt cache and thinking signatures stay valid. A value masked once is masked wherever it shows up later |
+| **Never on disk** | Values are held in memory only. The record keeps each value's kind, length and first characters. If masking is on and can't run, the request is held back (503), never sent as written |
+| **You can check it** | **Insights › Masking** lists every request it changed, with what the vendor got instead, side by side, and **Try it** in Settings shows what a text would become |
+| **Your rules** | Secrets and personal data each on or off, finer kinds (passport, IBAN, MAC, public IP…), your own words and patterns, and whether a value found is masked, only warned about, or held back (**Mask**, **Warn**, **Block**) |
+
+The cost: the model sees `{{API_KEY_…}}`, not the key, so a task about the value itself (why is this token refused?) can't be done on it. Put such values under **Never mask**. Rules can be wrong now and then; the Masking page is where you'd see it. Turn it on in **Settings → Privacy**.
+
### Providers
Pick a preset, paste a key. Model lists come from the vendor, with names and reasoning levels filled in from [models.dev](https://models.dev), so a model released this morning is in your picker on the next refresh.
@@ -270,7 +291,7 @@ Find them under Plugins › Discover › Gateway middleware. See [Gateway middle
## Privacy
-Your prompts, replies, keys and accounts go only to the providers you use. Once a day a released magpie tells us it is in use: a random id, its version and system, and which agents, providers and models it is used with, by magpie's own ids (a provider you added yourself is only `custom`), and for each partner listed first in the add sheet, how many times a day it was shown, opened and added (counts only). No names, URLs, accounts, keys, prompts or usage. Turn part or all of it off in **Settings → Privacy**, or with `DO_NOT_TRACK=1`. A partner's website and key links go through `usemagpie.ai/go/…`, which counts the click, and usemagpie.ai counts fetches of the partner list; the server sees these whatever the settings, and keeps no id or address. Icons named by a plugin, an import link or the library are fetched through `usemagpie.ai/api/icon`, so their hosts see Cloudflare's address, not yours; the server only passes the picture on, and counts and keeps nothing. The [Privacy page](https://usemagpie.ai/docs/privacy) lists everything magpie sends by itself, with an example and every switch; the [reference](docs/reference.md#counting-users) has the rules.
+Your prompts, replies, keys and accounts go only to the providers you use, and with [privacy masking](#privacy-masking) on, the secrets in them don't go even there. Once a day a released magpie tells us it is in use: a random id, its version and system, and which agents, providers and models it is used with, by magpie's own ids (a provider you added yourself is only `custom`), and for each partner listed first in the add sheet, how many times a day it was shown, opened and added (counts only). No names, URLs, accounts, keys, prompts or usage. Turn part or all of it off in **Settings → Privacy**, or with `DO_NOT_TRACK=1`. A partner's website and key links go through `usemagpie.ai/go/…`, which counts the click, and usemagpie.ai counts fetches of the partner list; the server sees these whatever the settings, and keeps no id or address. Icons named by a plugin, an import link or the library are fetched through `usemagpie.ai/api/icon`, so their hosts see Cloudflare's address, not yours; the server only passes the picture on, and counts and keeps nothing. The [Privacy page](https://usemagpie.ai/docs/privacy) lists everything magpie sends by itself, with an example and every switch; the [reference](docs/reference.md#counting-users) has the rules.
## Community
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 04a610977..419739b84 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -37,6 +37,7 @@
- **任意 Agent 用任意模型**,在一张表里选。magpie 只改 Agent 配置里该改的那一个键。
- **一个 provider 处处能用**:API key、本地模型,或者你登录着的 Claude、ChatGPT、Copilot、Gemini、Grok 订阅。
- **额度用完也不断**:路由组自动切到下一个账号或模型,Agent 看不到报错。
+- **密钥不出你的电脑**:提示词里的密钥、密码、邮箱,在请求离开电脑前就在本地脱敏,回复里再换回原值。
如果你用不止一个 Agent、不止一个 provider 或不止一个账号,它就适合你。如果你只用一个 Agent、只用它自家的订阅,而且够用,那就不需要 magpie。
@@ -122,6 +123,26 @@ export GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:3425 GEMINI_API_KEY=magpie
+### 隐私脱敏
+
+Agent 会把读到的东西放进提示词:一个 `.env`、一份配置、一段带 token 的日志。打开脱敏后,请求离开电脑前,magpie 在本地把这些值换成占位符,回复里再换回来。Agent 和你的文件里始终是真值,厂商一个也看不到。
+
+
+
+
+
+
+| | |
+| :-- | :-- |
+| **两种方式找** | 规则管确定的:API key、私钥、token、邮箱,以及校验位对得上的银行卡号和证件号;需要的话,再加一个在这台电脑上运行的模型,找规则找不到的人名、地址和密码(下载 1.6 GB,用 CPU 跑) |
+| **处处换回** | 值变成 `{{API_KEY_k3v9x2mq}}` 这样的占位符,回复里的占位符都换回原值,流式文本和工具调用参数也算,所以 Agent 执行的命令里是真的 key |
+| **什么都不坏** | 同一个值每次的占位符都一样,对话上下文、提示词缓存和 thinking 签名都不受影响。一个值遮过一次,以后出现在哪里都会遮 |
+| **从不落盘** | 原值只在内存里。记录只留每个值的类型、长度和开头几个字符。脱敏打开却运行不了时,请求会被拦下(503),绝不按原样发出 |
+| **看得见** | **观测 › 脱敏** 列出它改过的每个请求,厂商实际收到了什么,左右对照;设置里的 **试一试** 能看一段文字会变成什么 |
+| **你说了算** | 机密和个人信息各自开关,更细的类型(护照、IBAN、MAC、公网 IP…),自己的词和规则,以及找到值后是 **脱敏**、只 **提醒**,还是 **拦截** |
+
+代价:模型看到的是 `{{API_KEY_…}}` 而不是 key,所以针对值本身的任务(比如这个 token 为什么被拒)没法做,这类值可以加进 **从不脱敏**。规则偶尔会判错,在脱敏页一眼就能看到。在 **设置 → 隐私** 里打开。
+
### Provider
选一个预设,粘贴 key。模型列表直接来自厂商,名称和推理档位从 [models.dev](https://models.dev) 补全,今天早上刚发布的模型,下次刷新就出现在你的选择器里。
@@ -270,7 +291,7 @@ magpie plugin options model-map '{"mapping": {"fast": "deepseek/deepseek-chat"}}
## 隐私
-你的提示词、回复、密钥和账号只发给你用的供应商。正式版 magpie 每天告诉我们一次它在用:一个随机 ID、版本和系统,以及用了哪些 agent、供应商和模型,只用 magpie 自己的 ID(你自己添加的供应商只记作 `custom`),以及添加供应商页里排在最前的合作伙伴每天被展示、打开和添加的次数(只有次数)。不发送名称、URL、账号、密钥、提示词和用量。可以在 **设置 → 隐私** 里关掉一部分或全部,也可以设 `DO_NOT_TRACK=1`。合作伙伴的官网和获取 Key 链接经 `usemagpie.ai/go/…` 跳转并计一次点击,usemagpie.ai 也统计合作伙伴列表的拉取次数;这是服务器本身看到的,不受设置影响,不记录 ID 和 IP。插件、导入链接和库里的图标经 `usemagpie.ai/api/icon` 获取,图标所在的服务器只看到 Cloudflare 的地址,看不到你的 IP;这台服务器只转发图片,不计数也不记录。[隐私页](https://usemagpie.ai/docs/zh/privacy)列出了 magpie 自己发出的所有内容,附示例和每个开关;规则见[参考文档](docs/reference.md#counting-users)。
+你的提示词、回复、密钥和账号只发给你用的供应商;打开[隐私脱敏](#隐私脱敏)后,其中的密钥连供应商也收不到。正式版 magpie 每天告诉我们一次它在用:一个随机 ID、版本和系统,以及用了哪些 agent、供应商和模型,只用 magpie 自己的 ID(你自己添加的供应商只记作 `custom`),以及添加供应商页里排在最前的合作伙伴每天被展示、打开和添加的次数(只有次数)。不发送名称、URL、账号、密钥、提示词和用量。可以在 **设置 → 隐私** 里关掉一部分或全部,也可以设 `DO_NOT_TRACK=1`。合作伙伴的官网和获取 Key 链接经 `usemagpie.ai/go/…` 跳转并计一次点击,usemagpie.ai 也统计合作伙伴列表的拉取次数;这是服务器本身看到的,不受设置影响,不记录 ID 和 IP。插件、导入链接和库里的图标经 `usemagpie.ai/api/icon` 获取,图标所在的服务器只看到 Cloudflare 的地址,看不到你的 IP;这台服务器只转发图片,不计数也不记录。[隐私页](https://usemagpie.ai/docs/zh/privacy)列出了 magpie 自己发出的所有内容,附示例和每个开关;规则见[参考文档](docs/reference.md#counting-users)。
## 社区
diff --git a/site/i18n.js b/site/i18n.js
index d5c29dd4f..d4949f029 100644
--- a/site/i18n.js
+++ b/site/i18n.js
@@ -135,6 +135,26 @@ const zh = {
"plat.win": "10 及以上",
"foot.start": "快速上手",
"foot.feed": "更新源",
+
+ "nav.masking": "脱敏",
+ "alt.masking": "观测 › 脱敏:7 天里没让厂商看到的 5,812 处,从 Claude Code 和 Codex 经 magpie 流向 OpenAI、Kimi 和 DeepSeek",
+ "img.masking.light": "/img/masking-zh-light.png",
+ "img.masking.dark": "/img/masking-zh-dark.png",
+ "msk.eyebrow": "隐私脱敏",
+ "msk.h2": "你的密钥,厂商一个也看不到。",
+ "msk.sub": "Agent 会把读到的东西放进提示词:一个 .env、一份配置、一段带 token 的日志。请求离开电脑前,magpie 在本地把这些值换成占位符,回复里再换回来。Agent 和你的文件里始终是真值,厂商一个也看不到。",
+ "msk.find": "两种方式找",
+ "msk.find.p": "规则管确定的:API key、私钥、token、邮箱,以及校验位对得上的银行卡号和证件号。需要的话,再加一个在这台电脑上运行的模型,找规则找不到的人名、地址和密码。",
+ "msk.back": "处处换回",
+ "msk.back.p": "值变成 {{API_KEY_k3v9x2mq}} 这样的占位符。回复里的占位符都换回原值,流式文本和工具调用也算,所以 Agent 执行的命令里是真的 key。",
+ "msk.cache": "什么都不坏",
+ "msk.cache.p": "同一个值每次的占位符都一样,对话上下文、提示词缓存和 thinking 签名都不受影响。",
+ "msk.disk": "从不落盘",
+ "msk.disk.p": "原值只在内存里,记录只留类型、长度和开头几个字符。脱敏运行不了时,请求会被拦下,绝不按原样发出。",
+ "msk.see": "不是黑箱",
+ "msk.see.p": "观测 › 脱敏 列出它改过的每个请求,厂商实际收到了什么,左右对照。",
+ "msk.cost": "你说了算",
+ "msk.cost.p": "模型只看到占位符,看不到值本身,所以针对某个值的任务要把它加进「从不脱敏」。遮哪些、加自己的词,或者改成只提醒、直接拦截,都由你定。",
};
const ja = {
@@ -261,6 +281,26 @@ const ja = {
"plat.win": "10 以降",
"foot.start": "はじめに",
"foot.feed": "更新フィード",
+
+ "nav.masking": "マスク",
+ "alt.masking": "観測 › マスク:7 日間でベンダーに渡さなかった 5,812 か所。Claude Code と Codex から magpie を経て OpenAI、Kimi、DeepSeek へ",
+ "img.masking.light": "/img/masking-ja-light.png",
+ "img.masking.dark": "/img/masking-ja-dark.png",
+ "msk.eyebrow": "プライバシーマスク",
+ "msk.h2": "あなたの秘密は、ベンダーに届かない。",
+ "msk.sub": "エージェントは読んだものをプロンプトに入れます。.env、設定ファイル、トークン入りのログ。magpie はリクエストがコンピュータを出る前に、それらの値をこのコンピュータ上でプレースホルダーに置き換え、応答で元に戻します。エージェントとファイルには本物の値が残り、ベンダーには見えません。",
+ "msk.find": "二つの方法で見つける",
+ "msk.find.p": "確実なものはルールで:API キー、秘密鍵、トークン、メール、チェックサムの合うカード番号や ID 番号。必要なら、このコンピュータで動くモデルが、ルールでは見つからない名前、住所、パスワードを見つけます。",
+ "msk.back": "どこでも元に戻す",
+ "msk.back.p": "値は {{API_KEY_k3v9x2mq}} のようなプレースホルダーになり、応答の中のプレースホルダーはストリームやツール呼び出しも含めて元の値に戻ります。エージェントが実行するコマンドには本物のキーが入ります。",
+ "msk.cache": "何も壊れない",
+ "msk.cache.p": "同じ値はいつも同じプレースホルダーになるので、会話、プロンプトキャッシュ、thinking の署名はそのまま有効です。",
+ "msk.disk": "ディスクに残さない",
+ "msk.disk.p": "値はメモリにだけ置かれ、記録に残るのは種類、長さ、先頭の数文字だけ。マスクが動かないときは、リクエストをそのまま送らずに止めます。",
+ "msk.see": "ブラックボックスではない",
+ "msk.see.p": "観測 › マスク に、変更したリクエストごとに、ベンダーが実際に受け取ったものが並べて表示されます。",
+ "msk.cost": "決めるのはあなた",
+ "msk.cost.p": "モデルに見えるのはプレースホルダーだけなので、値そのものを扱う作業には「マスクしない」に入れてください。何をマスクするか、自分の語句、警告やブロックへの切り替えも選べます。",
};
const de = {
@@ -387,6 +427,26 @@ const de = {
"plat.win": "10 oder neuer",
"foot.start": "Erste Schritte",
"foot.feed": "Update-Feed",
+
+ "nav.masking": "Maskierung",
+ "alt.masking": "Einblick › Maskierung: 5.812 Werte in 7 Tagen vor Anbietern verborgen, von Claude Code und Codex über magpie zu OpenAI, Kimi und DeepSeek",
+ "img.masking.light": "/img/masking-light.png",
+ "img.masking.dark": "/img/masking-dark.png",
+ "msk.eyebrow": "Datenschutz-Maskierung",
+ "msk.h2": "Ihre Geheimnisse erreichen den Anbieter nie.",
+ "msk.sub": "Agenten übernehmen, was sie lesen, in den Prompt: eine .env, eine Konfiguration, ein Log mit einem Token darin. magpie ersetzt diese Werte auf Ihrem Computer durch Platzhalter, bevor eine Anfrage ihn verlässt, und setzt sie in der Antwort wieder ein. Ihr Agent und Ihre Dateien behalten die echten Werte; der Anbieter sieht sie nie.",
+ "msk.find": "Auf zwei Wegen gefunden",
+ "msk.find.p": "Regeln für das Sichere: API-Schlüssel, private Schlüssel, Tokens, E-Mails, Karten- und Ausweisnummern mit stimmender Prüfsumme. Und auf Wunsch ein Modell auf diesem Computer für Namen, Adressen und Passwörter, die keine Regel findet.",
+ "msk.back": "Überall zurückgesetzt",
+ "msk.back.p": "Ein Wert wird zu einem Platzhalter wie {{API_KEY_k3v9x2mq}}. Jeder Platzhalter in der Antwort wird wieder zum Wert, auch in Streams und Tool-Aufrufen – der Befehl Ihres Agenten hat den echten Schlüssel.",
+ "msk.cache": "Nichts geht kaputt",
+ "msk.cache.p": "Ein Wert bekommt jedes Mal denselben Platzhalter, also bleiben Gespräch, Prompt-Cache und Thinking-Signaturen gültig.",
+ "msk.disk": "Nie auf der Platte",
+ "msk.disk.p": "Werte liegen nur im Speicher; der Verlauf behält Art, Länge und die ersten Zeichen. Kann die Maskierung nicht laufen, wird die Anfrage zurückgehalten, nie unverändert gesendet.",
+ "msk.see": "Keine Blackbox",
+ "msk.see.p": "Einblick › Maskierung zeigt jede geänderte Anfrage und daneben, was der Anbieter stattdessen bekam.",
+ "msk.cost": "Ihre Entscheidung",
+ "msk.cost.p": "Das Modell sieht den Platzhalter, nicht den Wert; für eine Aufgabe um den Wert selbst gehört er unter Nie maskieren. Wählen Sie, was maskiert wird, eigene Wörter, oder nur warnen oder blockieren.",
};
export const LANGS = {
diff --git a/site/public/docs/ja/privacy.html b/site/public/docs/ja/privacy.html
index 01ced4c2d..2e35214b9 100644
--- a/site/public/docs/ja/privacy.html
+++ b/site/public/docs/ja/privacy.html
@@ -77,6 +77,7 @@
usemagpie.ai に見えるものmagpie が取得する公開リストOTLP エクスポート
+ プロバイダに送る内容のマスクカウントが既定でオンの理由
@@ -182,6 +183,21 @@
magpie can export each gateway request to an OpenTelemetry collector of yours (Langfuse, for example). It is off by default, and goes only to the endpoint you set, never to us. When on, it sends per-request spans: agent, provider, model, token counts, status, timing and estimated cost. Optional switches add metrics, local agent conversations, and the request and reply bodies (secrets masked). Turn it on in Settings → Observability, or for magpie serve with MAGPIE_OTEL_ENABLED, MAGPIE_OTEL_ENDPOINT, MAGPIE_OTEL_HEADERS, MAGPIE_OTEL_METRICS, MAGPIE_OTEL_SESSIONS, MAGPIE_OTEL_BODIES and MAGPIE_OTEL_BODIES_WHOLE. An endpoint alone doesn’t turn it on. The reference has the details.
The sections above are what magpie sends by itself. What your agents send goes to the providers you chose, and privacy masking keeps the secrets in it on this computer. It is off by default; turn it on in Settings → Privacy.
+
+
+
+ Insights › Masking: what was kept from each vendor, request by request.
+
+
+
Before a request leaves this computer, API keys, private keys, tokens, emails, and card and ID numbers whose checksum adds up become placeholders such as {{API_KEY_k3v9x2mq}}. Find with a local model adds the names, addresses and passwords no rule can find, with a model that runs on this computer (a 1.6 GB download, on the CPU).
+
Every placeholder in the reply, streamed text and tool-call arguments included, turns back into its value, so your agent and your files keep the real values.
+
A value gets the same placeholder every time, so the conversation and the prompt cache stay valid.
+
Values are held in memory only; the record on disk keeps each value’s kind, length and first characters. If masking is on and can’t run, the request gets a 503 and nothing is sent.
+
The model sees the placeholder, not the value. A value a task needs as it is (a team address, a test key) goes under Never mask.
magpie works with dozens of agents and providers, and is maintained by a small team. The daily count is how we know which of them people actually use, so they are kept working first. It is on in releases because counts from those who turn it on would be too few to tell that. In exchange it is kept small: a random id, built-in ids, numbers; one switch or DO_NOT_TRACK=1 turns it off, builds from source never send it, and this page lists everything that goes.
Agents put what they read into the prompt: an .env, a config file, a log with a token in it. magpie swaps those values for placeholders on your computer before a request leaves it, and swaps them back in the reply. Your agent and your files keep the real values; the vendor never sees them.
+
+
+
+
+
+
Found two ways
Rules for what is certain: API keys, private keys, tokens, emails, card and ID numbers whose checksum adds up. And, if you want it, a model that runs on this computer for the names, addresses and passwords no rule can find.
+
Put back everywhere
A value becomes a placeholder like {{API_KEY_k3v9x2mq}}. Every placeholder in the reply turns back into its value, in streamed text and tool calls too, so the command your agent runs has the real key.
+
Nothing breaks
A value gets the same placeholder every time, so the conversation, the prompt cache and thinking signatures stay valid.
+
Never on disk
Values are held in memory only; the record keeps a value’s kind, length and first characters. If masking can’t run, the request is held back, never sent as written.
+
Not a black box
Insights › Masking lists every request it changed, with what the vendor got instead, side by side.
+
Your call
The model sees the placeholder, not the value, so a task about a value itself needs it under Never mask. Pick what to mask, add your own words, or warn or block instead.