ai / router
A router picks the model for each task. I do not choose one per prompt.
Why route
Models differ in cost and capability, and the gap moves every few months. A fixed choice goes stale. A router holds the policy in one place, so a new model is a change to the policy and not to my habits.
My policy
A custom router in my harness sorts each task by complexity:
- An easy task, such as a rename or a one-line fix, goes to the latest Gemini Flash.
- A hard task, such as a design change across packages, goes to the latest Claude Opus.
When a provider goes down, the router moves to the closest model from another provider. I keep one router as my default and swap models in it as better ones ship.
Inside an application
The same idea applies when my program calls a model. I map a task tier to a model alias, and the alias is the only place a model name appears. See ai / api. A hosted router such as OpenRouter moves that mapping and the failover out of my code. It costs one more hop and one more vendor.