Plugins
Extend AllRoutes requests with web search, file parsing, response healing, and more.
Overview
Plugins add capabilities to AllRoutes requests without changing your application logic. Enable them per-request via the plugins array, or set organization-wide defaults in the dashboard.
Enabling Plugins
Add plugins to any chat completion request:
{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "What happened in the news today?"}],
"plugins": [
{"id": "web"},
{"id": "response-healing"}
]
}
Available Plugins
Web Search (:online)
Augments the model's response with real-time web search results. The model receives search snippets as additional context and can cite sources in its response.
{
"plugins": [{"id": "web"}],
"web_search_options": {
"max_results": 5,
"search_depth": "advanced"
}
}
| Option | Type | Default | Description |
|---|---|---|---|
max_results | integer | 5 | Maximum number of search results to include |
search_depth | string | "basic" | Search depth: "basic" or "advanced" |
Use cases: current events, fact-checking, research queries, real-time data.
File Parser
Extracts text content from uploaded files (PDF, DOCX, XLSX, CSV, images) and includes it in the model's context.
{
"plugins": [{"id": "file-parser"}]
}
Supported formats: PDF, DOCX, XLSX, CSV, TXT, PNG, JPG, WEBP.
Response Healing
Automatically detects and fixes malformed model outputs. If the model produces invalid JSON, incomplete markdown, or truncated code blocks, response healing repairs the output before returning it.
{
"plugins": [{"id": "response-healing"}]
}
Common fixes:
- Closes unclosed JSON brackets and braces
- Completes truncated markdown tables
- Fixes broken code fences
- Repairs invalid escape sequences
Code Interpreter
Executes code generated by the model in a sandboxed environment and returns the output. Useful for math, data analysis, and visualization tasks.
{
"plugins": [{"id": "code-interpreter"}]
}
Supported languages: Python (with numpy, pandas, matplotlib, scipy).
PII Redactor
Detects and redacts Personally Identifiable Information in both requests and responses. See Guardrails for details.
{
"plugins": [{"id": "pii-redactor"}]
}
Bidirectional: PII is replaced with placeholders before reaching the provider, then restored in the response.
Injection Detector
Scans incoming messages for prompt injection attempts and blocks malicious requests. See Guardrails for details.
{
"plugins": [{"id": "injection-detector"}]
}
Returns 400 Bad Request when an injection attempt is detected.
Toxicity Filter
Scores content across harm categories and blocks requests or responses that exceed configured thresholds. See Guardrails for details.
{
"plugins": [{"id": "toxicity-filter"}]
}
Organization Defaults
Set default plugins for all requests from your organization in the dashboard under Settings > Plugins. Per-request plugins arrays override organization defaults.
You can also set defaults via the API:
curl -X PUT https://api.allroutes.ai/v1/org/plugins \
-H "Authorization: Bearer allroutes_mgmt_..." \
-H "Content-Type: application/json" \
-d '{
"default_plugins": [
{"id": "response-healing"},
{"id": "pii-redactor"}
]
}'
Plugin Execution Order
When multiple plugins are enabled, they execute in a defined order:
- injection-detector -- blocks malicious requests before processing
- pii-redactor (inbound) -- redacts PII from user messages
- file-parser -- extracts file content into the prompt
- web -- appends search results to the context
- Model inference
- code-interpreter -- executes code blocks in the response
- response-healing -- fixes malformed output
- toxicity-filter -- blocks harmful responses
- pii-redactor (outbound) -- restores PII placeholders
Plugin Response Headers
| Header | Description |
|---|---|
X-AllRoutes-Plugins | Comma-separated list of active plugins |
X-AllRoutes-Web-Sources | Number of web sources included (web search plugin) |
X-AllRoutes-Healed | true if response healing was applied |
SDK Examples
Python
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "What's the latest on AI regulation?"}],
plugins=[{"id": "web"}, {"id": "response-healing"}],
)
Node.js
const completion = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "What's the latest on AI regulation?" }],
plugins: [{ id: "web" }, { id: "response-healing" }],
});
See Also
- Guardrails -- compliance-oriented plugin profiles
- Chat Completions -- the
pluginsrequest parameter - Files API -- upload files to feed the file-parser plugin
- Presets -- bundle a default plugin set into a named preset