Smart Routing
Smart routing automatically selects the best provider for each request based on intent classification. Use claudex run auto to activate it.
How It Works
Section titled “How It Works”- User runs
claudex run auto - Claude Code sends a request to the proxy
- The proxy extracts the user’s message and sends it to a local classifier (e.g., Ollama)
- The classifier returns an intent category (code, analysis, creative, search, math)
- The routing rules map the intent to the optimal provider profile
- The request is forwarded to the selected provider
Configuration
Section titled “Configuration”[router]enabled = trueprofile = "local-qwen" # reuse a profile's base_url + api_key for classificationmodel = "qwen2.5:3b" # override model (optional, defaults to profile's default_model)
[router.rules]code = "deepseek" # coding tasks → DeepSeekanalysis = "grok" # analytical tasks → Grokcreative = "chatgpt" # creative writing → ChatGPTsearch = "kimi" # search/research → Kimimath = "deepseek" # math/logic → DeepSeekdefault = "grok" # fallback for unclassifiedIntent Categories
Section titled “Intent Categories”| Intent | Description | Example Tasks |
|---|---|---|
code | Programming and code generation | Write a function, fix a bug, refactor code |
analysis | Data analysis and reasoning | Analyze logs, compare approaches, explain concepts |
creative | Creative writing and ideation | Write documentation, brainstorm names, draft emails |
search | Information retrieval | Find API docs, look up error codes |
math | Mathematical and logical tasks | Calculate complexity, prove correctness |
# Run with smart routingclaudex run auto
# Override model even with auto-routingclaudex run auto -m grok-3-mini-beta