Skip to main content
Glama

llm_route

Classifies task complexity and routes to the optimal LLM. Uses a cheap classifier to select from budget, balanced, or premium models based on difficulty.

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 burden. It discloses the internal classification tiers and routing logic, plus auto-detection of task_type. However, it does not mention authentication, rate limits, or failure behavior. Output schema exists but is not described, which is acceptable.

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?

The description is front-loaded with the core purpose, then splits into classification tiers and args. It is concise with a clear bullet list, no unnecessary words, and earns its place.

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 7 parameters and complexity, the description covers the main functionality, distinguishes from siblings, and provides an output schema. It could mention error handling or limitations, but overall it is reasonably complete.

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

Parameters4/5

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

Schema coverage is 0%, but the description adds meaning for all parameters, including temperature range and complexity_override options. It could be more detailed about allowed values for task_type and context usage, but it significantly compensates for the lack of schema descriptions.

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 clearly states the tool is a 'smart router' that classifies task complexity and routes to the optimal external LLM. It specifies the verb 'routes' and the resource 'external LLM', and distinguishes itself from siblings like 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?

Explicit usage guidelines are provided: it tells when to use this tool (for routing to external LLMs) and when not to (for Claude's own models, use llm_classify). It names an alternative tool, which is explicit guidance.

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