CortexcnCortexcn
Pro

Model Router

App prompts converging on a router that picks a model for each one, then fanning out to a card of models, each with what it is picked for, its prompts, its share of traffic, and its average response time, counting up as pulses arrive.

App prompts through Router to Traffic by modelBrisk 3, Short answers: 18,420 prompts, 67 percent, 340 milliseconds on average. Sage 2, Reasoning: 6,910 prompts, 25 percent, 1,840 milliseconds on average. Prism, Images and files: 2,270 prompts, 8 percent, 920 milliseconds on average.App prompts27,600 prompts todayRouterPicks a model for every prompt{ } Routing rulesTraffic by modelLivePromptsAvgBrisk 3Short answers18,420340 ms67%Sage 2Reasoning6,9101,840 ms25%PrismImages and files2,270920 ms8%Hard prompts get the reasoning model.Illustrative numbers

Installation

ProPart of Cortexcn Pro

The source for model-router comes with a Cortexcn Pro license, along with every other chart and the website templates. Pick a license on the pricing page.

Already have a license? Open the code

Usage

import { ModelRouter } from "@/components/model-router";
<ModelRouter
  title="Traffic by model"
  models={[
    { name: "Brisk 3", role: "Short answers", prompts: 18420, latencyMs: 340 },
    { name: "Sage 2", role: "Reasoning", prompts: 6910, latencyMs: 1840 },
    { name: "Prism", role: "Images and files", prompts: 2270, latencyMs: 920 },
  ]}
/>

Each model gets a row: its name, what the router picks it for, the prompts sent to it, and its average response time, with a bar showing its share of all prompts. Use it on the page for an AI product that routes between models, or to explain cost and speed tradeoffs in a model gateway.

Examples

Support routing

Four models for a support desk, with the source relabeled.

Support chats through Router to Support routingBrisk 3, Order status: 9,240 prompts, 60 percent, 310 milliseconds on average. Sage 2, Refund disputes: 1,180 prompts, 8 percent, 2,120 milliseconds on average. Prism, Photos of damage: 640 prompts, 4 percent, 980 milliseconds on average. Brisk 3 Mini, Greetings: 4,410 prompts, 29 percent, 180 milliseconds on average.Support chats15,470 prompts todayRouterPicks a model for every prompt{ } Routing rulesSupport routingLivePromptsAvgBrisk 3Order status9,240310 ms60%Sage 2Refund disputes1,1802,120 ms8%PrismPhotos of damage640980 ms4%Brisk 3 MiniGreetings4,410180 ms29%Disputes go to the careful model.Illustrative numbers

Static

With animated={false}, nothing moves and the numbers stay as given.

App prompts through Router to Traffic by modelBrisk 3, Short answers: 18,420 prompts, 67 percent, 340 milliseconds on average. Sage 2, Reasoning: 6,910 prompts, 25 percent, 1,840 milliseconds on average. Prism, Images and files: 2,270 prompts, 8 percent, 920 milliseconds on average.App prompts27,600 prompts todayRouterPicks a model for every prompt{ } Routing rulesTraffic by modelLivePromptsAvgBrisk 3Short answers18,420340 ms67%Sage 2Reasoning6,9101,840 ms25%PrismImages and files2,270920 ms8%Hard prompts get the reasoning model.Illustrative numbers

Behavior

  • While the flow is on screen, pulses run from the left into the router, then on to each model. The prompt counts count up from zero, then each model adds its perPulse every time a pulse reaches it, and the shares follow the new counts.
  • The count under the source label goes up as pulses reach the router.
  • With reduced motion enabled, or off screen, nothing moves and every number shows its given value.
  • The whole flow is one SVG that scales to its container. It lays out at minWidth or wider (560px by default); in a narrower container it scrolls sideways and takes keyboard focus.
  • Screen readers hear one summary: each model, what it is for, its prompts, its share, and its average response time.
  • The model names are made up, and the caption in the corner says the numbers are illustrative. Use your own models and numbers.

Props

ModelRouter

PropTypeDefaultDescription
modelsModelRouterModel[]Three sample modelsThe models the router picks between
titlestring"Traffic by model"The card's title
routerNamestring"Router"The name in the middle node
routerCaptionstring"Picks a model for every prompt"A line under the middle node
sourceLabelstring"App prompts"The label over the incoming lines
promptsLabelstring"prompts today"The words after the count under the source label
apiLabelstring"Routing rules"The label on the lines into the card
notestring"Hard prompts get the reasoning model."A note at the foot of the card
captionstring"Illustrative numbers"A small label in the bottom-left corner
localestring"en-US"The locale numbers are written in
linesnumber22How many lines of traffic come in from the left
segmentsnumber24How many segments each share bar has
accentstring"var(--foreground)"Color of the pulses, markers, and share segments
animatedbooleantrueRun the pulses and count up while on screen
minWidthnumber560Narrowest layout width in pixels; below it, scroll
ariaLabelstring"Model router"Names the flow for screen readers
classNamestring-Extra classes on the frame

ModelRouterModel

PropTypeDefaultDescription
namestring-The model's name
rolestring-What it is picked for, such as "Reasoning"
promptsnumber-Prompts routed to it so far
latencyMsnumber-Its average response time, in milliseconds
perPulsenumber2Prompts added each time a pulse reaches it while live