The default instinct when running AI workflows is to route everything to the best available model. Claude Opus for everything. GPT-4o for everything. The logic makes sense — why use a worse model?

The problem is cost at scale. If you are running 50–100 automated tasks per day, and each task costs $0.05–$0.30 in API tokens routed through a premium model, you are paying $75–$900/month for inference. Most of that spend is on tasks that did not need a premium model.

Hermes Agent’s Smart Routing solves this. This guide explains how it works and how to configure it.

Quick Answer: Smart Routing in Hermes Agent automatically classifies each task by complexity and routes it to the appropriate model tier — cheap models (Gemini Flash, Qwen 4B) for simple tasks, mid-tier models for standard work, premium models (Claude Opus, GPT-4o) only for complex reasoning. Combined with the SKILL.md reasoning cache, operators report API cost reductions of 70–90% with no quality loss on routine tasks.


Why Most AI Workflows Overspend

Before looking at Smart Routing, it helps to understand where the waste comes from.

In a typical unoptimized AI workflow, every task — regardless of complexity — goes to the same model. Classify this email as spam or not-spam: Claude Opus. Summarize this 200-word article: GPT-4o. Review and refactor this 500-line codebase: Claude Opus.

The first two tasks are not Claude Opus tasks. They are tasks that Gemini Flash handles at a fraction of the cost with equivalent output quality. But without a routing layer, there is no mechanism to distinguish them.

The three cost drivers in high-volume AI workflows:

  1. Over-provisioning: Using premium models for tasks that cheap models handle well
  2. Repetitive reasoning: Re-deriving the same logic patterns from scratch each time
  3. No caching: No mechanism to reuse expensive reasoning outputs

Smart Routing + SKILL.md together address all three.


How Smart Routing Works

Hermes evaluates each incoming task across several dimensions before selecting a model:

Task signals it reads:

  • Task length (token count of context)
  • Task type (classification, summarization, code generation, complex reasoning, creative)
  • Historical performance data for similar task types
  • SKILL.md cache check — does an existing skill file already cover this pattern?

Routing tiers:

TierModelsUse casesApproximate cost
Fast (cheap)Gemini Flash, Qwen 4B/9BClassification, short summarization, formatting, simple Q&A$0.0001–$0.001/task
StandardClaude Sonnet, GPT-4o mini, Qwen 27B/35BMulti-step reasoning, longer content, moderate complexity$0.01–$0.05/task
PremiumClaude Opus, GPT-4o, MinimaxComplex code generation, deep analysis, multi-source synthesis$0.05–$0.30/task

The routing decision is automatic. You define the tier thresholds in config; Hermes classifies and routes.


Configuring Smart Routing

In your .env file:

# Fast tier — cheap models for simple tasks
FAST_MODEL=google/gemini-flash-1.5
FAST_MODEL_ALT=qwen/qwen-2.5-7b-instruct

# Standard tier — default for most tasks
DEFAULT_MODEL=anthropic/claude-sonnet-4-5
DEFAULT_MODEL_ALT=openai/gpt-4o-mini

# Premium tier — complex reasoning only
POWER_MODEL=anthropic/claude-opus-4-5
POWER_MODEL_ALT=openai/gpt-4o

# Routing thresholds
# Tasks under this complexity score route to FAST_MODEL
FAST_THRESHOLD=0.3
# Tasks over this complexity score route to POWER_MODEL
POWER_THRESHOLD=0.75

You can also override routing for specific task types in your system prompt or via Telegram:

/set model claude-opus for code-review tasks
/set model gemini-flash for classification tasks

The SKILL.md Cost Multiplier

Smart Routing reduces cost by choosing cheaper models for routine tasks. SKILL.md files reduce cost by eliminating the need to re-reason through patterns Hermes has already solved.

Here is how the cache reduces cost:

Without SKILL.md:

  1. Task comes in: “Review this API integration code for security issues”
  2. Hermes routes to Premium model (complex code review)
  3. Model reasons through the full security review framework from scratch
  4. Cost: $0.15–$0.30 per review

With SKILL.md (after first run):

  1. Same task comes in
  2. Hermes checks skill cache — finds security-code-review.skill.md from a previous session
  3. Loads cached reasoning pattern directly, reducing LLM reasoning required
  4. Routes to Standard model with the cached framework as context
  5. Cost: $0.02–$0.05 per review

