Skip to main content
  1. Blog/

Getting LiteLLM's Model Routing Set Up Properly

·2 mins
Author
Chengyu
I’m Chengyu — a final-year Computer Science student at the University of Sydney. I write about the things I build and break, plus hiking, travel, gaming, and gadgets.
Table of Contents

Spent some time today thoroughly reworking the LiteLLM gateway’s model routing strategy — writing down the full thinking and the final config here.

Why model routing is needed
#

My AI infrastructure looks like this:

Telegram → Hermes → LiteLLM gateway → various models

LiteLLM acts as a unified gateway, exposing a single OpenAI-compatible interface on top of a dozen-plus backend models. Hermes only needs to know one address, ai.XXX.com — it doesn’t need to care which model is actually running underneath. The benefit: models can be swapped, upgraded, or switched at any time, completely transparent to Hermes.

The model pool
#

The final configuration:

Paid models (pay-as-you-go, very low cost)

  • DeepSeek V3 — strongest for Chinese, $0.27/million input tokens, extremely cost-effective
  • Gemini 3 Flash — Google’s latest fast model, multimodal, generous free quota
  • Gemini 3.1 Pro — strong reasoning, used as a Pro-tier backup during rate limits

Free NVIDIA NIM models

  • meta/llama-3.3-70b-instruct — general-purpose English workhorse
  • minimaxai/minimax-m2.5 — strong Chinese ability
  • moonshotai/kimi-k2.5 — strong reasoning
  • z-ai/glm5 — Chinese backup (later swapped for the OpenRouter version due to timeouts)

OpenRouter free model pool (final safety net)

  • minimax/minimax-m2.5:free
  • z-ai/glm-4.5-air:free
  • meta-llama/llama-3.3-70b-instruct:free
  • nvidia/nemotron-3-super-120b-a12b:free

On-demand paid top-tier model

  • Claude Sonnet 4.6 — accessed through OpenRouter, $3/$15 per million tokens, top-tier reasoning backup

The final fallback chain
#

Whenever any model fails, there’s a complete degradation chain in place, with a final round-robin pool of four free models as the ultimate safety net.

Related

Migrating Hermes to My Synology NAS

·3 mins
After getting Hermes running on a VPS, I moved it to my Synology NAS instead so it could gradually gain access to household journal and investment data as an internal AI hub — and redesigned the model routing along the way.