Plugins
Overview of the DeepFellow plugin system and built-in plugins.
The plugin system enables dynamic control over request inputs and response outputs at each endpoint.
It works by intercepting requests to and responses from an LLM in order to:
- Check the request body (e.g., to detect abuse).
- Check the request headers (e.g., header manipulations like splitting, injections, smuggling).
- Transform data (e.g., anonymize sensitive data).
- Change the style and tone of the model.
Plugins can be layered and composed to achieve modular and sequential modification of requests in a FIFO (First In, First Out) manner. Each plugin has a priority — the higher the number, the earlier the plugin runs. Priority accepts float values, such as 1.5, so you can insert a plugin between two existing priorities without changing any other plugin's configuration.
To create your own plugin, see Create Plugins.
Plugin configuration (plugins_setup) is a dynamic setting. Change it from the "Plugins Setup" section of the Server Configuration card, or with PUT /admin/config. The change takes effect immediately, without a restart. See Server Configuration.
Managing Plugins in the UI
The DeepFellow Server panel shows all available plugins with their current status. You can see which plugins are enabled and which are disabled at a glance.

Hovering over a plugin shows the endpoints it applies to.

You may also see a df_test_plugin entry in the list. This is an internal development and debugging plugin, disabled by default, and it is not intended for production use.
Example: Abuse Detection and Anonymize Together
This example shows both built-in plugins running on the same request. The following plugins_setup value enables abuse detection with qwen3:1.7b and anonymization for gpt-4.1 and gpt-5:
{ "df_abuse_model": "qwen3:1.7b", "df_anonymize_models": ["gpt-4.1", "gpt-5"] }Send a chat completion request:
curl -X POST 'http://127.0.0.1:8000/v1/chat/completions' \
-H 'accept: application/json' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"messages": [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Hello!",
"role": "user"
}
],
"model": "gpt-4.1",
"stream": false
}'The server logs show both plugins executing in order — abuse detection first, then anonymization:
INFO: DFAbusePlugin: Abusive level: 0.0
INFO: DFAbusePlugin: Accepted
INFO: DFAnonymizePlugin: Anonymizing request
INFO: DFAnonymizePlugin: Deanonymizing response.
INFO: 127.0.0.1:58918 - "POST /v1/chat/completions HTTP/1.1" 200 OKThe abuse score of 0.0 means the content is clean. The request then passes to the Anonymize plugin, which replaces any PII before forwarding to the model and restores it in the response.
Built-in Plugins
DeepFellow Server ships with two built-in plugins, Abuse Detection and Anonymize, enabled by default and ready to configure. It also ships with two experimental Threat Intelligence plugins, disabled by default. See Threat Intelligence Guards (Experimental) for details.
Abuse Detection
The df_abuse_detection_plugin checks every request to /v1/chat/completions, /v1/completions, /v1/responses, /v1/messages, and /api/chat for abusive content before it reaches the model. It sends the full conversation to a configurable LLM, which returns a score between 0.0 and 1.0. If the score meets or exceeds the configured threshold, the request is rejected with HTTP 422 Unprocessable Entity. The error body uses the format of the endpoint: the Anthropic format on /v1/messages, the Ollama format on /api/chat, and the OpenAI-style format on the other endpoints.
On /v1/responses, the plugin builds the conversation from the instructions and the input. It checks the text of the input string, of message items, and of tool call outputs. It skips images, files, and other items.
On /v1/completions, the plugin checks the prompt and the suffix. A request whose prompt contains only token IDs and that has no suffix carries no text, so the plugin lets it through unchecked.
Detected content types:
- Hate speech and discriminatory language
- Harassment, bullying, and threatening behavior
- Explicit violence and graphic content
- Sexual harassment and inappropriate sexual content
- Doxxing and malicious sharing of personal information
- Spam and malicious links
- Self-harm and suicide-related content
- Cyberbullying and targeted harassment
- Negative or disparaging content about another person
- Insulting or demeaning poems about a person
Scoring scale:
| Score | Meaning |
|---|---|
| 0.0 – 0.2 | Clean content, no abuse detected |
| 0.3 – 0.4 | Minor concerns, borderline inappropriate |
| 0.5 – 0.6 | Moderate abuse, clearly inappropriate |
| 0.7 – 0.8 | High abuse, severe violations |
| 0.9 – 1.0 | Extreme abuse, immediate action required |
Configuration via the plugins_setup dynamic setting. See Server Configuration.
| Key | Required | Default | Description |
|---|---|---|---|
df_abuse_model | Yes | — | Name of the model used for abuse scoring |
df_abuse_threshold | No | 0.5 | Float threshold above which a request is blocked |
Example configuration:
{ "df_abuse_model": "llama3.1:8b", "df_abuse_threshold": "0.6" }When abuse is detected, the plugin adds the X-PLUGIN-df_abuse_detection_plugin response header with the plugin version.
This plugin runs with priority 100.0 and applies to the /v1/chat/completions, /v1/completions, /v1/responses, /v1/messages, and /api/chat endpoints.
The model set in df_abuse_model must be available in your DeepFellow Infra instance. If the model is unavailable or not configured, abuse detection is silently skipped and all requests pass through.
Anonymize
The df_anonymize_plugin removes personally identifiable information (PII) from messages before they reach the model. It works on /v1/chat/completions, /v1/completions, /v1/responses, /v1/messages, and /api/chat. After the model responds, the plugin restores the original values so your application receives the real data. The process is transparent to both the caller and the model.
Detected entity types:
The plugin uses the spaCy en_core_web_sm model for named entity recognition, and regular expressions for structured patterns.
| Source | Entity types |
|---|---|
| spaCy NER | PERSON, ORG, GPE (countries, cities, states), MONEY, DATE, TIME, PERCENT |
| Regex | EMAIL, PHONE (US format), SOCIAL_SECURITY (SSN: XXX-XX-XXXX) |
Each detected entity is replaced with a numbered token, for example <PERSON_1> or <EMAIL_2>. Tokens are consistent within a single request: the same original value always maps to the same token.
Anonymized request fields:
| Endpoint | Fields |
|---|---|
/v1/chat/completions | The content of each message |
/v1/responses | instructions, the input string, and the text of message items, function call and MCP approval request arguments, tool call outputs, and the summary and content of reasoning items in input |
/v1/completions | prompt and suffix |
/v1/messages | system, the text, tool_result, and search_result blocks of each message, the title, context, and text of document blocks, and the input of tool_use and server_tool_use blocks |
/api/chat | The content of each message and the arguments of each tool call |
In function call and MCP approval request arguments on /v1/responses, the input of tool_use and server_tool_use blocks on /v1/messages, and tool call arguments on /api/chat, only string values change, so the JSON stays valid.
On /v1/responses, images, files, and the encrypted_content of reasoning items stay unchanged. On /v1/completions, a prompt given as token IDs stays unchanged.
On /v1/responses, the plugin also covers each MCP tool that DeepFellow Server runs. Before the tool runs, the plugin restores the original values in the tool's arguments, so the tool receives the real data. Before the tool's output reaches the model, the plugin anonymizes the text of the output. A value that already appears in the request gets the same token. Images and files in the tool's output stay unchanged.
On /v1/messages, images, PDF data, and thinking, redacted_thinking, and web_search_tool_result blocks stay unchanged. In a PDF document, given as base64 data or a URL, only the title and context change.
Configuration via the plugins_setup dynamic setting. See Server Configuration.
| Key | Required | Description |
|---|---|---|
df_anonymize_models | Yes | List of model names for which anonymization applies, including their aliases in DeepFellow Infra. Requests to other models are passed through unchanged. |
Example configuration:
{ "df_anonymize_models": ["llama3.1:8b", "mistral:7b"] }Model names:
The plugin reads model names and aliases from GET /v1/models of DeepFellow Infra and matches a request by any name of a listed model:
- An alias works in both directions. If
gpt-4.1has the aliasmy-gpt, listing either name anonymizes requests to both. - A rename hides the original name, so the plugin matches a renamed model only by its new name. List the name that
GET /v1/modelsshows. - If the plugin doesn't know which model a name belongs to, it anonymizes the request. This happens when Infra doesn't serve the name, when Infra is unreachable, or when Infra doesn't report aliases.
- The plugin refreshes model names every 30 seconds. When you move an alias to another model in Infra, the change takes effect within 30 seconds.
To match aliases, the plugin needs a DeepFellow Infra version that reports them in GET /v1/models. With an older Infra, the plugin anonymizes requests to every model that isn't listed in df_anonymize_models.
The plugin supports both streaming and non-streaming responses. In a streamed response, it holds back a token split between two chunks until the token is complete. It restores the original values in these response fields:
- On
/v1/chat/completions, the message content and the model's reasoning, which the response carries in thereasoningorreasoning_contentfield. - On
/v1/responses, the text of each message, the model's reasoning and reasoning summaries, theargumentsof each function call and MCP approval request, theoutputof eachfunction_call_outputitem, and theinputof each custom tool call. - On
/v1/completions, thetextof each item inchoices. - On
/v1/messages, thetextblocks and theinputoftool_useandserver_tool_useblocks. - On
/api/chat, the messagecontent, the model'sthinking, and theargumentsof each tool call.
On /v1/messages, thinking blocks keep the tokens. Anthropic signs each thinking block and rejects a changed block when the client sends it back in the next request.
When anonymization occurs, the plugin adds the X-PLUGIN-df_anonymize_plugin response header with the plugin version.
If anonymization fails, the plugin rejects the request, so no part of it reaches the model. The response is HTTP 503 Service Unavailable with the message Anonymization failed. It carries the X-PLUGIN-df_anonymize_plugin header, and its error body uses the format of the endpoint, as described for Abuse Detection. If a text in the request is longer than 1,000,000 characters, the response is HTTP 413 Content Too Large with a message that gives the limit. If a text isn't valid Unicode, the response is HTTP 422 Unprocessable Entity with a message that explains the problem. Both carry the X-PLUGIN-df_anonymize_plugin header, and their error bodies use the format of the endpoint.
On /v1/responses, the plugin also rejects the request when it fails on an MCP tool that DeepFellow Server runs:
- If the plugin fails to anonymize the tool's output, the output doesn't reach the model. The response is HTTP
503 Service Unavailablewith the messagePlugin df_anonymize_plugin transform_tool_output error. This includes an output longer than 1,000,000 characters and an output that isn't valid Unicode. - If the plugin fails to restore the tool's arguments, the tool doesn't run. The response is HTTP
503 Service Unavailablewith the messagePlugin df_anonymize_plugin before_tool_call error.
In a streamed response, the stream ends with an error event with the code "503" and the same message.
This plugin runs with priority 1 and applies to the /v1/chat/completions, /v1/completions, /v1/responses, /v1/messages, and /api/chat endpoints. It executes after the Abuse Detection plugin on the way in, and before it on the way out.
Threat Intelligence Guards (Experimental)
DeepFellow Server includes two experimental plugins, df_ti_input_guard and df_ti_output_guard, that connect to an external Threat Intelligence service. They belong to the Threat Intelligence capability listed as coming soon in Key Elements, and DeepFellow Server ships both disabled by default.
- The
df_ti_input_guardplugin scans every message the client added in the current turn before it reaches the model. This includes system, developer, and tool messages, tool outputs, the Responsesinstructions, and the Messagessystemprompt. Whendf_ti_output_guardis enabled as well, the plugin also scans the conversation history. - The
df_ti_output_guardplugin scans the model's response before it reaches the caller.
Each plugin sends the relevant text to a named Threat Intelligence workflow for evaluation. If the workflow reports the content as unsafe, the plugin rejects the request with HTTP 403 Forbidden.
If the text is longer than the Threat Intelligence service accepts, the plugin rejects the request with HTTP 403 Forbidden, regardless of ti_fail_open. The error message gives the limit in characters, such as Forbidden. The text is too long for the TI check (limit: 64000 characters). The Threat Intelligence service sets the limit.
A rejected request gets an error body in the format of the endpoint: the Anthropic format on /v1/messages, the Ollama format on the Ollama-compatible /api/chat endpoint, and the OpenAI-style format on the other endpoints.
On /v1/completions, df_ti_input_guard scans the prompt and the suffix, and df_ti_output_guard scans the text of each item in choices.
On /v1/chat/completions, /v1/responses, /v1/messages, and /api/chat, a client sends the whole conversation with every request. When both guards are enabled, df_ti_input_guard also scans the conversation history. A forged model reply or a forged system message in the conversation history then doesn't reach the model unchecked. The guard splits the conversation history into turns and checks each turn separately:
- The messages the client added in a turn, including tool outputs and system, developer, and tool messages, go to the
ti_input_workflow_nameworkflow. - Each earlier model reply, with its tool calls, goes to the
ti_output_workflow_nameworkflow together with the user message before it. The guard leaves out the model's reasoning.
The guard runs the checks of one request in parallel, at most ti_history_max_concurrent_checks at a time. All checks of one request share one 30-second limit. The longer the conversation, the more checks the request needs. If a request doesn't get every verdict within 30 seconds, the guard rejects it, unless ti_fail_open is "true".
df_ti_input_guard skips the part of the conversation history that the guards already checked. After the model replies, df_ti_output_guard stores a fingerprint of the conversation up to the end of the reply. In the next request, df_ti_input_guard finds the longest start of the conversation history that matches a stored fingerprint and checks only the rest of the conversation history. The messages the client added in the current turn always go to Threat Intelligence.
df_ti_output_guard stores a fingerprint only when every Threat Intelligence check of the request returns a verdict: the checks of the conversation, of the reply, and, on /v1/responses, of the output of each MCP tool that DeepFellow Server runs. If ti_fail_open lets any part of the request through unchecked, df_ti_output_guard stores no fingerprint. The next request then skips the conversation history only up to the last reply with a stored fingerprint, so it checks the unchecked part again.
A fingerprint matches only a conversation in the same project, checked with the same ti_input_workflow_name and ti_output_workflow_name. Every message and reply up to the stored reply must also have the same role and text. If the client changes an earlier message or reply, df_ti_input_guard checks the conversation history again, starting after the last unchanged reply before the change.
DeepFellow Server keeps each fingerprint in the ti_verified_history MongoDB collection for 7 days after the last request that stored it. A fingerprint is a keyed hash and holds no text of the conversation. DeepFellow Server creates the random key on first use and keeps it in the server_secrets collection. If the fingerprint lookup fails, df_ti_input_guard checks the whole conversation history, and df_ti_output_guard stores no fingerprint for the request.
A changed Threat Intelligence workflow under the same name doesn't invalidate the stored fingerprints. To check every conversation against the new rules at once, change ti_input_workflow_name or ti_output_workflow_name.
The Threat Intelligence workflow evaluates text only. If the prompt of a /v1/completions request contains token IDs, df_ti_input_guard rejects the request with HTTP 403 Forbidden, regardless of ti_fail_open. Send the prompt as a string or a list of strings instead.
On /v1/responses, df_ti_input_guard also scans function calls and the output of the MCP tools that DeepFellow Server runs itself:
- Each function call the client added to
inputin the current turn, as the tool name and itsarguments. This includes the function calls at the end ofinputthat DeepFellow Server runs on its MCP tools, so the guard scans them before the tools run. - The output of each MCP tool that DeepFellow Server runs, before the output reaches the model. This covers the tools that the model calls while it generates the response and the tools that DeepFellow Server runs for the function calls at the end of
input. The guard scans the text of the output and skips images and audio.
The ti_input_workflow_name workflow evaluates each tool output in a separate Threat Intelligence check. The guard applies ti_fail_open to these checks as it does to the check of the client's messages. An unsafe tool output rejects the request with HTTP 403 Forbidden, the same way as an unsafe message.
In a streamed response, the HTTP status stays 200 OK when the guard rejects the output of a tool that the model calls. DeepFellow Server ends the stream with an error event instead and sends no response.completed event. The event's code is "403", and its message gives the reason, such as Forbidden. Request is dangerous. for an unsafe output.
On /v1/responses, df_ti_output_guard also scans the function calls of the MCP tools that DeepFellow Server runs while it generates the response. This includes a streamed response.
The df_ti_output_guard plugin does not send the model's reasoning to the Threat Intelligence workflow. To keep text that the workflow never evaluated away from the caller, the guard removes the reasoning from every response it checks:
- On
/v1/chat/completions, it removes thereasoningandreasoning_contentfields from each message and each streamed delta. - On
/v1/responses, it empties thesummaryandcontentlists of each reasoning item inoutput. In a streamed response, it also drops the reasoning events. - On
/v1/messages, it empties thethinkingfield of eachthinkingblock incontent. In a streamed response, it drops thethinking_deltaevents and empties thethinkingfield of eachcontent_block_startevent. - On
/api/chat, it removes thethinkingfield from the message of the response and of each streamed object. In a streamed response, it also drops the objects that carry onlythinking. The final object, withdone: true, stays in the stream.
A /v1/completions response has no separate reasoning field, so the guard removes nothing from it. If the model writes its reasoning into text, the guard sends it to the Threat Intelligence workflow with the rest of the text.
The guard removes the reasoning even when ti_fail_open is "true" and the Threat Intelligence service is unreachable or returns a response the guard cannot read. If the guard has no API key or no valid ti_url, it checks nothing and the response keeps its reasoning, as the warning later in this section describes.
Enable or disable each guard from the Server panel, the same way you manage Abuse Detection and Anonymize. Both guards use one Threat Intelligence connection, so they read the same ti_url, ti_fail_open, and ti_max_concurrent_checks keys from the plugins_setup dynamic setting. Each guard applies ti_max_concurrent_checks to its own checks. df_ti_input_guard also reads ti_history_max_concurrent_checks. The workflow name is per guard, because Threat Intelligence builds a separate workflow for each one: df_ti_input_guard reads ti_input_workflow_name, and df_ti_output_guard reads ti_output_workflow_name. To change any of these keys, open the DF TI Guard row of Server Configuration, or call PUT /admin/config. The DF TI Guard row has no field for ti_max_concurrent_checks or ti_history_max_concurrent_checks. To set them, edit the Plugins Setup row or call PUT /admin/config. Saving the DF TI Guard row keeps both values. A key you leave unset falls back to the guard's own configuration file, which names the workflow ti_workflow_name in both guards. The new value takes effect on the next request, without a restart.
PUT /admin/config replaces plugins_setup whole. Send every key you want to keep alongside the Threat Intelligence ones, as Setting a Nested Field describes.
| Key | Description |
|---|---|
ti_url | Base URL of the Threat Intelligence service. |
ti_input_workflow_name | Name of the Threat Intelligence workflow that evaluates the prompt df_ti_input_guard scans. |
ti_output_workflow_name | Name of the Threat Intelligence workflow that evaluates the response df_ti_output_guard scans. |
ti_fail_open | When "true", the guard will let the request through if the Threat Intelligence service is unreachable or returns a response the guard cannot read. Any other value, including an empty or misspelled one, will make the guard reject the request. When you leave the key out, the guard uses its own default, false. |
ti_max_concurrent_checks | Maximum number of Threat Intelligence checks that each guard runs at once. When more requests arrive, their checks wait in a queue until a running check finishes. If a check gets no verdict within 30 seconds, including the time in the queue, the guard treats Threat Intelligence as unreachable and applies ti_fail_open. For df_ti_input_guard, the 30 seconds cover all checks of one request together. A value that is not a positive whole number falls back to the default, 32. |
ti_history_max_concurrent_checks | Maximum number of checks of one request that df_ti_input_guard runs at once when it scans the conversation history. The other checks of the request wait until one of them finishes, so one request doesn't take every check that ti_max_concurrent_checks allows. A value that is not a positive whole number falls back to the default, 4. |
ti_api_key | The Threat Intelligence API key. A dynamic secret field, separate from plugins_setup. GET /admin/config returns it masked, so read the plaintext value with GET /admin/config/reveal/ti_api_key. See Reading and Changing Configuration via the API. |
ti_api_key_env, set in the guard's own configuration file, names an environment variable that DeepFellow Server reads as a fallback when ti_api_key is empty. Both guards ship with it set to TI_API_KEY. It is a legacy setting for deployments that configured the guards before dynamic settings existed, and it keeps working unchanged.
A guard starts even without an API key set through ti_api_key or its environment variable fallback. This lets you add the key later from the panel. Until you set a key, an enabled guard logs a warning and lets every request through without a Threat Intelligence check. An empty or malformed ti_url has the same effect, regardless of ti_fail_open, because a broken URL is a configuration error rather than a service outage. Before you enable a guard, set both the API key and the URL.
To check that an enabled guard has a usable Threat Intelligence connection, call GET /plugins and read its status_detail field. The field names the problem, such as a missing API key. It is null when the guard is ready, and always null for a disabled guard.
Both plugins run with priority 2 and apply only to the /v1/chat/completions, /v1/completions, /v1/responses, /v1/messages, and /api/chat endpoints.
These plugins require a separate Threat Intelligence service that DeepFellow does not include yet. Treat them as an early preview, and confirm your Threat Intelligence workflow's behavior before you enable either plugin in a production environment.
We use cookies on our website. We use them to ensure proper functioning of the site and, if you agree, for purposes such as analytics, marketing, and targeting ads.