COMPONENT ROLES EXPLAINED 组件职责详解

Model Router vs Gateway
The Router Chooses; the Gateway Executes
模型路由器与网关:前者做选择,后者负责治理与执行

A model router is a decision component. A model gateway is the operational control plane around the request. They overlap in routing language, but solve different scopes and often belong in one architecture.

模型路由器是决策组件;模型网关是请求周围的运营控制平面。两者在路由术语上有交集,但解决范围不同,且经常同属一个架构。

Model router decision component inside a model gateway control plane

TL;DR

Router answers where

It filters, scores and selects an eligible model or endpoint for the workload.

Gateway answers how

It authenticates, adapts, limits, executes, observes and governs the request lifecycle.

A gateway may contain a router

Routing can be a policy module inside the broader gateway control plane.

Evidence joins the components

The selected candidate, reasons, attempts, transformations and result belong in one trace.

路由器回答去哪里

它为工作负载过滤、评分并选择合格模型或端点。

网关回答怎么做

它对请求生命周期执行认证、适配、限流、执行、观测与治理。

网关可以包含路由器

路由可以作为更广泛网关控制平面中的策略模块。

证据连接两类组件

所选候选、原因、尝试、转换与结果应属于同一调用链。

Decision plane versus execution plane 决策平面与执行平面

The router receives workload requirements and a candidate catalog. It removes ineligible endpoints, scores the remainder and emits a route plan. Its core output is a decision with rationale, not a network response from a model.

路由器接收工作负载要求与候选目录,移除不合格端点、对剩余项评分,并输出路由 Plan。它的核心输出是带理由的决策,而不是来自模型的网络响应。

The gateway owns the request boundary: identity, credentials, adapters, timeouts, quotas, retries, cache, policy, telemetry and final response. A thin gateway may use a simple static router; a richer one may host several routing policies.

网关拥有请求边界:身份、凭证、适配器、超时、配额、重试、缓存、策略、遥测与最终响应。轻量网关可使用简单静态路由器;更丰富的网关可承载多种路由策略。

Router and gateway responsibilities 路由器与网关职责

Responsibility 职责 Best fit 最适合 Verify before choosing 选择前验证
Candidate eligibility 候选合格性 Router filters by capability, policy, region and budget. 路由器按能力、策略、区域与预算过滤。 Gateway must supply a versioned catalog and enforce the resulting constraints. 网关必须提供版本化目录并执行所得约束。
Scoring and selection 评分与选择 Router compares quality, cost, latency, health or preference signals. 路由器比较质量、成本、延迟、健康或偏好信号。 Gateway records the policy version and selected endpoint before execution. 网关在执行前记录策略版本与所选端点。
Provider translation 供应商转换 Router may declare an adapter requirement. 路由器可以声明适配器要求。 Gateway maps request, stream, response, error and usage semantics. 网关映射请求、流、响应、错误与用量语义。
Operational controls 运营控制 Router can consider quota and health as inputs. 路由器可把配额与健康作为输入。 Gateway owns auth, keys, rate limits, cache, retries, circuit breakers and cancellation. 网关拥有认证、密钥、限流、缓存、重试、熔断与取消。
Evidence and governance 证据与治理 Router explains candidate exclusions and score. 路由器解释候选排除项与得分。 Gateway joins route evidence with attempts, native IDs, usage, policy and final disposition. 网关把路由证据与尝试、原生 ID、用量、策略及最终处置连接。

Define a clean component contract 定义清晰组件契约

Router input

Workload contract, eligible catalog snapshot, policy version and fresh operational signals.

Router output

Selected endpoint, ranked alternates, exclusions, reason codes and adapter requirements.

Gateway execution

Authorize identity, obtain credentials, translate, enforce budgets and execute bounded attempts.

Joined evidence

One parent trace connects decision, execution, provider response and downstream tool work.

路由器输入

工作负载契约、合格目录快照、策略版本与新鲜运营信号。

路由器输出

所选端点、排序备用项、排除项、原因码与适配器要求。

网关执行

授权身份、获取凭证、转换、执行预算并运行有界尝试。

联合证据

一个父调用链连接决策、执行、供应商响应与下游工具工作。

Test the router and gateway together 联合测试路由器与网关

  • Freeze catalog and policy fixtures so route decisions are reproducible.
  • Test hard exclusions before testing score weights and preferences.
  • Verify every selected endpoint has a valid adapter and credential path.
  • Inject stale health, quota exhaustion, adapter errors and execution failures.
  • Confirm the trace explains both the choice and the final outcome.
  • 冻结目录与策略 Fixture,使路由决策可复现。
  • 先测试硬性排除,再测试评分权重与偏好。
  • 验证每个所选端点都有有效适配器与凭证路径。
  • 注入过期健康、配额耗尽、适配器错误与执行故障。
  • 确认调用链同时解释选择与最终结果。

