@rackrot/pi-bifrost1.1.0
Bifrost gateway as one pi provider: chat, responses and decision models, with missing model facts filled from models.dev
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
@rackrot/pi-bifrost
Registers a Bifrost gateway as one pi provider, bifrost.
Every upstream behind the gateway shows up as bifrost/<provider>/<model>, for chat and decision
models. Facts the gateway's /v1/models does not report (context window, output limit, price,
image input, reasoning) come from models.dev.
Install
pi install npm:@rackrot/pi-bifrost
Config (global ~/.pi/agent/rackrot/config.json(c) only)
{
"bifrost": {
"baseUrl": "https://bifrost.example.com",
"apiKeyEnv": "BIFROST_VK",
"models": {
"openrouter-decision/typesafe/jev-1.14": { "type": "decision" },
"anthropic/claude-haiku-5-5": { "api": "openai-responses" }
}
}
}
baseUrl: the gateway. The project layer is ignored, because this names the host that receives the key.apiKeyEnv: environment variable holding a Bifrost virtual key (defaultBIFROST_VK), sent as a bearer token. The dashboard login does not work for inference.models: models to add, keyed by the gateway'sprovider/modelid, for ones/v1/modelsdoes not list, such as decision models. An entry for a listed model overrides what the gateway and models.dev report. Fields:type(chatordecision),name,api(openai-completionsdefault, oropenai-responses),reasoning,input,contextWindow,maxTokens,cost(US dollars per million tokens).
Embedding, reranking and decisions for search
Core's shared retrieval block already talks to Bifrost; no extension is needed for it. Embedding
and reranking use the http provider on the gateway's /v1, and decisions use the typesafe
provider on its /typesafe route, with the same virtual key:
{
"retrieval": {
"embedding": {
"provider": "http",
"baseUrl": "https://bifrost.example.com/v1",
"model": "llama/qwen3-embedding-4b",
"apiKeyEnv": "BIFROST_VK"
},
"reranker": {
"provider": "http",
"baseUrl": "https://bifrost.example.com/v1",
"model": "llama/qwen3-reranker-0.6b",
"apiKeyEnv": "BIFROST_VK"
},
"decision": {
"enabled": true,
"provider": "typesafe",
"baseUrl": "https://bifrost.example.com/typesafe",
"model": "openrouter-decision/typesafe/jev-1.14",
"apiKeyEnv": "BIFROST_VK"
}
}
}
NVIDIA's nvidia/nvidia/nemotron-3.5-embed-1b and -8b embed queries and documents differently and
reject a request without input_type. Set "asymmetric": true in the embedding block: pi-core then sends
input_type and the x-bf-passthrough-extra-params header that makes the gateway forward it.
Changing the embedding model, or asymmetric, re-embeds stored vectors. Decision models are not listed by /v1/models;
use the id of the Bifrost provider that serves them, here openrouter-decision/….
Behavior
- Models are listed at startup. A gateway that is unreachable then leaves the provider unregistered, with a notice at session start.
- Each fact is taken from the config entry, else the gateway, else models.dev, else a default (128k context, 16k output, text input, free).
- Embedding, reranking and speech models are left out of the chat list.
- Decision models use pi's
openai-decisionsclassifier API, which matches the gateway's/v1/decisions. - The models.dev index is cached for a day at
<agent dir>/rackrot/models-dev.json; a failed refresh uses the old cache. - Failover between accounts and providers is the gateway's job: configure it in Bifrost.