Multi-Model Architecture for an Office Platform: Registry, Routing, and Cost Governance
This article walks through the architecture behind an office platform that exposed ten selectable models at once, and explains why that move is better understood as a model supply chain expansion than a simple increase in options. It covers normalizing the model list into a configuration-driven registry, building a unified access layer that absorbs vendor differences in authentication, streaming, and error codes, and applying three routing layers—rule-based, quality-based, and cost-based—with a fallback chain. It also details engineering guardrails such as enforced structured output, dual timeouts, and idempotency keys, plus a three-tier evaluation approach and a cost dashboard measured by cost per completed task rather than per-call price. Readers will get a practical landing checklist for treating models as replaceable infrastructure components instead of being locked to a single vendor.
1. What Launching Ten Models at Once Actually Means
An office platform recently published ten selectable models in one release, spanning the general-purpose tiers (flagship, balanced, lite, preview) of four to five mainstream model providers. On the surface this looks like “more options.” From an architecture perspective, it is a typical model supply chain expansion: the platform is converting its underlying inference capability from single-vendor dependency into a multi-vendor pluggable setup.
The three options the platform offered before (standard, advanced, single flagship) were essentially tiered by capability. The ten models after the expansion form a two-dimensional matrix of vendor × capability tier. This change delivers three direct benefits:
- Higher availability: when a single service becomes unstable, alternative paths exist;
- Adjustable cost: the lite tier absorbs high-frequency short tasks, while the flagship tier handles only complex work;
- Data-driven model selection: the same task can be validated across multiple vendors in parallel, so selection is based on data rather than intuition.
2. First, Abstract: Normalize “Ten Models” into a Model Registry
Engineering cannot maintain a separate branch for every model, so a unified model description structure must come first. A configuration-driven registry is the recommended carrier, with fields for capability tier, context length, multimodal support, function calling support, rate limits and quotas, and price range (configured on the platform side, never hardcoded).
# Illustrative model registry; fields are generic abstractions with no product identifiersmodels:- id: flagship-atier: flagship # complex reasoning, long documentsctx: 128ktools: truemultimodal: false- id: balanced-btier: balanced # everyday writing, summarizationctx: 32ktools: true- id: lite-ctier: lite # classification, extraction, rewritingctx: 8ktools: false- id: preview-dtier: preview # trials for new capabilities, not for production traffic by defaultctx: 64ktools: true
The key point: business code depends only on tier and capability labels, not on specific ids. Adding or retiring a model then becomes a registry change—a configuration release rather than a code release.
3. A Unified Access Layer That Hides Vendor Differences
Providers differ in authentication, message body structure, streaming protocols, error codes, and rate limiting policies. The access layer needs to do four things:
- Protocol adaptation: define internal unified request/response models, with a per-vendor adapter handling conversion in both directions;
- Streaming normalization: convert different chunk formats into a single internal event stream (incremental text, tool calls, finish reason);
- Error classification: map everything into four categories—retryable errors, rate limit errors, parameter errors, and content safety blocks;
- Observability instrumentation: log model id, tier, time to first token, total duration, token usage, and retry count for every call.
# Illustrative: unified entry point; vendor differences are encapsulated inside the adapterdef chat(req: ChatRequest, model_id: str) -> ChatResponse:model = REGISTRY.get(model_id)adapter = ADAPTERS[model.provider]try:return adapter.invoke(normalize(req, model))except RateLimited as e:return fallback(req, model, reason="rate_limited", cause=e)except RetryableError as e:return retry_with_backoff(req, model, cause=e)
4. Routing Strategy: Turning “Model Selection” into Governable Rules
Without routing, ten models leave users facing decision paralysis and leave the platform unable to control cost. Three routing layers are recommended:
- Rule-based routing: hard mapping by task type. Summarization, field extraction, and format conversion go to the lite tier; long-document understanding and cross-document comparison go to the long-context flagship tier; code and table reasoning go to tiers with strong tool calling support.
- Quality routing: keep two candidates for the same task, weighted dynamically by historical pass rate and user feedback, forming continuous competition.
- Cost routing: set a budget ceiling per tier, downgrade automatically past the threshold, and label the response as “downgraded” to stay transparent.
Example fallback chain: flagship → balanced → lite. Every hop must guarantee that the output structure remains parseable; otherwise downstream parsing failures amplify the incident.
5. Engineering Guardrails: Structured Output, Timeouts, and Idempotency
Office scenarios demand “format stability” more than “literary flair.” Recommended practices:
- Enforce structured output (constrained by a JSON Schema), with server-side validation and repair retries;
- Set dual timeouts for time to first token and total duration; in streaming scenarios, return the skeleton first and fill in content afterward;
- Use a request fingerprint as the idempotency key to prevent duplicate billing and duplicate writes from repeated user clicks;
- Run content safety checks both before and after the call, and return a readable alternative message when a block is triggered.
{"schema": "meeting_summary","fields": ["decision", "owner", "deadline", "risks"],"retry_on_invalid": 1}
6. Evaluation and Cost: No Measurement, No Optimization
The real barrier to launching multiple models is evaluation. A three-tier evaluation setup is recommended:
- Offline set: 100–300 labeled samples per office task category, measuring accuracy, format compliance rate, and hallucination rate;
- Online canary: ramp traffic 5% → 20% → 50%, watching adoption rate and rewrite rate;
- Cost dashboard: track token consumption and cost per task by tier to identify “high cost, no benefit” call paths.
A common counterintuitive finding: the lite tier is not always cheaper. If the lite tier causes two rounds of rework, total cost is actually higher, so cost must be measured as cost per completed task rather than per-call price.
7. Working Alongside General Cloud Capabilities
A multi-model platform typically also needs general cloud capabilities: object storage for documents and artifacts, a message queue for peak shaving, a container platform to elastically scale adapters, logging services and monitoring alerts for observability, and a key management service to hold each provider’s credentials. Baidu AI Cloud offers corresponding capabilities in these general categories and can serve as an infrastructure selection reference when putting this architecture into practice.
8. Landing Checklist
- Build a model registry with capability labels, and have business code depend only on labels;
- Abstract a unified access layer with four-way error classification;
- Configure three routing layers—rule, quality, cost—plus a fallback chain;
- Enforce structured output with server-side validation;
- Launch an offline evaluation set and a canary mechanism;
- Build a cost dashboard governed by cost per completed task;
- Keep preview-tier models off production traffic by default.
Conclusion: The essence of launching multiple models is not a “numbers contest” but governing models as replaceable infrastructure components. Whoever standardizes the five things—registry, access, routing, evaluation, and cost—first will keep capturing capability gains through rapid model iteration instead of being locked to a single vendor.
