Task Routing
Automatic intelligent model selection based on prompt complexity. Route simple tasks to cheap models and complex tasks to capable ones.
Task Routing
Task routing automatically classifies your prompts and routes them to the cheapest model capable of handling the task. Simple questions go to fast, cheap models; complex reasoning goes to frontier models.
How it works
- Classification - A lightweight classifier model analyzes the user's prompt to determine its complexity class
- Model selection - Cynos picks the cheapest model from a ranked pool that matches the complexity class
- Budget-aware - If you specify a model, routing only moves you to a cheaper alternative. You're never upsold
- Fallback chain - Your original model becomes the first fallback if the routed model fails
Enabling task routing
Per-request via header
Use the x-cy-eh-task-route header:
curl https://api.cynos.averlon.ai/v1/chat/completions \
-H "Authorization: Bearer sk-cy-your-api-key" \
-H "Content-Type: application/json" \
-H "x-cy-eh-task-route: on" \
-d '{
"messages": [
{"role": "user", "content": "What is 2+2?"}
]
}'Without specifying a model
When you omit the model field entirely, the task router owns the choice and picks from the ranked pool outright:
curl https://api.cynos.averlon.ai/v1/chat/completions \
-H "Authorization: Bearer sk-cy-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "Summarize this document in three bullet points"}
]
}'Skipping task routing
Force task routing off for a specific request:
curl https://api.cynos.averlon.ai/v1/chat/completions \
-H "Authorization: Bearer sk-cy-your-api-key" \
-H "Content-Type: application/json" \
-H "x-cy-eh-task-route: off" \
-d '{
"model": "openai/gpt-4o",
"messages": [
{"role": "user", "content": "Complex analysis here..."}
]
}'Routing behavior
| Scenario | What happens |
|---|---|
| No model specified, routing on | Router picks the cheapest ranked model for the task class |
| Model specified, routing on | Router only moves to a cheaper model; your model becomes first fallback |
| Model specified, routing off | Your model is used directly |
| Router can't classify | Falls back to the configured default route or your specified model |
Response metadata
Routed requests include routing information in the response's extra_fields:
{
"extra_fields": {
"task_route": {
"outcome": "routed",
"task_class": "simple_qa",
"original_model": "openai/gpt-4o",
"routed_model": "openai/gpt-4o-mini"
}
}
}Possible outcomes:
routed- Request was redirected to a cheaper modelcaller_route- Caller's model was kept (nothing cheaper available)default_route- Configured default model was usedskipped- Routing did not run
Cost savings
Task routing is most effective when your traffic is a mix of simple and complex requests. Typical savings:
- Simple Q&A, translations, formatting → routed to small/fast models (90%+ cost reduction)
- Code generation, analysis, reasoning → kept on frontier models
- Ambiguous tasks → classified conservatively, erring toward capability
Updated about 2 months ago