Multi-Model AI Office Agents: Model Routing and Quota Metering in Practice

    This article explains how to run AI office agents on multiple models without losing control of cost or quality. It covers a layered architecture that separates interaction, orchestration, routing, model access, and quota metering, together with declarative model profiles that describe each model's capabilities and quota multiplier. It then walks through rule-based, cost-aware, and cascading routing with fallback chains, timeout budgets, and caching; a quota formula that converts tokens, tool calls, and retrieval into quota points; and the reliability requirements of a quota ledger, including idempotency, reserve/confirm/release accounting, reconciliation, and task-level budgets. It also covers free tiers for simple tasks, off-peak pricing and scheduling, an observability framework for quality, latency, cost, and stability, and quality gates backed by offline evaluation. A suggested rollout order closes the article: build metering and evaluation first, then add more models.

    1. Background: From “one model is enough” to a multi-model division of labor

    Early AI office agents were usually built on a single in-house model. That choice kept interfaces stable, billing simple, and evaluation costs manageable. But as these products evolved from “chat assistants” into “agents for productivity work” — agents that receive a user’s goal, break it into tasks, call tools, iterate on the output, and deliver results the user can accept — the limits of a single model became clear.

    Office tasks vary too widely for one model to handle well:

    • Complexity varies widely. Rewriting a paragraph or extracting table fields is shallow work. Comparing contracts across documents, writing a structured long-form report, or running multi-turn code and data processing demands stronger reasoning and longer context.
    • Sensitivity is tiered. Organizing redacted public material can go to a low-cost model. Formal documents tied to internal standards often require stricter output consistency and format compliance.
    • Latency needs differ. Interactive completion calls for a fast first-token response. Offline batch jobs care more about cost per unit of work.
    • The cost-effectiveness sweet spot exists — and it moves. Quality per token of cost differs across models for the same task, and it shifts as the task type changes.

    The core idea in a mature design is to turn “which model should we use” from a product decision into an engineering problem that is configurable, measurable, and continuously optimized.

    Recent product updates illustrate the idea. A company now offers several third-party models alongside its in-house lightweight and flagship models. The model picker shows each option’s quota consumption multiplier, and the platform runs limited-time promotional windows with discounted rates.

    These features hand both the responsibility for cost control and the choice of model back to the user. In return, engineering has to provide enough routing capability, metering precision, and observability to support a product with this many options.

    2. Overall architecture: four layers of decoupling

    1. ┌────────────────────────────────────────────────────────┐
    2. │ Interaction: goal input / model picker / quota & multiplier display │
    3. ├────────────────────────────────────────────────────────┤
    4. │ Orchestration: task decomposition, tool calls, multi-turn iteration, acceptance checks │
    5. ├────────────────────────────────────────────────────────┤
    6. │ Routing: capability scoring + cost awareness + constraint filtering + fallback chain │
    7. ├────────────────────────────────────────────────────────┤
    8. │ Access: protocol normalization, adapters, rate limiting & retries, streaming passthrough │
    9. ├────────────────────────────────────────────────────────┤
    10. │ Metering: usage collection, quota conversion, multiplier & time-window factors, billing │
    11. └────────────────────────────────────────────────────────┘

    The interaction layer sits on top of four decoupled layers: orchestration, routing, access, and metering.

    • The access layer hides differences between model APIs. These differences include authentication, message formats, streaming protocols, and the names of capability parameters. As a result, adding a model means writing one adapter and one capability profile, not changing business code.
    • The metering layer is a layer of its own. This keeps “a call happened” separate from “how it gets charged,” so billing policy can change without touching the inference path.

    3. Unified access layer and model profiles

    The access layer should be designed around four principles:

    1. Protocol normalization. All calls go through one internal request/response abstraction. It maps message roles, tool definitions, structured outputs, and multimodal inputs onto each backend’s actual fields. Capabilities that cannot be mapped are declared “unsupported” up front, so upper layers filter on them rather than failing silently at runtime.
    2. Model profiles. Each model has a declarative configuration, a “model profile,” that routing and the frontend both consume.

      1. model_profiles:
      2. - id: light-fast
      3. tier: L1 # lightweight tier
      4. capabilities: [chat, summarize, extract, tool_call]
      5. context_window: 128k
      6. profile: {latency: low, quality: medium}
      7. quota_multiplier: 0.6 # quota consumption multiplier; lower is cheaper
      8. - id: pro-reasoning
      9. tier: L3 # flagship tier
      10. capabilities: [chat, long_context, complex_reasoning, tool_call, structured_output]
      11. context_window: 256k
      12. profile: {latency: medium, quality: high}
      13. quota_multiplier: 1.8
    3. A single governance point. Rate limiting and retries live in the access layer and work the same way for every backend:

      • exponential backoff with jitter
      • circuit breaking
      • request coalescing

      Business code then only sees three outcomes: success, failure, or fallback. Streaming calls also need to handle backpressure and resume after interruptions, so a long document generation is not thrown away because of a single timeout.

    4. Per-backend credential and quota isolation. Each backend gets its own credentials and its own limits. That way, instability at one backend cannot trigger a system-wide cascade.

    4. Routing strategy: from static switches to cost awareness

    If supporting multiple models stops at “the user picks one from a dropdown,” the added product complexity buys very little. The real gains come from default routing: the user states a goal, and the system decides which model to use, whether several models should collaborate, and how to fall back when a call fails.

    4.1 Three levels of routing

    • L0 — rule-based routing. An intent classifier maps task types (extraction, summarization, writing, code, long-document reasoning) directly to model tiers. This level is cheap and easy to explain.
    • L1 — cost-aware routing. Within the candidate set, the router picks the best option by a utility score:

      expected quality × probability of completion − λ × estimated cost − μ × estimated latency

      λ and μ are tunable business parameters for cost sensitivity and latency sensitivity.

    • L2 — cascading routing. The router first tries a lightweight model and runs quality checks (format compliance, field completeness, assertions, confidence thresholds). If the output fails, it escalates to a stronger model. Cascading is the most effective way to control cost, because lightweight models already handle most tasks.

      1. def route(task: Task, ctx: Context) -> RouteDecision:
      2. candidates = [p for p in PROFILES
      3. if task.required_caps <= p.capabilities
      4. and task.tokens <= p.context_window
      5. and p.quota_multiplier <= ctx.budget_multiplier]
      6. if not candidates:
      7. raise NoFeasibleModel("Constraints too tight; raise the budget or shrink the context")
      8. # Cascading: try the lightest tier first, escalate automatically on failure
      9. for p in sorted(candidates, key=lambda x: (x.tier, x.quota_multiplier)):
      10. out = invoke(p.id, task, ctx)
      11. if quality_check(out, task.acceptance):
      12. return RouteDecision(model=p.id, result=out, escalated=False)
      13. record_failure(p.id, task.type) # feed back into routing weights
      14. ctx.model_stats[p.id].fail_rate += 1
      15. raise QualityUnsatisfied("No candidate model passed acceptance checks")

    4.2 Fallback chains and timeout budgets

    For each task type, define a fallback chain: flagship → mid-tier → lightweight → partial results with gaps clearly marked. Allocate a timeout budget to each subtask.

    In agent workflows, partial delivery is often the more practical choice. The system returns the sections that are already done and turns the rest into asynchronous jobs. The user then never faces a single all-or-nothing failure.

    4.3 Caching and reuse

    • Exact-match cache. The key is a fingerprint of the normalized request. A hit returns the stored response directly.
    • Semantic cache. Store results for frequent near-duplicate requests, such as “make this passage sound more formal,” in a vector index so they can be reused. Set a similarity threshold and an invalidation policy. Otherwise, small differences in meaning can lead to the wrong cached result being served.
    • Intermediate artifact reuse. Persist intermediate conclusions from task decomposition (object storage plus a metadata table). Retries and resumed runs then avoid spending quota on work that is already done.

    5. Quota metering: how the multipliers are derived

    With several models in play, the same task consumes different amounts of quota depending on which model runs it. If the accounting is opaque, users assume the platform is quietly raising prices. Metering therefore has to be explainable, reproducible, and reconcilable.

    5.1 From tokens to quota

    Use one shared metering formula:

    1. quota_used = ceil((input_tokens * input_factor + output_tokens * output_factor
    2. + tool_calls * tool_factor + retrieval_tokens * retrieval_factor)
    3. * model_multiplier * time_window_factor)
    • Input and output are priced separately. For most models, output is significantly more expensive than input. Combining the two distorts the cost.
    • The multiplier is a relative factor per model. It is set against a baseline model priced at 1.0: lightweight models fall below 1, and flagship models above 1. For users, “multiplier 0.6” is an intuitive cost signal. For the platform, it allows underlying prices to change without changing what the frontend means.
    • Factors and multipliers must be externalized configuration. They need hot updates and version tracking, and each bill must record the configuration version it used. Without that, charges cannot be reconciled after the fact.
    • Rounding must be consistent. Quantities are always rounded up to whole quota points. This avoids floating-point errors that lead to complaints.
    • Retries and multimodal inputs must be explicit about billing. State the policy clearly. The usual convention is that automatic internal retries are not charged again, while a run the user explicitly requests is charged.

      1. def charge(model_id, usage, ts) -> int:
      2. p = PROFILES[model_id]
      3. base = (usage.in_tokens * p.price_in
      4. + usage.out_tokens * p.price_out
      5. + usage.tool_calls * TOOL_COST
      6. + usage.retrieval_tokens * RETRIEVAL_COST)
      7. multiplier = p.quota_multiplier
      8. off_peak = OFF_PEAK_WINDOWS.contains(ts) and model_id in PROMO_MODELS
      9. if off_peak:
      10. multiplier *= PROMO_RATE # off-peak promotional factor
      11. return math.ceil(base * multiplier)

    5.2 Reliability requirements for the quota ledger

    A metering system handles money, so it needs four guarantees:

    1. Idempotency. Use request_id as the idempotency key, so duplicate callbacks never deduct quota twice.
    2. Two-phase settlement. The flow is reserve (freeze quota) → confirm (final deduction) → release (return any unused balance). Long-running tasks then never fail partway through because quota ran out mid-run.
    3. Reconcilability. Log full usage details (who, when, which model, how many tokens, which multiplier, how much quota was deducted) to a logging service. These records should support aggregation by user, task, model, and time window. Compare them against external request counts and alert on discrepancies.
    4. Real-time balance checks. The orchestration layer enforces per-task budget caps (“this task may consume at most N quota points”). When a cap is exceeded, the task falls back to a cheaper path or stops, so users don’t discover mid-run that their quota is exhausted.

    5.3 Free tiers for simple tasks and promotional time windows

    “Simple tasks are free” is, in engineering terms, a tiered quota. Requests from lightweight-tier models, short contexts, and low-frequency users go into a free pool. Once they exceed the threshold, they are billed at the model’s multiplier. Implementation starts with a free-tier check that runs before billing and evaluates four criteria: input length, complexity, usage frequency, and cache hit. A request that qualifies skips the deduction and is only counted in usage statistics and risk checks.

    Limited-time promotional windows are essentially an off-peak scheduling problem. Discounts during quiet hours improve overall resource utilization and shift non-urgent work away from peak periods. The technical pieces are:

    • Configurable time-window tables, defined separately for weekdays and holidays and handled with time zones.
    • A queue for batch jobs, such as bulk document conversion, offline summarization, and recurring reports. Jobs enter a message queue, and the scheduler consumes them from the promotional windows first.
    • Live time-window checks for interactive requests. The current factor is evaluated in real time, and the UI shows a “promotional pricing is currently active” notice.
    • A clear countdown before each window ends, so users aren’t caught off guard when the discount expires.

    6. Observability and cost attribution

    Multiple models mean performance and costs fluctuate across many dimensions. You need one unified observability stack:

    Category Key metrics
    Quality Task completion rate, first-pass acceptance rate, cascade escalation rate, manual rework rate
    Performance Time to first token (TTFT), end-to-end latency P50/P95/P99, tool call duration
    Cost Quota consumed per task, cost per 1K tokens, cache hit rate, free pool share
    Stability Error rate per model, rate-limit hits, circuit breaker and fallback activations
    Business Model usage distribution, manual override rate, quota consumption trends, promotional window utilization

    For implementation:

    • Run the inference gateway on a container platform so it can scale elastically.
    • Instrument the full call path and ship the data to logging services and monitoring/alerting.
    • Expose metrics to dashboards and set threshold alerts. For example, when one model’s error rate spikes, the system can automatically lower its routing weight.

    Manual override rate is easy to overlook but very informative. It shows directly where default routing diverges from user expectations, which makes it the best signal for improving the routing policy.

    7. Quality assurance: multiple models without losing control of quality

    Adding backends shifts output style and capability boundaries, so you need a regression process:

    1. Offline evaluation sets. Build sample sets with reference answers or acceptance scripts for each task type. Cover all five: extraction, writing, reasoning, long context, and tool calling.
    2. Release gates. Every model onboarding, multiplier change, and routing parameter change must pass an evaluation-set regression. If any metric degrades beyond its threshold, the release is blocked. Use canary releases and shadow traffic.
    3. Online human spot checks. Sample high-value tasks for human rating, and cross-check the results against automated metrics.
    4. Pinned versions. In scenarios sensitive to stability, allow a fixed model version so a backend upgrade cannot cause sudden changes in output.
    5. Data compliance. Document each backend’s data retention and training-use policies. Before routing, filter on data sensitivity: requests that involve restricted data can only go to candidates that meet compliance requirements, with redaction applied first if necessary.

    8. Rollout checklist

    To build similar capabilities from scratch, follow this order:

    1. Define the internal request/response abstraction and the model profile schema.
    2. Connect two baseline models (one lightweight, one strong), and get streaming and tool calls working.
    3. Build the metering layer (idempotency, reserve/confirm, a detailed usage ledger) and quota display.
    4. Add rule-based routing, cascade validation, and fallback chains.
    5. Build the evaluation sets and regression gates, then onboard the remaining models.
    6. Launch the observability dashboards and cost attribution.
    7. Last, add operational features such as time-window discounts and off-peak scheduling.

    The order matters: make metering and evaluation solid first, then scale up the number of models. Otherwise, every model you add makes costs harder to control and quality harder to explain. Multiple models then become a liability rather than an asset.

    9. Conclusion

    Running multiple models comes down to three engineering capabilities:

    • A unified access abstraction makes switching models cheap.
    • Cost-aware routing and cascading make choosing a model smart.
    • Transparent, reproducible quota metering makes charging for models trustworthy.

    When all three are in place, a team can treat models as a pool of interchangeable, re-pricable resources. It can then tune the mix as task distribution and cost structure change, instead of being locked into the limits of any single model.

    In a public cloud deployment, the supporting infrastructure can be assembled from managed services:

    • a container platform to host the inference gateway
    • a message queue to smooth out asynchronous workloads
    • object storage for deliverables
    • logging and monitoring/alerting services for cost attribution and stability

    This is also the general direction many teams have gradually settled on for multi-model governance, including teams building intelligent applications on Baidu AI Cloud.