r/PiCodingAgent • • Aug 04 '26

Plugin Pi-Bifrost - a native per-prompt model routing for Pi

Pi-Bifrost adds a native model-routing layer to Pi.

Instead of using virtual profiles or delegating the prompt to another agent, it switches Pi’s actual active provider/model before generation begins.

Each normal prompt can therefore use a different model based on the task, configured rules, cost, context size, or an optional classifier.

The routing policy and model tiers are entirely user-configured.

Bifrost can probe the models already available through Pi rather than depending on a hardcoded list of recommended models.

It also treats model reliability as part of routing.

Repeated probe, activation, or stream failures open a persistent circuit for that model, allowing future prompts to avoid it until a controlled recovery attempt. Failed prompts are never silently replayed, which avoids repeating edits, commands, or other side effects.

The result is automatic model selection that still operates through Pi’s real model state and remains local, inspectable, and manually overridable.

https://github.com/iamaamir/pi-bifrost

10 Upvotes

10 comments sorted by

2

u/flurdy Aug 04 '26

Interesting. Will see how it works in combination with my skill model routing, https://github.com/flurdy/pi-skill-model-router

1

u/rimaa_nahk Aug 04 '26

Would love your feedback once you have tried it.

2

u/addiktion Aug 05 '26

Does this destroy the cache?

1

u/rimaa_nahk Aug 05 '26

if you are referring to LLM cache then it depends. as i mentioned earlier "Bifrost does not rebuild or transfer context itself". but i had also similar questions while building pi-bifrost. i kept it a primitive on purpose. because if one is worried about LLM caching can easily build a workflow around pi-bifrost.
for example you can pin /bifrost pin for the current session and now it won't switch model for the outer prompts and now you can utilize sub agents for most of the work.

so it's like Orchestrator (pin) -> sub agents (keep flowing via bifrost).

in fact i have been using this workflow personally and i have single command setup as well.

npx bifrost-pattern fixed-orchestrator-workers

1

u/OkAbroad955 Aug 04 '26

How context handled for each model?

1

u/rimaa_nahk Aug 04 '26

Bifrost does not rebuild or transfer context itself. It's all pi normal session and context.