Multi-Model Routing and Cost Control for Enterprise AI Office Platforms

    This article explains how enterprise office platforms can route tasks to different model tiers based on task characteristics, balance quality and cost, estimate per-call and monthly expenses, and implement routing logic with redaction, fallback, and downgrade handling.

    Why Office Platforms Need Multi-Model Routing

    Tasks in enterprise office environments vary widely. Summarizing meeting notes and reviewing the logic of contract clauses place very different demands on a model. In the past, many platforms offered only a few tiers, such as standard and advanced, and users had to choose one tier for everything. Simple tasks handled by high-end models waste budget, while complex tasks handled by lower-tier models can produce unreliable results.

    Dynamically selecting models by task puts compute where it is actually needed. For teams, this means two things: per-call costs are more controllable, and response speed during peak periods is more stable.

    Three Task Types, Three Model Tiers

    In practice, routing is usually divided into three tiers based on task characteristics.

    1. Complex reasoning and multimodal tasks. These include deep logical reasoning, complex data analysis, image understanding, and very long document analysis. Such tasks are suitable for very large MoE models. These models have a large total parameter count, but each inference activates only a subset of parameters, so they can be powerful while keeping per-inference computation manageable. For specific parameter specifications, context length, and vision capabilities, refer to the official model documentation rather than relying on secondary sources.

    2. Analysis, judgment, and medium-complexity tasks. These include rule validation, solution review, and code generation. Some third-party models perform consistently on specific code or reasoning chains and, when connected through a unified API gateway, can complement the primary model.

    3. High-frequency lightweight tasks. These include copy rewriting, information extraction, and content organization. Such tasks do not require deep reasoning and are suitable for lightweight or Flash models. They respond quickly and have low unit prices, making them suitable for high-concurrency daily requests.

    The table below provides selection guidance.

    Task Type Recommended Model Tier Latency Per-Call Cost Quality Boundary Fallback Strategy
    Complex reasoning, multimodal Flagship MoE Higher High More stable for long-chain reasoning Downgrade to mid tier on timeout and log the event
    Rule validation, code generation Mid tier Medium Medium Key conclusions require manual spot checks Escalate to flagship tier on failure
    Summarization, extraction, rewriting Light tier Low Low Complex logic may be missed Escalate to mid tier when results are abnormal

    How to Calculate Cost

    The basic formula for per-call cost is:

    Per-call cost = input tokens × input unit price + output tokens × output unit price

    Monthly cost = per-call cost × average daily calls × 30

    Two points require attention. First, output tokens usually have a higher unit price than input tokens, and long answers significantly increase cost. Second, if the platform supports context caching, repeated system prompts and long documents can hit the cache, and the actual cost should be recalculated based on the cache hit rate.

    Do not directly apply cost reductions published by others. Cost savings depend on task distribution, concurrency, billing strategy, and cache hit rate. A more reliable approach is to run one week of real traffic through your own logs, calculate layered statistics using the formula above, and then determine the routing ratio for each tier.

    Routing Code Example

    The code below shows the basic logic for routing by task characteristics. Compared with earlier versions, four corrections are made here: 3d_demo is assigned to the flagship tier to stay consistent with the definition of complex tasks; unknown task types fall back to the mid tier and log an alert; redaction is performed before calls; and after a timeout, retries follow the downgrade chain tier by tier. relative_cost represents the ratio relative to the flagship model unit price and should be calculated from the price table rather than estimated from experience.

    1. import logging
    2. import re
    3. import time
    4. from dataclasses import dataclass
    5. logger = logging.getLogger("model_router")
    6. PHONE_RE = re.compile(r"1[3-9]\d{9}")
    7. ID_CARD_RE = re.compile(r"\d{17}[\dXx]")
    8. FLAGSHIP, MID, LIGHT = "flagship_moe", "mid_tier", "light_flash"
    9. @dataclass(frozen=True)
    10. class ModelSpec:
    11. name: str
    12. relative_cost: float # Ratio relative to flagship model unit price, calculated from price table
    13. timeout_s: float
    14. REGISTRY = {
    15. FLAGSHIP: ModelSpec(FLAGSHIP, relative_cost=1.0, timeout_s=120),
    16. MID: ModelSpec(MID, relative_cost=0.7, timeout_s=60),
    17. LIGHT: ModelSpec(LIGHT, relative_cost=0.1, timeout_s=15),
    18. }
    19. DOWNGRADE = {FLAGSHIP: MID, MID: LIGHT, LIGHT: None}
    20. def redact(text: str) -> str:
    21. text = PHONE_RE.sub("[PHONE]", text)
    22. return ID_CARD_RE.sub("[ID]", text)
    23. def route_model(task_type: str, has_image: bool = False, token_length: int = 0) -> str:
    24. if has_image or token_length > 100_000 or task_type in {"complex_reasoning", "3d_demo"}:
    25. return FLAGSHIP
    26. if task_type in {