model-router / index.html
Agenten's picture
Upload 2 files
2468f68 verified
Raw History Blame Contribute Delete
14 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Interactive educational model router for exploring AI routing strategies across reasoning, cost, latency, privacy, coding and multimodality.">
<title>Model Router</title>
<style>
:root{
--bg:#07101f;--panel:#0c1930;--panel2:#11213f;--line:#23395f;
--text:#f4f7ff;--muted:#9db1cf;--cyan:#48d8ff;--blue:#6c8fff;
--violet:#9e7cff;--green:#58dda1;--amber:#ffd070;--red:#ff8f9b;
}
*{box-sizing:border-box}
body{
margin:0;background:
radial-gradient(circle at 12% 0,rgba(72,216,255,.14),transparent 30%),
radial-gradient(circle at 90% 0,rgba(158,124,255,.14),transparent 28%),
var(--bg);
color:var(--text);font:15px/1.55 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.wrap{max-width:1120px;margin:auto;padding:0 22px}
.hero{text-align:center;padding:68px 0 34px}
.badge{display:inline-block;padding:7px 12px;border:1px solid var(--line);border-radius:999px;color:var(--cyan);font-weight:800;font-size:12px;letter-spacing:.08em;text-transform:uppercase;background:#0b1830}
h1{font-size:clamp(44px,8vw,78px);line-height:1;margin:20px 0 14px;letter-spacing:-.055em}
.grad{background:linear-gradient(90deg,var(--cyan),#d5ddff,var(--violet));color:transparent;background-clip:text;-webkit-background-clip:text}
.hero p{max-width:780px;margin:auto;color:var(--muted);font-size:18px}
.layout{display:grid;grid-template-columns:1.05fr .95fr;gap:18px;padding:22px 0 42px}
.panel{border:1px solid var(--line);background:linear-gradient(155deg,#101f3b,#09152a);border-radius:20px;padding:21px;box-shadow:0 22px 55px rgba(0,0,0,.28)}
.panel h2{margin:0 0 4px;font-size:21px}
.sub{color:var(--muted);font-size:13px;margin-bottom:18px}
label{display:block;font-weight:750;font-size:13px;margin:14px 0 7px}
textarea,select,input[type=range]{
width:100%;
}
textarea,select{
background:#08162b;border:1px solid var(--line);border-radius:12px;color:var(--text);
padding:12px 13px;outline:none
}
textarea{min-height:105px;resize:vertical}
textarea:focus,select:focus{border-color:var(--cyan);box-shadow:0 0 0 3px rgba(72,216,255,.08)}
.rangeRow{display:grid;grid-template-columns:115px 1fr 34px;gap:10px;align-items:center;margin:12px 0}
.rangeRow span{color:var(--muted);font-size:12px}
input[type=range]{accent-color:#66a6ff}
.val{text-align:center;font-weight:850;color:var(--cyan)}
.checks{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin:16px 0}
.check{
display:flex;align-items:center;gap:9px;border:1px solid var(--line);border-radius:11px;
padding:10px;background:#0b1930;color:#c8d5e9;font-size:13px
}
button{
width:100%;border:0;border-radius:12px;padding:13px 15px;color:white;font-weight:850;
background:linear-gradient(90deg,#347fff,#795ff3);cursor:pointer;font-size:14px
}
button:hover{filter:brightness(1.08)}
.resultHero{border:1px solid #315083;background:linear-gradient(145deg,#102748,#111a38);border-radius:17px;padding:18px}
.eyebrow{font-size:11px;text-transform:uppercase;letter-spacing:.1em;color:var(--cyan);font-weight:850}
.modelClass{font-size:29px;font-weight:900;letter-spacing:-.035em;margin:5px 0}
.explain{color:var(--muted)}
.scoregrid{display:grid;grid-template-columns:repeat(2,1fr);gap:9px;margin:15px 0}
.score{padding:11px;border:1px solid var(--line);border-radius:12px;background:#09172c}
.score b{display:flex;justify-content:space-between;font-size:12px;margin-bottom:7px}
.bar{height:6px;background:#172948;border-radius:999px;overflow:hidden}
.fill{height:100%;background:linear-gradient(90deg,var(--cyan),var(--violet))}
.route{margin-top:15px;border-top:1px solid var(--line);padding-top:15px}
.routeFlow{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-top:10px}
.node{padding:7px 9px;border-radius:9px;border:1px solid var(--line);background:#0a1930;font-size:11px;font-weight:750}
.arrow{color:var(--cyan)}
.notes{margin-top:15px;padding:14px;border-radius:13px;background:#09162a;border:1px solid var(--line);color:var(--muted);font-size:12px}
.alt{margin-top:14px}
.altCard{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:11px 0;border-bottom:1px solid rgba(35,57,95,.7)}
.altCard:last-child{border-bottom:0}
.altCard b{font-size:13px}.altCard span{font-size:11px;color:var(--muted)}
.patterns{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;padding-bottom:64px}
.pattern{border:1px solid var(--line);background:#0b1930;border-radius:15px;padding:16px}
.pattern b{display:block;margin-bottom:6px}.pattern p{margin:0;color:var(--muted);font-size:12px}
footer{border-top:1px solid var(--line);padding:28px 0 44px;color:var(--muted);font-size:13px}
footer strong{color:var(--text)}
@media(max-width:820px){.layout{grid-template-columns:1fr}.patterns{grid-template-columns:1fr}.rangeRow{grid-template-columns:100px 1fr 32px}}
</style>
</head>
<body>
<header class="hero">
<div class="wrap">
<span class="badge">AI Orchestration Β· Interactive Demo</span>
<h1>Model <span class="grad">Router</span></h1>
<p>Describe a task, set your priorities and explore which model class and routing pattern may fit the workload.</p>
</div>
</header>
<main class="wrap">
<section class="layout">
<div class="panel">
<h2>Configure the workload</h2>
<div class="sub">This is an educational routing simulator, not a benchmark or vendor recommendation.</div>
<label for="task">Task description</label>
<textarea id="task" placeholder="Example: Review a large codebase, identify a bug and propose a tested fix."></textarea>
<label for="type">Primary task type</label>
<select id="type">
<option value="general">General knowledge / writing</option>
<option value="reasoning">Complex reasoning / planning</option>
<option value="coding">Coding / software engineering</option>
<option value="multimodal">Image / audio / multimodal</option>
<option value="extraction">Classification / extraction</option>
<option value="agent">Agentic workflow / tool use</option>
</select>
<div class="rangeRow"><span>Reasoning depth</span><input id="reasoning" type="range" min="1" max="5" value="3"><div class="val" id="reasoningVal">3</div></div>
<div class="rangeRow"><span>Speed priority</span><input id="speed" type="range" min="1" max="5" value="3"><div class="val" id="speedVal">3</div></div>
<div class="rangeRow"><span>Cost sensitivity</span><input id="cost" type="range" min="1" max="5" value="3"><div class="val" id="costVal">3</div></div>
<div class="checks">
<label class="check"><input id="private" type="checkbox"> Privacy / local preferred</label>
<label class="check"><input id="verify" type="checkbox"> Verification required</label>
<label class="check"><input id="longctx" type="checkbox"> Long context</label>
<label class="check"><input id="realtime" type="checkbox"> Low latency critical</label>
</div>
<button id="routeBtn">Generate routing strategy</button>
</div>
<div class="panel">
<h2>Routing recommendation</h2>
<div class="sub">Model class and orchestration pattern based on the selected signals.</div>
<div id="result"></div>
</div>
</section>
<section class="patterns">
<div class="pattern"><b>Direct Route</b><p>Send the request directly to the model class best matched to the task.</p></div>
<div class="pattern"><b>Escalation Route</b><p>Start with a cheaper model and escalate only when complexity or confidence requires it.</p></div>
<div class="pattern"><b>Verifier Route</b><p>Generate with one model and validate the result with a second model or rule-based checker.</p></div>
<div class="pattern"><b>Privacy Route</b><p>Keep sensitive workloads local or inside approved private infrastructure.</p></div>
<div class="pattern"><b>Fallback Route</b><p>Switch to an alternative model or provider when availability or quality thresholds are not met.</p></div>
<div class="pattern"><b>Specialist Route</b><p>Route coding, multimodal or domain-heavy tasks to specialized model classes.</p></div>
</section>
</main>
<footer>
<div class="wrap">
<strong>Model Router</strong> β€” an independent educational Hugging Face Space.<br>
Collaboration and partnerships: <strong>agenten@magenta.de</strong>
</div>
</footer>
<script>
const $ = id => document.getElementById(id);
["reasoning","speed","cost"].forEach(id=>{
const el=$(id), out=$(id+"Val");
el.addEventListener("input",()=>out.textContent=el.value);
});
const classes = {
fast: {
name:"Fast / Small Model",
text:"Best suited to high-volume, latency-sensitive or relatively simple tasks.",
strengths:{quality:55,speed:95,cost:95,privacy:75}
},
general: {
name:"General-Purpose Model",
text:"A balanced default for broad knowledge work, writing and mixed business tasks.",
strengths:{quality:75,speed:75,cost:65,privacy:55}
},
reasoning: {
name:"Reasoning Model",
text:"Best suited to difficult planning, multi-step analysis and tasks where deeper deliberation matters.",
strengths:{quality:96,speed:40,cost:35,privacy:45}
},
coding: {
name:"Coding Model",
text:"Specialized for software engineering, code generation, debugging and repository-oriented tasks.",
strengths:{quality:90,speed:65,cost:55,privacy:55}
},
multimodal: {
name:"Multimodal Model",
text:"Designed for tasks involving images, documents, audio, video or mixed modalities.",
strengths:{quality:88,speed:60,cost:50,privacy:45}
},
local: {
name:"Local / Private Model",
text:"Useful when data residency, infrastructure control or offline operation is a priority.",
strengths:{quality:68,speed:70,cost:78,privacy:100}
}
};
function recommendation(){
const type=$("type").value;
const r=+$("reasoning").value, s=+$("speed").value, c=+$("cost").value;
const priv=$("private").checked, verify=$("verify").checked, longctx=$("longctx").checked, realtime=$("realtime").checked;
let scores={fast:0,general:20,reasoning:0,coding:0,multimodal:0,local:0};
if(type==="general") scores.general+=45;
if(type==="reasoning") scores.reasoning+=65;
if(type==="coding") scores.coding+=70;
if(type==="multimodal") scores.multimodal+=80;
if(type==="extraction") scores.fast+=65;
if(type==="agent"){scores.reasoning+=28;scores.general+=25;scores.coding+=10}
scores.reasoning += r*11;
scores.general += r*4;
scores.fast += (6-r)*7;
scores.fast += s*10;
scores.general += s*5;
scores.reasoning += (6-s)*5;
scores.fast += c*9;
scores.local += c*4;
scores.reasoning += (6-c)*3;
if(priv){scores.local+=80;scores.general-=8;scores.reasoning-=8;scores.multimodal-=8}
if(realtime){scores.fast+=55;scores.reasoning-=18}
if(longctx){scores.general+=18;scores.reasoning+=18;scores.coding+=12}
if(verify){scores.reasoning+=15;scores.general+=6}
const sorted=Object.entries(scores).sort((a,b)=>b[1]-a[1]);
const best=sorted[0][0], second=sorted[1][0];
let route="Direct Route";
if(verify) route="Verifier Route";
else if(priv) route="Privacy Route";
else if(c>=4 && r>=4) route="Escalation Route";
else if(type==="coding"||type==="multimodal") route="Specialist Route";
else if(realtime) route="Low-Latency Route";
return {best,second,route,r,s,c,priv,verify};
}
function render(){
const rec=recommendation();
const m=classes[rec.best], alt=classes[rec.second];
const task=$("task").value.trim();
const flow = rec.verify
? `Request <span class="arrow">β†’</span> ${m.name} <span class="arrow">β†’</span> Verifier <span class="arrow">β†’</span> Output`
: rec.priv
? `Request <span class="arrow">β†’</span> Privacy Policy <span class="arrow">β†’</span> ${m.name} <span class="arrow">β†’</span> Output`
: rec.route==="Escalation Route"
? `Request <span class="arrow">β†’</span> Fast Model <span class="arrow">β†’</span> Confidence Check <span class="arrow">β†’</span> ${m.name}`
: `Request <span class="arrow">β†’</span> Router <span class="arrow">β†’</span> ${m.name} <span class="arrow">β†’</span> Output`;
$("result").innerHTML=`
<div class="resultHero">
<div class="eyebrow">${rec.route}</div>
<div class="modelClass">${m.name}</div>
<div class="explain">${m.text}</div>
<div class="scoregrid">
<div class="score"><b><span>Quality potential</span><span>${m.strengths.quality}</span></b><div class="bar"><div class="fill" style="width:${m.strengths.quality}%"></div></div></div>
<div class="score"><b><span>Speed</span><span>${m.strengths.speed}</span></b><div class="bar"><div class="fill" style="width:${m.strengths.speed}%"></div></div></div>
<div class="score"><b><span>Cost efficiency</span><span>${m.strengths.cost}</span></b><div class="bar"><div class="fill" style="width:${m.strengths.cost}%"></div></div></div>
<div class="score"><b><span>Privacy fit</span><span>${m.strengths.privacy}</span></b><div class="bar"><div class="fill" style="width:${m.strengths.privacy}%"></div></div></div>
</div>
<div class="route">
<div class="eyebrow">Suggested flow</div>
<div class="routeFlow">${flow.split(" ").map(x=>x.includes("<span")?x:`<span class="node">${x}</span>`).join(" ")}</div>
</div>
</div>
<div class="alt">
<div class="eyebrow">Alternative model class</div>
<div class="altCard"><b>${alt.name}</b><span>${alt.text}</span></div>
</div>
<div class="notes">
${task ? `<strong>Task signal:</strong> ${task.replace(/[<>]/g,"")}<br><br>` : ""}
This simulator recommends model <em>classes</em>, not specific vendors. Real production routing should be tested against current models, providers, workloads, budgets and evaluation data.
</div>`;
}
$("routeBtn").addEventListener("click",render);
render();
</script>
</body>
</html>