Skip to main content

Auto-Routing

Automatic model selection based on task complexity.

How It Works

When you set model: "auto", the system analyzes your prompt and selects the optimal model based on:

  1. Task Type - Code, analysis, creative, chat
  2. Complexity - Simple vs complex reasoning
  3. Cost Efficiency - Best value for the task
  4. Response Quality - Match quality to requirements

Usage

{
"query": "What is 2 + 2?",
"model": "auto"
}

Response

The response includes routing information:

{
"success": true,
"response": "4",
"model": "gpt-4o-mini",
"provider": "openai",
"routing": {
"is_auto_routed": true,
"model_chosen": "openai.gpt-4o-mini",
"confidence": 0.92,
"reason": "simple_query"
}
}

Routing Logic

Task TypeSimpleComplex
Codegpt-4.1-minigrok-4-1-fast-reasoning
Analysisclaude-3-haikuclaude-opus-4-5
Creativegpt-4.1claude-sonnet-4-5
Chatgpt-4o-minigpt-4.1

Task Recommendations

Get model recommendations for a specific task:

curl https://llm.zihin.ai/api/llm/recommendations/code_generation

Response:

{
"success": true,
"task": "code_generation",
"recommendations": [
{
"id": "grok.grok-4-1-fast-reasoning",
"name": "Grok 4.1 Fast Reasoning",
"provider": "grok",
"tier": "flagship"
},
{
"id": "openai.gpt-4.1",
"name": "GPT-4.1",
"provider": "openai",
"tier": "standard"
}
]
}

Task Types

TaskDescription
code_generationWriting code
summarizationCondensing text
translationLanguage translation
analysisData/text analysis
creativeCreative writing
chatConversational

Confidence Scores

The routing confidence indicates how certain the system is:

ScoreMeaning
0.9+High confidence
0.7-0.9Good match
0.5-0.7Acceptable
< 0.5Consider specifying model

Override Auto-Routing

To bypass auto-routing, specify a model directly:

{
"query": "Complex task here",
"model": "claude-opus-4-5-20250514",
"provider": "anthropic"
}