Bifrost AI Gateway
Alice runs on a Bifrost AI Gateway as a Go plugin that Bifrost loads at startup. The plugin sends each request to Alice before it reaches the model and each reply after it returns, then enforces the verdict. Alice reads the conversation itself and screens the newest turn together with its tool calls and tool results.
Status: Beta · Evaluates: Prompts, Responses, Tool calls · Vendor: Maxim AI
Prompts and responses on OpenAI chat completions and Anthropic messages routes, streamed or not.
Setup
docker build -t bifrost-alice integrations/bifrost-alice-guardrail
Configuration: ALICE_API_KEY, app_id or app_ids_by_virtual_key, unscreened_routes, fail_open, timeout_ms
- Tested with Bifrost v2.3.0. Build the image above from Alice's
bifrost-alice-guardrailpackage; it builds Bifrost and the plugin together. The stockmaximhq/bifrostimage cannot load plugins, and serves traffic with the guardrail off if you try. - Add the
alice-guardrailplugin block below to Bifrost'sconfig.json. - Name the application whose policies apply: one
app_idfor the whole gateway, orapp_ids_by_virtual_keyto map each Bifrost virtual key to its own application. Leaveapp_idunset to refuse callers whose key is not mapped. - Run the image with
ALICE_API_KEYset. Bifrost logsplugin status: alice-guardrail - activeonce the plugin has loaded.
Example
config.json
{
"plugins": [
{
"enabled": true,
"name": "alice-guardrail",
"path": "/app/plugins/alice-guardrail.so",
"config": {
"api_key": "env.ALICE_API_KEY",
"app_id": "payments-bot",
"app_ids_by_virtual_key": { "support-team": "support-bot" },
"unscreened_routes": ["/v1/responses"],
"fail_open": false,
"timeout_ms": 10000
}
}
]
}
Blocked request (OpenAI route)
{
"error": {
"message": "Blocked by content policy: prompt_injection",
"type": "guardrail_content_policy_violation",
"code": "guardrail_content_policy_violation"
}
}
Good to know
A blocked request returns HTTP 400 in the caller's own API format, so OpenAI and Anthropic SDKs raise their usual error. A policy set to MASK is answered as a block, because the plugin does not rewrite content. A streamed reply is screened when the stream finishes: on a block, the stream ends with an error, but the text already streamed has reached the caller. fail_open: false (the default) refuses requests when Alice is unreachable. Only OpenAI chat completions and Anthropic messages are screened: other routes that reach a model (the Responses API, legacy completions, batches, async jobs, passthrough, Gemini and Bedrock) are refused with HTTP 403 unless listed in unscreened_routes, and their WebSocket versions are always refused, as is a request asking for more than one completion (n > 1). Text, text documents and search results are screened; images, PDFs and audio input reach the model unread. A configured app_id also applies to callers that send no virtual key. If your policies target system prompts, the system prompt, an OpenAI developer message included, is evaluated whole against the policies that list it, and again on later requests until it is allowed; a block on it blocks the request it arrived on. If your policies target tool definitions, each tool's definition (name, description and parameter schema) is evaluated against the policies that list it, and again on later requests until the tool set is allowed; a block on any definition blocks the request. Only the first 32 tools are evaluated, and a definition over 8,000 characters is evaluated without its parameter schema.