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"
  }
}
OptionTypeDefaultDescription
max_resultsinteger5Maximum number of search results to include
search_depthstring"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:

  1. injection-detector -- blocks malicious requests before processing
  2. pii-redactor (inbound) -- redacts PII from user messages
  3. file-parser -- extracts file content into the prompt
  4. web -- appends search results to the context
  5. Model inference
  6. code-interpreter -- executes code blocks in the response
  7. response-healing -- fixes malformed output
  8. toxicity-filter -- blocks harmful responses
  9. pii-redactor (outbound) -- restores PII placeholders

Plugin Response Headers

HeaderDescription
X-AllRoutes-PluginsComma-separated list of active plugins
X-AllRoutes-Web-SourcesNumber of web sources included (web search plugin)
X-AllRoutes-Healedtrue 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 plugins request parameter
  • Files API -- upload files to feed the file-parser plugin
  • Presets -- bundle a default plugin set into a named preset