Embed the router, separate the contract 嵌入路由器,同时分离契约

The gateway constructs a routing context from identity, workload requirements, catalog, policy and fresh state. The router returns a versioned route plan. The gateway validates that plan, resolves credentials and adapters, executes bounded attempts and writes the outcome. This separation allows routing policy to evolve without fragmenting security or telemetry.

网关根据身份、工作负载要求、目录、策略与新鲜状态构建 Routing 上下文;路由器返回版本化路由 Plan;网关验证计划、解析凭证与适配器、执行有界尝试并写入结果。该分离让路由策略演进,而不拆散安全与遥测。

Production rule: the gateway must independently enforce every hard constraint the router used to choose a candidate.

生产规则:网关必须独立执行路由器选择候选时使用的每个硬性约束。

Model routing does not route external capabilities 模型路由不等于外部能力路由

A router chooses inference; a gateway governs inference execution. QVeris complements both by discovering and calling external APIs, tools, services and live data. Keep the capability requirement in the workload contract and connect the tool call to the same workflow trace.

路由器选择推理,网关治理推理执行;QVeris 通过发现和调用外部 API、工具、服务与实时数据补充两者。把能力需求放进工作负载契约,并将工具调用连接到同一工作流调用链。

A Production Decision Scorecard for Model Router vs GatewayModel Router 与 Gateway的生产决策评分卡

For Model Router vs Gateway, the useful question is not which product has more checkmarks. It is which design gives the team the right boundary, evidence, operating model, and exit path for a defined workload.

针对“模型路由器 vs 网关”,真正有价值的问题不是哪款产品拥有更多勾选项,而是哪种设计能为明确工作负载提供正确边界、证据、运营模式和退出路径。

BOUNDARY
Score the primary job before features
先评估主要职责,再比较功能

Map the decision engine that selects a model versus the enforcement point that authenticates, transforms, observes, limits, and executes traffic. Decide which component owns each decision, where policy is enforced, and whether the products are substitutes, complements, or overlapping layers.

梳理负责选择模型的决策引擎,与负责认证、转换、观察、限流和执行流量的策略执行点。明确每项决策由哪个组件负责、策略在哪里执行,以及两者究竟是替代、互补还是部分重叠。

EVIDENCE
Benchmark one shared task corpus
使用同一任务语料做基准测试

To validate Model Router vs Gateway, replay simple, long-context, streaming, structured-output, tool-calling, high-concurrency, and failure cases. Measure accepted-result quality, completion, p50 and tail latency, retries, trace completeness, and effective cost.

验证“模型路由器 vs 网关”时,重放简单、长上下文、流式、结构化输出、工具调用、高并发和失败案例,衡量合格结果质量、完成率、常规与长尾延迟、重试、追踪完整性和实际成本。

OWNERSHIP
Price the operating model
计算运营模式的总成本

When evaluating Model Router vs Gateway, include hosting, regional capacity, data retention, identity integration, policy maintenance, upgrades, incident response, support, compliance evidence, and the custom adapters the team must keep current.

评估“模型路由器 vs 网关”时,纳入托管、区域容量、数据留存、身份集成、策略维护、升级、事故响应、支持、合规证据,以及团队必须持续维护的自定义适配器。

CHANGE
Test migration and rollback before selection
选型前先测试迁移与回滚

Before rolling out Model Router vs Gateway, version a neutral request and evidence envelope, shadow traffic, classify semantic differences, preserve trace identity, and prove a staged rollback. Prefer the option that keeps policy and workload contracts portable.

上线“模型路由器 vs 网关”前,版本化中立请求与证据封装,运行影子流量,分类语义差异,保留追踪身份,并证明可分阶段回滚。优先选择能让策略和工作负载契约保持可迁移的方案。

FAQ

Is a router always a separate service?

No. It can be a library, plugin, policy module or independent service.

Can a gateway work without dynamic routing?

Yes. It can govern one fixed upstream while still providing auth, limits, adapters and evidence.

Who should own retries?

The execution layer, usually the gateway, because it knows attempts, deadlines and side effects.

路由器总是独立服务吗?

不是。它可以是库、插件、策略模块或独立服务。

网关能在没有动态路由时工作吗?

能。即使只连接固定上游,它仍可提供认证、限制、适配与证据。

谁应负责重试?

执行层,通常是网关,因为它知道尝试、截止时间与副作用。

Official sources and further reading 官方资料与延伸阅读