Skip to content

Routing logic

pokkit's TriageEngine selects an upstream provider for every request based on the model string. There is no configuration required — the right provider is picked automatically.

Rules (in priority order)

1. Anthropic

Routed when:

  • Model starts with claude- (e.g. claude-sonnet-4-6, claude-opus-4-7)
  • Model is exactly auto-frontier (resolved to claude-sonnet-4-6)

Why: Claude models are only available on Anthropic's API, which uses a different request format (Messages API). pokkit handles the translation automatically.

2. Together AI

Routed when:

  • Model contains Qwen (case-sensitive, e.g. Qwen/Qwen3.5-397B-A17B)
  • Model contains DeepSeek (case-sensitive, e.g. deepseek-ai/DeepSeek-V3.1)
  • Model starts with together/ (explicit prefix to force Together routing for any model they serve)

Why: Together AI's serverless endpoints offer the best price/performance ratio for popular open-weights models. Routing Qwen and DeepSeek models there directly avoids the OpenRouter markup on these high-traffic models.

3. OpenRouter (default)

Any model string that doesn't match the rules above is forwarded to OpenRouter.

Why: OpenRouter aggregates hundreds of models from dozens of providers behind a single OpenAI-compatible API. It's the right catch-all when you want access to a specific model that pokkit doesn't special-case — including Google Gemini, Meta Llama, Mistral, and many others.

Cost optimization

The routing hierarchy is designed around cost:

Provider Relative cost Best for
Anthropic Higher Frontier quality, complex reasoning, long context
Together AI Lower Open-weights at scale, coding, structured output
OpenRouter Variable Access to any model; flexibility over cost optimization

By explicitly routing common open-weights models to Together AI, you avoid the pass-through markup that OpenRouter adds on the same models.

Source code

The routing logic lives in src/router.ts.