35 Downloads
35 Downloads
An LM Studio plugin that detects and redacts personally identifiable information (PII) before prompts are sent to another LLM, and restores the originals in the model's response.
By default, PII detection is performed by Desert Ant Redact ā a local, on-device PII detection model that ships with the plugin (no LLM needed; the weights download on first use and are cached). Alternatively, a dedicated LLM can be used for detection, ideally running locally or on self-hosted infrastructure. The redacted prompt is sent to another LLM via an OpenAI-compatible API, and the plugin translates the placeholders in the response back to their original values ā locally, so the originals never leave your machine.
The following example demonstrates how PII works when the skip confirmation option is set to true:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā User ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā⤠ā Please generate a response to this email, that the account ā ā has been created: ā ā ā ā Hi Sally, ā ā Could you please add a new user account for ā ā john@our-business.com? ā ā Thanks, ā ā Petra ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā Assistant ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā⤠ā ā PII redacted successfully ā forwarding without ā ā confirmation. Detected 3 PII entity(ies): ⢠ā ā [[[GIVEN_NAME_1]]] ā "Sally" (GIVEN_NAME) ⢠ā ā [[[EMAIL_1]]] ā "john@our-business.com" (EMAIL) ⢠ā ā [[[GIVEN_NAME_2]]] ā "Petra" (GIVEN_NAME) ā ā ā ā ā Done predicting ā ā ā ā ā ā Hi Petra, ā ā ā ā The new user account for john@our-business.com has been ā ā created successfully. ā ā ā ā Best, ā ā Sally ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
The assistant target model receives this prompt:
It generates this response:
The plugin registers two hooks:
--c. Only the redacted text is ever forwarded.Because the plugin contains a generator, it does not appear in the plugins list. Instead, it appears in the model dropdown and acts as a model ā select it instead of a regular model, and configure the redaction model and actual target model in the plugin settings.
A few details worth knowing:
Global settings (shared across all chats, so they persist when starting a new conversation):
| Setting | Type | Description |
|---|---|---|
| Detection Engine | Select | Redact (on-device model) (default) uses the Desert Ant Redact model ā no LLM needed, weights download on first use. LLM (PII Detection Model) uses the configured LLM for detection. |
| PII Detection Model | String | Only used when Detection Engine is LLM. The LLM used for PII detection. Leave blank to use the currently loaded model. |
| Assistant Model | String | The model ID sent to the OpenAI-compatible endpoint, e.g. gpt-4o-mini (OpenAI). |
| Skip Confirmation | Boolean | When enabled, redacted prompts are forwarded immediately without requiring --c. Default: off. |
| API Key | String (protected) | API key for the OpenAI-compatible endpoint, e.g. sk-.... |
| Base URL | String | Base URL of the endpoint. Defaults to https://api.openai.com/v1. |
Confirmation is required by default: when PII is detected, the plugin shows the redaction preview and waits for a message containing --c before forwarding. Enable Skip Confirmation to forward the redacted prompt immediately ā the redaction preview is still shown in the status panel, but no review step happens before it is sent.
This is a personal project and cannot guarantee complete anonymization. Undetected sensitive information may still reach the third-party target LLM. Use this plugin at your own risk.
An LM Studio plugin that detects and redacts personally identifiable information (PII) before prompts are sent to another LLM, and restores the originals in the model's response.
By default, PII detection is performed by Desert Ant Redact ā a local, on-device PII detection model that ships with the plugin (no LLM needed; the weights download on first use and are cached). Alternatively, a dedicated LLM can be used for detection, ideally running locally or on self-hosted infrastructure. The redacted prompt is sent to another LLM via an OpenAI-compatible API, and the plugin translates the placeholders in the response back to their original values ā locally, so the originals never leave your machine.
The following example demonstrates how PII works when the skip confirmation option is set to true:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā User ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā⤠ā Please generate a response to this email, that the account ā ā has been created: ā ā ā ā Hi Sally, ā ā Could you please add a new user account for ā ā john@our-business.com? ā ā Thanks, ā ā Petra ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā Assistant ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā⤠ā ā PII redacted successfully ā forwarding without ā ā confirmation. Detected 3 PII entity(ies): ⢠ā ā [[[GIVEN_NAME_1]]] ā "Sally" (GIVEN_NAME) ⢠ā ā [[[EMAIL_1]]] ā "john@our-business.com" (EMAIL) ⢠ā ā [[[GIVEN_NAME_2]]] ā "Petra" (GIVEN_NAME) ā ā ā ā ā Done predicting ā ā ā ā ā ā Hi Petra, ā ā ā ā The new user account for john@our-business.com has been ā ā created successfully. ā ā ā ā Best, ā ā Sally ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
The assistant target model receives this prompt:
It generates this response:
The plugin registers two hooks:
--c. Only the redacted text is ever forwarded.Because the plugin contains a generator, it does not appear in the plugins list. Instead, it appears in the model dropdown and acts as a model ā select it instead of a regular model, and configure the redaction model and actual target model in the plugin settings.
A few details worth knowing:
Global settings (shared across all chats, so they persist when starting a new conversation):
| Setting | Type | Description |
|---|---|---|
| Detection Engine | Select | Redact (on-device model) (default) uses the Desert Ant Redact model ā no LLM needed, weights download on first use. LLM (PII Detection Model) uses the configured LLM for detection. |
| PII Detection Model | String | Only used when Detection Engine is LLM. The LLM used for PII detection. Leave blank to use the currently loaded model. |
| Assistant Model | String | The model ID sent to the OpenAI-compatible endpoint, e.g. gpt-4o-mini (OpenAI). |
| Skip Confirmation | Boolean | When enabled, redacted prompts are forwarded immediately without requiring --c. Default: off. |
| API Key | String (protected) | API key for the OpenAI-compatible endpoint, e.g. sk-.... |
| Base URL | String | Base URL of the endpoint. Defaults to https://api.openai.com/v1. |
Confirmation is required by default: when PII is detected, the plugin shows the redaction preview and waits for a message containing --c before forwarding. Enable Skip Confirmation to forward the redacted prompt immediately ā the redaction preview is still shown in the status panel, but no review step happens before it is sent.
This is a personal project and cannot guarantee complete anonymization. Undetected sensitive information may still reach the third-party target LLM. Use this plugin at your own risk.
~/.cache/pii-redact/ on first use. If macOS Gatekeeper prompts about pii-redact-node, allowing it is safe ā it is a re-signed copy of LM Studio's own Node binary, created by the plugin.Please generate a response to this email, that the account has been created:
Hi [[[GIVEN_NAME_1]]],
Could you please add a new user account for [[[EMAIL_1]]]?
Thanks,
[[[GIVEN_NAME_2]]]
Hi [[[GIVEN_NAME_2]]],
The new user account for [[[EMAIL_1]]] has been created successfully.
Best,
[[[GIVEN_NAME_1]]]
npm install
npm run dev # starts the LM Studio plugin dev server and rebuilds on changes
npm run build # type-checks and compiles src/ to the repo root
~/.cache/pii-redact/ on first use. If macOS Gatekeeper prompts about pii-redact-node, allowing it is safe ā it is a re-signed copy of LM Studio's own Node binary, created by the plugin.Please generate a response to this email, that the account has been created:
Hi [[[GIVEN_NAME_1]]],
Could you please add a new user account for [[[EMAIL_1]]]?
Thanks,
[[[GIVEN_NAME_2]]]
Hi [[[GIVEN_NAME_2]]],
The new user account for [[[EMAIL_1]]] has been created successfully.
Best,
[[[GIVEN_NAME_1]]]
npm install
npm run dev # starts the LM Studio plugin dev server and rebuilds on changes
npm run build # type-checks and compiles src/ to the repo root