Smart routing

Route requests with auto:* model aliases

Set model to an auto:* alias. LineMod uses your organization's routing policy and budget to select a model, with fallbacks available if needed.
Flow

How LineMod selects a model

Requestauto routing
{
"model": "auto:balanced",
"messages": [
  { "role": "user", "content": "Summarize this incident log." }
]
}
req_8f3k2m9x1pCompleted
Policyorg_default_balancedNo custom routing rule matched.
Selectedclaude-sonnetSelected for the quality target and request budget.
Fallbackgpt-4o-mini → deepseek-v3Fallback models available; none were needed.
TraceindexedRouting reason, estimated cost, and fallback status recorded in the request trace.
01Analyze
Classify task type, complexity, and tool needs from messages.
02Filter
Filter models by allowlist, region, budget, provider cooldown, and relay requirements.
03Rules
Match org custom rules from Console routing.
04Execute
Call the selected provider and apply fallback, schema validation, and tier policies.
Aliases

Auto model presets

Choose an auto:* alias for the routing behavior you need. Use Console routing to preview outcomes before production.
AliasUse whenBehavior
auto:balancedDefault production trafficBalances cost and quality. Supports the X-LineMod-Cost-Quality request header.
auto:costBatch jobs, classification, dev/stagingPrefers lower unit cost within policy limits.
auto:qualityCustomer-facing answers, complex reasoningPrefers stronger models when budget allows.
auto:speedInteractive chat, latency-sensitive UXPrefers faster models and shorter fallback paths.
auto:codeDeveloper and codegen workloadsRoutes to models scored higher for coding tasks.
auto:china / auto:overseasRegion-pinned workloadsRestrict candidates to China or overseas catalog rows.
Console

Routing control surfaces

Org defaultsSet the baseline template per API key or team.
Balanced, cost-first, quality-first, speed, or code-oriented behavior.
Custom rulesOverride when conditions match.
Task type, workload tags, complexity, customer tier, or message patterns.
Failover chainPrepare backup models before failure.
If the selected model fails, LineMod tries configured fallback models, subject to schema validation and provider cooldowns.
SimulationPreview route outcome before saving.
See selected model, reason, cost estimate, and excluded candidates.
Cost-quality dial

Send X-LineMod-Cost-Quality: 0–10 on supported templates to prefer lower cost (0) or higher quality (10) for a single request. Configure defaults in Console → Routing.

Headers

Routing-related request headers

SessionX-LineMod-Session-Id
BudgetX-LineMod-Budget-Max
FallbackX-LineMod-Fallback
RegionX-LineMod-Region
DialX-LineMod-Cost-Quality
Fail fastX-LineMod-No-Failover