Skip to main content
Glama

llm_route

Routes AI prompts to external LLMs based on complexity analysis. Automatically assigns simple queries to budget models, moderate tasks to balanced options, and complex reasoning to premium tiers for cost optimization.

Instructions

Smart router — classifies task complexity, then routes to the optimal external LLM.

Uses a cheap classifier to assess complexity, then picks the right model tier:
- simple → budget models (Gemini Flash, GPT-4o-mini)
- moderate → balanced models (GPT-4o, Sonnet, Gemini Pro)
- complex → premium models (o3, Opus)

For routing to Claude Code's own models (haiku/sonnet) without API keys,
use llm_classify instead and follow its recommendation.

Args:
    prompt: The task or question to route.
    task_type: Optional hint — "query", "research", "generate", "analyze", "code". Auto-detected if omitted.
    complexity_override: Skip classification — force "simple", "moderate", or "complex".
    system_prompt: Optional system instructions.
    temperature: Sampling temperature (0.0-2.0).
    max_tokens: Maximum output tokens.
    context: Optional conversation context to help the model understand the broader task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYes
task_typeNo
complexity_overrideNo
system_promptNo
temperatureNo
max_tokensNo
contextNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full disclosure burden. It effectively explains the internal mechanism (cheap classifier assessment, model tier selection) and auto-detection behavior. It could improve by explicitly mentioning API key requirements or cost implications of external LLM calls.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Perfectly structured with mechanism first, sibling differentiation second, and parameter details in a dedicated Args section. No redundant text; every sentence adds value beyond the structured fields. Length is appropriate for the complexity (7 parameters, routing logic).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the existence of an output schema, the description appropriately omits return value details. It comprehensively covers the routing tiers and parameter meanings. Minor gap: lacks mention of authentication requirements or rate limits for external LLM calls, which would be relevant for an agent invoking external APIs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the Args section fully compensates by documenting all 7 parameters. It adds critical semantics: task_type examples and auto-detection note, complexity_override options, temperature range (0.0-2.0), and the purpose of context (conversation history).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses specific verbs ('classifies', 'routes') and clearly identifies the resource (external LLMs). It explicitly distinguishes itself from sibling tool 'llm_classify' by stating when to use that alternative instead ('For routing to Claude Code's own models... use llm_classify').

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit guidance on when to use the sibling tool 'llm_classify' instead (for Claude Code's own models without API keys). The tiered routing examples (simple→budget, complex→premium) provide clear context for expected usage patterns.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ypollak2/llm-router'

If you have feedback or need assistance with the MCP directory API, please join our Discord server