Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ Real output from the bundled defaults (`node` on the committed `dist/`):
```jsonc
// route("What is the capital of France?", undefined, 256, { ... })
{
"model": "google/gemini-2.5-flash",
"model": "google/gemini-3.5-flash-lite",
"tier": "SIMPLE",
"taskType": "chat",
"profile": "auto",
"confidence": 0.77,
"candidates": ["google/gemini-2.5-flash", "google/gemini-3-flash-preview", "google/gemini-3.5-flash-lite", "…"],
"reasoning": "score=-0.10 | short (8 tokens), simple (what is, capital of) | v3 task=chat agentRisk=standard … candidates=9"
"candidates": ["google/gemini-3.5-flash-lite", "google/gemini-3-flash-preview", "deepseek/deepseek-chat", "…"],
"reasoning": "score=-0.10 | short (8 tokens), simple (what is, capital of) | v3 task=chat agentRisk=standard … candidates=8"
}

// route("Prove that the sum of two odd integers is even, step by step.", undefined, 4096, { ... })
Expand Down Expand Up @@ -268,7 +268,7 @@ Two rules govern this file, and both are load-bearing:
1. **These are weak priors, never task-quality labels.** They inform the `speed` and `reliability` terms only. A model is not "better" because it is fast.
2. **Historical numbers are never presented as a current provider SLA.** Hosts are expected to inject fresher observations (see below); the committed snapshot exists so the engine is safe and useful when a catalog is temporarily unavailable.

The repository ships 69 live performance profiles (three samples per model), 9 auditable historical seeds, 84 function-calling probe results, and a built-in snapshot of the 97 text models in the public catalog (2026-11-24 sync). Eleven newly listed models passed a real structured tool-call probe and are admitted as availability fallbacks for tool-required turns. DeepSeek V4 Flash Vision Experimental and Qwen 3.8 Flash did not return a valid tool call and remain fail-closed. GPT-6.1 Sol and DeepSeek V4.1 Flash also passed a structured tool-call probe in the subsequent capability refresh. Gemini 4 Carbon, added 2026-11-11 ahead of its gateway listing, returned its own next tool call through a two-round tool history on both the streaming and non-streaming gateway paths, so it is admitted as a tool fallback too. Kimi K3.1 Pro, which replaced Kimi K3 in every chain and affinity band on 2026-11-23, passed the live profile probe (three completions, no errors, a well-formed tool call); its reasoningMath affinity is measured on K3.1 Pro (paired against K3 on 50 MGSM rows on 2026-11-23: 41/50 vs 44/50 at a 512-token budget, every gap a truncation, 46/50 each when the truncated rows were rerun at 2,048 tokens), and it moves from 0.9 to 0.88. Its other affinity values are still carried over from K3, not measured on K3.1 Pro. On 2026-11-24 Gemini 3.6 Flash replaced Gemini 3.5 Flash, and GPT-5.4 Mini replaced o4-mini, in every chain and affinity band, when the gateways began redirecting the retired ids to them; 3.6 Flash's affinity values are carried over from 3.5 Flash (which Google had been answering with 3.6 since October), not measured on 3.6. Mistral Large 4, Gemini 4 Argon, Hydrogen and Neon, Claude Fable 5.2, and GPT-6.2 Astra and Sol have no probe evidence yet. A model with no probe evidence can serve plain chat but never a tool-required turn.
The repository ships 69 live performance profiles (three samples per model), 9 auditable historical seeds, 84 function-calling probe results, and a built-in snapshot of the 97 text models in the public catalog (2026-11-24 sync). Eleven newly listed models passed a real structured tool-call probe and are admitted as availability fallbacks for tool-required turns. DeepSeek V4 Flash Vision Experimental and Qwen 3.8 Flash did not return a valid tool call and remain fail-closed. GPT-6.1 Sol and DeepSeek V4.1 Flash also passed a structured tool-call probe in the subsequent capability refresh. Gemini 4 Carbon, added 2026-11-11 ahead of its gateway listing, returned its own next tool call through a two-round tool history on both the streaming and non-streaming gateway paths, so it is admitted as a tool fallback too. Kimi K3.1 Pro, which replaced Kimi K3 in every chain and affinity band on 2026-11-23, passed the live profile probe (three completions, no errors, a well-formed tool call); its reasoningMath affinity is measured on K3.1 Pro (paired against K3 on 50 MGSM rows on 2026-11-23: 41/50 vs 44/50 at a 512-token budget, every gap a truncation, 46/50 each when the truncated rows were rerun at 2,048 tokens), and it moves from 0.9 to 0.88. Its other affinity values are still carried over from K3, not measured on K3.1 Pro. On 2026-11-24 Gemini 3.6 Flash replaced Gemini 3.5 Flash, and GPT-5.4 Mini replaced o4-mini, in every chain and affinity band, when the gateways began redirecting the retired ids to them; 3.6 Flash's affinity values are carried over from 3.5 Flash (which Google had been answering with 3.6 since October), not measured on 3.6. On 2026-12-01 Gemini 3.5 Flash-Lite replaces Gemini 2.5 Flash, and Gemini 3.8 Flash replaces Gemini 2.5 Pro, the same way; 3.5 Flash-Lite's extraction and chat affinity is carried over from 2.5 Flash. Mistral Large 4, Gemini 4 Argon, Hydrogen and Neon, Claude Fable 5.2, and GPT-6.2 Astra and Sol have no probe evidence yet. A model with no probe evidence can serve plain chat but never a tool-required turn.

Passing the function-call probe does **not** promote a model to primary. New tool-capable models are appended after the configured and trajectory-benchmarked candidate chains with neutral task affinity; they can recover an unavailable route immediately (cheapest first outside Premium), while primary promotion still requires an end-to-end agent evaluation.

Expand Down
64 changes: 39 additions & 25 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

40 changes: 28 additions & 12 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
},

classifier: {
llmModel: "google/gemini-2.5-flash",
// gemini-2.5-flash until Google retired it on 2026-12-01 (the gateways
// redirect it to 3.5 Flash-Lite). Nothing in this package or ClawRouter
// reads llmModel today. Before wiring it, note that 3.5 Flash-Lite always
// thinks (it rejects a thinking budget of 0), so llmMaxTokens 10 may be
// spent on reasoning before any label is emitted.
llmModel: "google/gemini-3.5-flash-lite",
llmMaxTokens: 10,
llmTemperature: 0,
promptTruncationChars: 500,
Expand Down Expand Up @@ -1098,14 +1103,26 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
// (portfolio.ts).
// - openai/o4-mini (and o1, o3-mini) -> openai/gpt-5.4-mini, at the same
// position. Dead at OpenAI since 2026-10-23 and on Azure since 2026-11-19.
//
// Retirements 2026-12-01 (Google retires Gemini 2.5; the gateways redirect):
// - google/gemini-2.5-flash -> google/gemini-3.5-flash-lite (same
// $0.30/$2.50), in place, with the same dedupe rule. 3.5 Flash-Lite has
// no vision tag where 2.5 Flash had one, so a SIMPLE vision turn now
// falls past it to the next vision-capable rung instead of reaching a
// redirected model that would drop the image.
// - google/gemini-2.5-pro -> google/gemini-3.8-flash ($0.75/$3.75), in
// place.

// Auto (balanced) tier configs - current default smart routing
tiers: {
SIMPLE: {
primary: "google/gemini-2.5-flash", // $0.30/$2.50 — 60% retention (best) in the 2026-03 run; still the fastest quality answer
// Was google/gemini-2.5-flash (60% retention, best, in the 2026-03 run)
// until its 2026-12-01 retirement. 3.5 Flash-Lite is what the gateways
// serve under that name from then on; it was this chain's second
// fallback and is dropped there.
primary: "google/gemini-3.5-flash-lite", // $0.30/$2.50, 1M ctx, thinking mode, no vision
fallback: [
"google/gemini-3-flash-preview", // $0.50/$3 — GPQA 5/6 in the 2026-07 calibration
"google/gemini-3.5-flash-lite", // $0.30/$2.50, 1M ctx, thinking mode — same price as 2.5 Flash, newer generation
"deepseek/deepseek-chat", // $0.14/$0.28, 1M ctx
"google/gemini-3.1-flash-lite", // $0.25/$1.50, 1M ctx
"openai/gpt-5.6-luna", // $0.20/$1.20, 1M ctx — GPT-5.6 cost tier (cut 2026-07-30)
Expand All @@ -1125,7 +1142,7 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
"openai/gpt-5.6-terra", // $2/$12, 1M ctx — GPT-5.6 balanced tier
"google/gemini-3-flash-preview", // $0.50/$3
"deepseek/deepseek-chat", // $0.14/$0.28
"google/gemini-2.5-flash", // $0.30/$2.50
"google/gemini-3.5-flash-lite", // $0.30/$2.50 — 2.5 Flash's successor (retired 2026-12-01)
"minimax/minimax-m3", // $0.30/$1.20, 1M ctx
"google/gemini-3.1-flash-lite", // $0.25/$1.50
"openai/gpt-5.6-luna", // $0.20/$1.20
Expand All @@ -1138,7 +1155,7 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
"google/gemini-3.6-flash", // $0.75/$3.75 — Pro-level quality at Flash price (Google's claim); also 3.5 Flash's successor (3.5 retired 2026-11-24 and was the next rung)
"anthropic/claude-sonnet-5", // $3/$15 — near-Opus quality, tau2 + Terminal-Bench calibrated
"xai/grok-4.5", // $2.50/$9 — 503-resistant, independent infra (was grok-4-0709, now hidden)
"google/gemini-2.5-pro", // $1.25/$10
"google/gemini-3.8-flash", // $0.75/$3.75 — 2.5 Pro's successor (retired 2026-12-01)
"anthropic/claude-sonnet-4.6", // $3/$15
"openai/gpt-5.6-terra", // $2/$12 — GPT-5.6 balanced tier (Sol excluded: #202)
"openai/gpt-5.5", // $5/$30 — prior OpenAI flagship
Expand All @@ -1147,7 +1164,7 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
"moonshot/kimi-k3.1-pro", // $2/$10, 1M ctx — Moonshot flagship (K3 successor)
"deepseek/deepseek-v4-pro", // $0.435/$0.87 — strongest open-weight reasoner
"deepseek/deepseek-chat", // $0.14/$0.28 — cheap last resort
"google/gemini-2.5-flash", // $0.30/$2.50
"google/gemini-3.5-flash-lite", // $0.30/$2.50 — 2.5 Flash's successor (retired 2026-12-01)
],
},
REASONING: {
Expand Down Expand Up @@ -1199,7 +1216,7 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
"openai/gpt-5.6-luna", // $0.20/$1.20
"openai/gpt-5.4-nano", // $0.20/$1.25
"google/gemini-2.5-flash-lite", // $0.10/$0.40
"google/gemini-2.5-flash", // $0.30/$2.50
"google/gemini-3.5-flash-lite", // $0.30/$2.50 — 2.5 Flash's successor (retired 2026-12-01)
],
},
COMPLEX: {
Expand All @@ -1209,7 +1226,7 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
"minimax/minimax-m3", // $0.30/$1.20, 1M ctx
"deepseek/deepseek-v4-pro", // $0.435/$0.87
"google/gemini-3.1-flash-lite", // $0.25/$1.50
"google/gemini-2.5-flash", // $0.30/$2.50
"google/gemini-3.5-flash-lite", // $0.30/$2.50 — 2.5 Flash's successor (retired 2026-12-01)
],
},
REASONING: {
Expand All @@ -1234,8 +1251,7 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
fallback: [
"anthropic/claude-haiku-4.5", // $1/$5
"zai/glm-5.3", // $1.40/$4.40, 1M ctx
"google/gemini-2.5-flash", // $0.30/$2.50
"google/gemini-3.5-flash-lite", // $0.30/$2.50
"google/gemini-3.5-flash-lite", // $0.30/$2.50 — written where 2.5 Flash sat (retired 2026-12-01); the duplicate after it is dropped
"deepseek/deepseek-chat", // $0.14/$0.28
],
},
Expand All @@ -1246,7 +1262,7 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
"moonshot/kimi-k3.1-pro", // $2/$10, 1M ctx — Moonshot flagship
"zai/glm-5.3", // $1.40/$4.40 — long-horizon coding
"google/gemini-3.6-flash", // $0.75/$3.75 (3.5 Flash, the next rung, retired 2026-11-24)
"google/gemini-2.5-pro", // $1.25/$10
"google/gemini-3.8-flash", // $0.75/$3.75 — 2.5 Pro's successor (retired 2026-12-01)
"xai/grok-4.5", // $2.50/$9
"anthropic/claude-sonnet-4.6", // $3/$15
"openai/gpt-5.6-terra", // $2/$12
Expand Down Expand Up @@ -1304,7 +1320,7 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
"openai/gpt-5.6-luna", // $0.20/$1.20 — lightweight agentic tier of GPT-5.6
"zai/glm-5.3-flash", // $0.15/$0.50 — tool calls verified live 2026-08-27
"anthropic/claude-haiku-4.5", // $1/$5
"google/gemini-2.5-flash", // $0.30/$2.50
"google/gemini-3.5-flash-lite", // $0.30/$2.50 — 2.5 Flash's successor (retired 2026-12-01)
],
},
MEDIUM: {
Expand Down
Loading
Loading