NadirClaw routes simple prompts to cheap/local models and complex ones to premium. The hard part is deciding "simple vs complex" reliably. Morph's Model Router does exactly that: ~50ms, returns difficulty (easy/medium/hard/needs_info) plus domain and ambiguity, trained on millions of coding prompts.
Instead of a length/keyword heuristic, NadirClaw could call /router/classify (or /router/multimodel with a cost_efficient policy) for the routing signal:
const { model } = await (await fetch("https://api.morphllm.com/v1/router/multimodel", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.MORPH_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ input: prompt, allowed_providers: ["anthropic"], policy: "cost_efficient" }),
})).json();
Could sit behind a config flag as an optional routing strategy alongside the existing rules.
Docs: https://docs.morphllm.com/sdk/components/router
NadirClaw routes simple prompts to cheap/local models and complex ones to premium. The hard part is deciding "simple vs complex" reliably. Morph's Model Router does exactly that: ~50ms, returns difficulty (easy/medium/hard/needs_info) plus domain and ambiguity, trained on millions of coding prompts.
Instead of a length/keyword heuristic, NadirClaw could call
/router/classify(or/router/multimodelwith acost_efficientpolicy) for the routing signal:Could sit behind a config flag as an optional routing strategy alongside the existing rules.
Docs: https://docs.morphllm.com/sdk/components/router