The first run costs full price. Every subsequent similar task benefits from the cache. For recurring workflows that repeat daily or weekly, the cost per task drops dramatically over time.


Real Cost Example

A developer running a content automation workflow shared this breakdown:

Before Smart Routing:

  • 80 tasks/day routed to Claude Opus
  • Average cost per task: $0.12
  • Monthly cost: ~$290/month

After Smart Routing + SKILL.md:

  • 60% of tasks routed to Fast tier (Gemini Flash): $0.002/task average
  • 30% to Standard tier (Claude Sonnet): $0.03/task average
  • 10% to Premium tier (Claude Opus): $0.15/task average
  • Average blended cost per task: $0.02
  • Monthly cost: ~$48/month

Result: 83% cost reduction with no degradation on the tasks that mattered (the 10% that actually needed premium reasoning).


Model Selection Guide for Common Agency Tasks

TaskRecommended TierRecommended ModelReason
Email classificationFastGemini FlashBinary decision, no deep reasoning needed
Short post summarizationFastQwen 9BPattern-based, high speed requirement
LinkedIn post writingStandardClaude SonnetQuality matters, moderate complexity
Cold email draftingStandardClaude SonnetNuanced tone, moderate length
Code review (basic)StandardGPT-4o miniTechnical but scoped
Complex code refactorPremiumClaude OpusMulti-file reasoning, architecture judgment
Deep competitor analysisPremiumClaude OpusSynthesis across multiple sources
TikTok script batch (10+)FastQwen 27BTemplate-driven, high volume
UGC brief generationStandardClaude SonnetCreative + structured, one-off

OpenRouter as the Routing Layer

Smart Routing works best when your AI model access is unified through a single provider that supports multiple models. OpenRouter is the standard recommendation for Hermes deployments because:

  • Single API key for 300+ models (Claude, GPT-4o, Gemini, Qwen, Llama, and more)
  • Pay-per-use pricing — no monthly commitment
  • Automatic fallbacks — if a model is down, routes to the next best option
  • Free tier includes access to several capable models for testing

The Hermes config for OpenRouter:

OPENROUTER_API_KEY=your_key_here
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1

# Then reference models as openrouter-style paths
FAST_MODEL=google/gemini-flash-1.5
DEFAULT_MODEL=anthropic/claude-sonnet-4-5
POWER_MODEL=anthropic/claude-opus-4-5

See the OpenRouter tool page for a breakdown of all available models, pricing tiers, and rate limits.


Monitoring Your Routing Performance

Hermes tracks per-model cost and task distribution. Check your usage breakdown:

/stats costs

Output example:

Last 7 days:
  Fast tier (Gemini Flash):    240 tasks — $0.48
  Standard tier (Claude Sonnet): 96 tasks — $3.12
  Premium tier (Claude Opus):  24 tasks — $4.80
  Total: 360 tasks — $8.40
  Average cost per task: $0.023

Review weekly. If Premium tier usage is climbing past 15–20% of tasks, investigate which workflow types are triggering premium routing — many can be reclassified to Standard with a prompt adjustment.


FAQ

Does Smart Routing reduce output quality?

For tasks correctly classified to the Fast tier — simple classification, short summaries, formatting tasks — output quality from Gemini Flash or Qwen is equivalent to premium models. Quality loss only occurs if a complex task is misrouted to a cheap model. The SKILL.md cache helps mitigate this by giving cheap models access to cached reasoning frameworks from previous premium-model runs.

How does Hermes decide which tier to use?

Hermes scores each task using a complexity heuristic based on context length, task type patterns, and historical performance on similar tasks. You can override routing manually or set explicit rules for task categories.

Can I disable Smart Routing and use one model for everything?

Yes. Set DEFAULT_MODEL only and remove FAST_MODEL and POWER_MODEL from config. Hermes routes all tasks to the default model.

What happens if my preferred model is unavailable?

If using OpenRouter, Hermes falls back to the next available model in the same tier automatically. You can configure explicit fallback chains in the OpenRouter dashboard.

Is Smart Routing available on the free tier of Hermes?

Yes. Smart Routing is a core Hermes feature, not a paid add-on. The cost savings come from your model provider’s pricing — you pay OpenRouter or Anthropic directly, and Hermes’s routing logic runs locally.

How quickly does the SKILL.md cache start saving money?

After the first run of any repeated workflow type, future runs benefit from the cache. For workflows you run daily, the payoff starts in the first week.