Skip to content

Smart Routing

Smart routing automatically selects the best provider for each request based on intent classification. Use claudex run auto to activate it.

  1. User runs claudex run auto
  2. Claude Code sends a request to the proxy
  3. The proxy extracts the user’s message and sends it to a local classifier (e.g., Ollama)
  4. The classifier returns an intent category (code, analysis, creative, search, math)
  5. The routing rules map the intent to the optimal provider profile
  6. The request is forwarded to the selected provider
[router]
enabled = true
profile = "local-qwen" # reuse a profile's base_url + api_key for classification
model = "qwen2.5:3b" # override model (optional, defaults to profile's default_model)
[router.rules]
code = "deepseek" # coding tasks → DeepSeek
analysis = "grok" # analytical tasks → Grok
creative = "chatgpt" # creative writing → ChatGPT
search = "kimi" # search/research → Kimi
math = "deepseek" # math/logic → DeepSeek
default = "grok" # fallback for unclassified
IntentDescriptionExample Tasks
codeProgramming and code generationWrite a function, fix a bug, refactor code
analysisData analysis and reasoningAnalyze logs, compare approaches, explain concepts
creativeCreative writing and ideationWrite documentation, brainstorm names, draft emails
searchInformation retrievalFind API docs, look up error codes
mathMathematical and logical tasksCalculate complexity, prove correctness
Terminal window
# Run with smart routing
claudex run auto
# Override model even with auto-routing
claudex run auto -m grok-3-mini-beta