Smart routing
Use auto models instead of hard-coded provider names.
LineMod is a security gateway with agent behavior observability—guardrails at the edge, harness diagnostics across runs, and policy routing when you need it. This page explains policy routing with auto model aliases. Set
model to an auto:* alias and let org policy, budgets, and failover chains pick the upstream path.Flow
How a routed request resolves
Requestauto routing
{
"model": "auto:balanced",
"messages": [
{ "role": "user", "content": "Summarize this incident log." }
]
}req_8f3k2m9x1pCompleted
Policyorg_default_balancedNo custom rule matched.
Selectedclaude-sonnetQuality target inside budget cap.
Fallbackgpt-4o-mini → deepseek-v3Ready, not used.
TraceindexedReason, cost, and fallback state saved.
01Analyze
Classify task type, complexity, and tool needs from messages.
02Filter
Apply whitelist, region, budget, cooldown, and relay constraints.
03Rules
Match org custom rules from Console routing.
04Execute
Invoke upstream with failover, schema checks, and tier policies.
Aliases
Auto model presets
These templates are registered in the gateway. Use Console routing to preview outcomes before production.
| Alias | Use when | Behavior |
|---|---|---|
auto:balanced | Default production traffic | Blends cost and quality; supports the cost-quality dial header. |
auto:cost | Batch jobs, classification, dev/staging | Prefers lower unit cost within policy limits. |
auto:quality | Customer-facing answers, complex reasoning | Prefers stronger models when budget allows. |
auto:speed | Interactive chat, latency-sensitive UX | Prefers faster models and shorter fallback paths. |
auto:code | Developer and codegen workloads | Routes to models scored higher for coding tasks. |
auto:china / auto:overseas | Region-pinned workloads | Restrict 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.
Executor retries with schema validation and cooldown awareness.
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 bias toward cost (0) or 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