@kognai/route
v0.1.0
Published
Expertise-axis model routing for Kognai agents — pick the right model for the task type
Maintainers
Readme
@kognai/route
Expertise-axis model routing for Kognai agents. Pick the right model for the task type — code, reasoning, content, audit, etc. The orchestrator's existing router picks by complexity tier; this picks by what kind of work it is.
# CLI — pipe-friendly: stdout is the model only, stderr explains
npx @kognai/route code
# → ollama/qwen3:14b
# local — qwen3:14b is the best widely-available local code model
# Combine with @kognai/run:
echo "..." | npx @kognai/run coder --llm $(npx @kognai/route code)
# Cloud preference for high-stakes audits
npx @kognai/route audit --prefer cloud
# → anthropic/claude-sonnet-4-6
# Show the full matrix
npx @kognai/route --listLibrary
import { recommendModel, listTaskTypes } from '@kognai/route';
const r = recommendModel('reason');
console.log(r.choice.llm); // "ollama/deepseek-r1:14b"
console.log(r.choice.reason); // "DeepSeek-R1 is RL-trained for reasoning..."
console.log(r.alternates); // [ { llm: 'anthropic/...', ... }, ... ]Task types
| type | what | default (local) | cloud |
|---|---|---|---|
| code | generate / edit / review code | ollama/qwen3:14b | anthropic/claude-sonnet-4-6 |
| reason | multi-step reasoning, math, planning | ollama/deepseek-r1:14b | anthropic/claude-sonnet-4-6 |
| lang | general Q&A, summarisation | ollama/qwen3:14b | anthropic/claude-haiku-4-5-20251001 |
| util | small transforms — extract, classify, format | ollama/qwen3:4b | anthropic/claude-haiku-4-5-20251001 |
| audit | high-stakes review (security, compliance) | ollama/qwen3:14b | anthropic/claude-sonnet-4-6 |
| content | long-form prose, marketing, docs | ollama/qwen3:14b | anthropic/claude-sonnet-4-6 |
| data | structured data shaping (JSON-out) | ollama/qwen3:14b | anthropic/claude-haiku-4-5-20251001 |
The matrix is opinionated. Each entry has a documented reason
(recommendation.choice.reason); the rationale is part of the API.
Defaults follow the Kognai sovereignty principle
prefer: 'auto' (the default) currently maps to local. The local model is
returned unless you explicitly pass prefer: 'cloud'. A future version may
read env hints (wallet state, model availability) — for now, local-first.
Zero npm dependencies
Pure data + pure functions. No network, no fs.
License
MIT
