AI Gateway · LLM 网关与多模型路由
定位 :企业 AI 控制面 ------在 07 §10 Token FinOps 之上,专述 LiteLLM / Kong AI Gateway / Portkey / APISIX AI / Bedrock 等多实现的路由、限流、租户隔离 、缓存与可观测契约;并与 27 §7 集成视图 对齐。
导航 · 套件内关联
| 类型 | 文件 | 本篇用法 |
|---|---|---|
| FinOps 母版 | 07 §10 | $/task、LiteLLM metadata |
| 集成母版 | 27 §7 | AI Gateway 契约、IDP |
| 深链 | 25 可观测 | spend 对账 |
| 深链 | 06 Eval | 模型切换回归 |
| 深链 | 13 Playbook | 租户配额 |
| 深链 | 23 Browser | vision 路由 |
0. 面试前 30 分钟 Checklist(Staff / Architect)
| 时间盒 | 动作 | 产出 |
|---|---|---|
| 5 min | 画 Gateway 五层(§3.1) | Auth→Route→Policy→Cache→Provider |
| 5 min | 对比 LiteLLM vs Kong vs Portkey(§4) | 各 1 句定位 |
| 5 min | 口述 租户隔离三板斧(§6) | key/budget/header/metadata |
| 5 min | 链 07 §10 + 27 §7.3 | FinOps + 集成契约 |
| 5 min | STAR(§12) | 路由错模型/预算穿透 |
| 5 min | P0 十二条(§13) | 能背诵 |
开场金句(90s):
「AI Gateway 是 LLM 的 API Gateway + FinOps + 策略控制面 ,不是简单反向代理。统一鉴权、多模型路由、租户预算、语义缓存、Bedrock 多云兜底,并把
tenant/feature/model标签贯穿到 25 可观测与 07 成本面板。」
#mermaid-svg-oKSCDLf0ipAj0oPu{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-oKSCDLf0ipAj0oPu .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-oKSCDLf0ipAj0oPu .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-oKSCDLf0ipAj0oPu .error-icon{fill:#552222;}#mermaid-svg-oKSCDLf0ipAj0oPu .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-oKSCDLf0ipAj0oPu .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-oKSCDLf0ipAj0oPu .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-oKSCDLf0ipAj0oPu .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-oKSCDLf0ipAj0oPu .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-oKSCDLf0ipAj0oPu .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-oKSCDLf0ipAj0oPu .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-oKSCDLf0ipAj0oPu .marker{fill:#333333;stroke:#333333;}#mermaid-svg-oKSCDLf0ipAj0oPu .marker.cross{stroke:#333333;}#mermaid-svg-oKSCDLf0ipAj0oPu svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-oKSCDLf0ipAj0oPu p{margin:0;}#mermaid-svg-oKSCDLf0ipAj0oPu .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-oKSCDLf0ipAj0oPu .cluster-label text{fill:#333;}#mermaid-svg-oKSCDLf0ipAj0oPu .cluster-label span{color:#333;}#mermaid-svg-oKSCDLf0ipAj0oPu .cluster-label span p{background-color:transparent;}#mermaid-svg-oKSCDLf0ipAj0oPu .label text,#mermaid-svg-oKSCDLf0ipAj0oPu span{fill:#333;color:#333;}#mermaid-svg-oKSCDLf0ipAj0oPu .node rect,#mermaid-svg-oKSCDLf0ipAj0oPu .node circle,#mermaid-svg-oKSCDLf0ipAj0oPu .node ellipse,#mermaid-svg-oKSCDLf0ipAj0oPu .node polygon,#mermaid-svg-oKSCDLf0ipAj0oPu .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-oKSCDLf0ipAj0oPu .rough-node .label text,#mermaid-svg-oKSCDLf0ipAj0oPu .node .label text,#mermaid-svg-oKSCDLf0ipAj0oPu .image-shape .label,#mermaid-svg-oKSCDLf0ipAj0oPu .icon-shape .label{text-anchor:middle;}#mermaid-svg-oKSCDLf0ipAj0oPu .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-oKSCDLf0ipAj0oPu .rough-node .label,#mermaid-svg-oKSCDLf0ipAj0oPu .node .label,#mermaid-svg-oKSCDLf0ipAj0oPu .image-shape .label,#mermaid-svg-oKSCDLf0ipAj0oPu .icon-shape .label{text-align:center;}#mermaid-svg-oKSCDLf0ipAj0oPu .node.clickable{cursor:pointer;}#mermaid-svg-oKSCDLf0ipAj0oPu .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-oKSCDLf0ipAj0oPu .arrowheadPath{fill:#333333;}#mermaid-svg-oKSCDLf0ipAj0oPu .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-oKSCDLf0ipAj0oPu .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-oKSCDLf0ipAj0oPu .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-oKSCDLf0ipAj0oPu .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-oKSCDLf0ipAj0oPu .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-oKSCDLf0ipAj0oPu .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-oKSCDLf0ipAj0oPu .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-oKSCDLf0ipAj0oPu .cluster text{fill:#333;}#mermaid-svg-oKSCDLf0ipAj0oPu .cluster span{color:#333;}#mermaid-svg-oKSCDLf0ipAj0oPu div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-oKSCDLf0ipAj0oPu .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-oKSCDLf0ipAj0oPu rect.text{fill:none;stroke-width:0;}#mermaid-svg-oKSCDLf0ipAj0oPu .icon-shape,#mermaid-svg-oKSCDLf0ipAj0oPu .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-oKSCDLf0ipAj0oPu .icon-shape p,#mermaid-svg-oKSCDLf0ipAj0oPu .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-oKSCDLf0ipAj0oPu .icon-shape .label rect,#mermaid-svg-oKSCDLf0ipAj0oPu .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-oKSCDLf0ipAj0oPu .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-oKSCDLf0ipAj0oPu .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-oKSCDLf0ipAj0oPu :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} AI Gateway Layer
Clients
Providers
Amazon Bedrock
Azure OpenAI
OpenAI
vLLM Private
Spring AI / Agents
Internal Tools
AuthN/Z + API Key
Router: model + region
Rate Limit / Budget
Response + Semantic Cache
OTel + spend tags
1. 为什么需要 AI Gateway
| 无 Gateway 痛点 | Gateway 能力 |
|---|---|
| 各服务直连多厂商 key | 统一密钥轮换 |
| 成本不可归因 | tenant/feature 标签 |
| 模型切换散落 | 路由表 + 灰度 |
| 无限重试烧预算 | budget + 429 语义 |
| 无缓存 | exact + semantic cache |
→ 27 §7.3 已预留 X-Model-Route、prompt_rev。
2. 能力模型(Capability Model)
| 能力 | P0 | 说明 |
|---|---|---|
| 统一协议 | ✓ | OpenAI-compatible 最常见 |
| 路由 | ✓ | 模型/区域/成本/延迟 |
| 限流 | ✓ | RPS + TPM + 并发 |
| 预算 | ✓ | 租户日/月顶 |
| 缓存 | ✓ | exact + optional semantic |
| 回退 | ✓ | fallback chain |
| 审计 | ✓ | 请求体脱敏日志 |
| 插件 | P1 | Guardrails、PII、自定义 |
3. 参考架构(五层)
3.1 五层详解
| 层 | 职责 | 失败模式 |
|---|---|---|
| L1 Auth | API Key/OIDC/mTLS | key 泄漏 |
| L2 Route | model alias → provider | 路由到贵模型 |
| L3 Policy | RL/budget/content | 预算穿透 |
| L4 Cache | 降本 | 跨租户污染 |
| L5 Provider | 真推理 | 上游 5xx |
3.2 LiteLLM Proxy
yaml
# litellm config 片段
model_list:
- model_name: gpt-4o-mini-route
litellm_params:
model: azure/gpt-4o-mini
api_base: os.environ/AZURE_API_BASE
- model_name: bedrock-claude
litellm_params:
model: bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0
aws_region_name: us-east-1
router_settings:
routing_strategy: usage-based-routing-v2
general_settings:
master_key: os.environ/LITELLM_MASTER_KEY
| LiteLLM 能力 | 生产要点 |
|---|---|
| spend logs | 与 07 §10.4 对齐 |
| budget | max_budget per user_id/team_id |
| metadata | X-LiteLLM-Metadata JSON |
| fallbacks | 有序链;勿对 429 盲重试 |
| callbacks | Langfuse/Helicone hook |
→ Spring AI 指向 Proxy 示例见 07 §10.4。
3.3 Kong AI Gateway
| 维度 | Kong | LiteLLM |
|---|---|---|
| 定位 | 通用 API GW + AI 插件 | LLM-native proxy |
| 强项 | 企业 Kong 存量、插件生态 | 多模型路由/OpenAI 兼容 |
| AI 插件 | Prompt guard、LLM rate limit | 内置 router/spend |
| 适用 | 已有 Kong 团队 | AI 平台团队 |
3.4 Portkey
| 能力 | 说明 |
|---|---|
| Observability | 内置 trace、成本 |
| Guardrails | 策略管道 |
| Gateway | 多 provider 抽象 |
| 适用 | 要快落地观测+治理 |
3.5 APISIX AI
| 能力 | 说明 |
|---|---|
| 动态路由 | etcd 配置 |
| 插件 | ai-proxy、限流 |
| 适用 | 国内云原生、已有 APISIX |
3.6 Amazon Bedrock Routing
#mermaid-svg-yIoOv3BmJoeCH4Kz{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-yIoOv3BmJoeCH4Kz .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-yIoOv3BmJoeCH4Kz .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-yIoOv3BmJoeCH4Kz .error-icon{fill:#552222;}#mermaid-svg-yIoOv3BmJoeCH4Kz .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-yIoOv3BmJoeCH4Kz .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-yIoOv3BmJoeCH4Kz .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-yIoOv3BmJoeCH4Kz .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-yIoOv3BmJoeCH4Kz .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-yIoOv3BmJoeCH4Kz .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-yIoOv3BmJoeCH4Kz .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-yIoOv3BmJoeCH4Kz .marker{fill:#333333;stroke:#333333;}#mermaid-svg-yIoOv3BmJoeCH4Kz .marker.cross{stroke:#333333;}#mermaid-svg-yIoOv3BmJoeCH4Kz svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-yIoOv3BmJoeCH4Kz p{margin:0;}#mermaid-svg-yIoOv3BmJoeCH4Kz .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-yIoOv3BmJoeCH4Kz .cluster-label text{fill:#333;}#mermaid-svg-yIoOv3BmJoeCH4Kz .cluster-label span{color:#333;}#mermaid-svg-yIoOv3BmJoeCH4Kz .cluster-label span p{background-color:transparent;}#mermaid-svg-yIoOv3BmJoeCH4Kz .label text,#mermaid-svg-yIoOv3BmJoeCH4Kz span{fill:#333;color:#333;}#mermaid-svg-yIoOv3BmJoeCH4Kz .node rect,#mermaid-svg-yIoOv3BmJoeCH4Kz .node circle,#mermaid-svg-yIoOv3BmJoeCH4Kz .node ellipse,#mermaid-svg-yIoOv3BmJoeCH4Kz .node polygon,#mermaid-svg-yIoOv3BmJoeCH4Kz .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-yIoOv3BmJoeCH4Kz .rough-node .label text,#mermaid-svg-yIoOv3BmJoeCH4Kz .node .label text,#mermaid-svg-yIoOv3BmJoeCH4Kz .image-shape .label,#mermaid-svg-yIoOv3BmJoeCH4Kz .icon-shape .label{text-anchor:middle;}#mermaid-svg-yIoOv3BmJoeCH4Kz .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-yIoOv3BmJoeCH4Kz .rough-node .label,#mermaid-svg-yIoOv3BmJoeCH4Kz .node .label,#mermaid-svg-yIoOv3BmJoeCH4Kz .image-shape .label,#mermaid-svg-yIoOv3BmJoeCH4Kz .icon-shape .label{text-align:center;}#mermaid-svg-yIoOv3BmJoeCH4Kz .node.clickable{cursor:pointer;}#mermaid-svg-yIoOv3BmJoeCH4Kz .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-yIoOv3BmJoeCH4Kz .arrowheadPath{fill:#333333;}#mermaid-svg-yIoOv3BmJoeCH4Kz .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-yIoOv3BmJoeCH4Kz .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-yIoOv3BmJoeCH4Kz .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-yIoOv3BmJoeCH4Kz .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-yIoOv3BmJoeCH4Kz .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-yIoOv3BmJoeCH4Kz .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-yIoOv3BmJoeCH4Kz .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-yIoOv3BmJoeCH4Kz .cluster text{fill:#333;}#mermaid-svg-yIoOv3BmJoeCH4Kz .cluster span{color:#333;}#mermaid-svg-yIoOv3BmJoeCH4Kz div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-yIoOv3BmJoeCH4Kz .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-yIoOv3BmJoeCH4Kz rect.text{fill:none;stroke-width:0;}#mermaid-svg-yIoOv3BmJoeCH4Kz .icon-shape,#mermaid-svg-yIoOv3BmJoeCH4Kz .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-yIoOv3BmJoeCH4Kz .icon-shape p,#mermaid-svg-yIoOv3BmJoeCH4Kz .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-yIoOv3BmJoeCH4Kz .icon-shape .label rect,#mermaid-svg-yIoOv3BmJoeCH4Kz .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-yIoOv3BmJoeCH4Kz .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-yIoOv3BmJoeCH4Kz .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-yIoOv3BmJoeCH4Kz :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} AI Gateway
Bedrock
Claude
Titan Embed
Llama
| 模式 | 用法 |
|---|---|
| 单区域 | aws_region 固定 |
| 跨模型 | modelId 路由表 |
| 知识库 | Bedrock KB vs 自建 RAG 03 |
| IAM | 实例角色;禁长期 AK |
4. 产品对比矩阵(2026 视角)
| 产品 | 协议 | 路由 | 预算 | 语义缓存 | 私有部署 |
|---|---|---|---|---|---|
| LiteLLM | OpenAI-compat | 强 | 强 | 插件 | ✓ |
| Kong AI | Kong route | 中 | 插件 | 中 | ✓ |
| Portkey | 多 | 强 | 中 | 有 | SaaS/私有 |
| APISIX AI | OpenAI-compat | 中 | 插件 | 中 | ✓ |
| 自建 Envoy+ext_proc | 定制 | 定制 | 定制 | 定制 | ✓ |
选型建议:
- 已有 Kong → Kong AI + LiteLLM 并存(Kong 边缘,LiteLLM 模型层)。
- AI 平台绿场 → LiteLLM 主 + 25。
- 要观测优先 → Portkey 评估。
- 国内 APISIX → APISIX ai-proxy。
5. 路由策略(Routing)
| 策略 | 触发 | 例 |
|---|---|---|
| 静态 alias | 功能固定 | support-bot → gpt-4o-mini |
| 延迟优先 | p95 SLA | 区域就近 |
| 成本优先 | 非关键 | Haiku/Mini |
| 能力优先 | 工具调用 | Claude/GPT-4 class |
| 灰度 | 新版本 | 5% → 25% → 100% |
| Bedrock 合规 | 数据驻留 | us-east-1 only |
python
# 概念:路由决策输入
class RouteContext:
tenant_id: str
feature: str
needs_tools: bool
input_tokens_est: int
pii_level: str # none/internal/regulated
→ 与 07 §6 多模型架构一致。
6. 租户隔离(Tenant Isolation)
6.1 三板斧
| 斧 | 机制 | 泄漏面 |
|---|---|---|
| 身份 | 每租户 API Key / OAuth client | key 混用 |
| 预算 | hard budget + alert | 共享池 |
| 数据 | cache key 含 tenant_id |
语义缓存串租户 |
6.2 Header 契约(对齐 27 §7.3)
| Header | 必填 | 用途 |
|---|---|---|
X-Tenant-Id |
✓ | 成本/限流 |
X-Feature-Id |
✓ | 路由表 |
X-Model-Route |
可选 | 强制 alias |
X-Trace-Id |
✓ | 25 对账 |
X-Prompt-Rev |
推荐 | 版本钉扎 |
6.3 多租户缓存键
cache_key = SHA256(tenant_id + model + normalized_messages + prompt_rev)
禁止:仅按 messages hash(会跨租户命中)。
7. 限流与预算(Rate Limit & Budget)
| 粒度 | 指标 | 实现 |
|---|---|---|
| 租户 | $/day, TPM | LiteLLM budget / Redis |
| 功能 | RPS | Kong/APISIX limit |
| 用户 | 并发 | 应用层 semaphore |
| 全局 | 上游 TPM | provider 反馈 429 |
7.1 429 语义(与 Spring AI)
- Gateway
budget_exceeded→ 不可重试。 - 上游
rate_limit→ 指数退避 + 切换 fallback。 - Agent 步数预算 在应用层(27),网关不知成功语义。
→ 07 §10.2 Budget Gates。
8. 缓存(Exact & Semantic)
8.1 Exact Cache
| 项 | 值 |
|---|---|
| 键 | tenant+model+messages hash |
| TTL | 功能相关 5m--24h |
| 失效 | prompt_rev 变更 |
8.2 Semantic Cache
| 项 | 值 |
|---|---|
| 相似度 | cosine ≥0.95(调优) |
| 风险 | 过时政策答案 |
| 规避 | 仅 FAQ;regulated 禁用 |
→ 向量选型见 26,不在此重复 RAG 管线。
8.3 缓存 与 FinOps 面板
| 指标 | 说明 |
|---|---|
cache_hit_rate |
按 tenant |
cache_saved_usd |
LiteLLM 报表 |
stale_answer_rate |
质量 06 |
9. 与 07 §10 · 27 §7 集成视图
9.1 FinOps 闭环
FinOps Dashboard Langfuse Provider AI Gateway Agent FinOps Dashboard Langfuse Provider AI Gateway Agent #mermaid-svg-xixFq1Uol0X36kJZ{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-xixFq1Uol0X36kJZ .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-xixFq1Uol0X36kJZ .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-xixFq1Uol0X36kJZ .error-icon{fill:#552222;}#mermaid-svg-xixFq1Uol0X36kJZ .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-xixFq1Uol0X36kJZ .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-xixFq1Uol0X36kJZ .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-xixFq1Uol0X36kJZ .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-xixFq1Uol0X36kJZ .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-xixFq1Uol0X36kJZ .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-xixFq1Uol0X36kJZ .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-xixFq1Uol0X36kJZ .marker{fill:#333333;stroke:#333333;}#mermaid-svg-xixFq1Uol0X36kJZ .marker.cross{stroke:#333333;}#mermaid-svg-xixFq1Uol0X36kJZ svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-xixFq1Uol0X36kJZ p{margin:0;}#mermaid-svg-xixFq1Uol0X36kJZ .actor{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-xixFq1Uol0X36kJZ text.actor>tspan{fill:black;stroke:none;}#mermaid-svg-xixFq1Uol0X36kJZ .actor-line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-xixFq1Uol0X36kJZ .innerArc{stroke-width:1.5;stroke-dasharray:none;}#mermaid-svg-xixFq1Uol0X36kJZ .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#mermaid-svg-xixFq1Uol0X36kJZ .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#mermaid-svg-xixFq1Uol0X36kJZ #arrowhead path{fill:#333;stroke:#333;}#mermaid-svg-xixFq1Uol0X36kJZ .sequenceNumber{fill:white;}#mermaid-svg-xixFq1Uol0X36kJZ #sequencenumber{fill:#333;}#mermaid-svg-xixFq1Uol0X36kJZ #crosshead path{fill:#333;stroke:#333;}#mermaid-svg-xixFq1Uol0X36kJZ .messageText{fill:#333;stroke:none;}#mermaid-svg-xixFq1Uol0X36kJZ .labelBox{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-xixFq1Uol0X36kJZ .labelText,#mermaid-svg-xixFq1Uol0X36kJZ .labelText>tspan{fill:black;stroke:none;}#mermaid-svg-xixFq1Uol0X36kJZ .loopText,#mermaid-svg-xixFq1Uol0X36kJZ .loopText>tspan{fill:black;stroke:none;}#mermaid-svg-xixFq1Uol0X36kJZ .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-xixFq1Uol0X36kJZ .note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-xixFq1Uol0X36kJZ .noteText,#mermaid-svg-xixFq1Uol0X36kJZ .noteText>tspan{fill:black;stroke:none;}#mermaid-svg-xixFq1Uol0X36kJZ .activation0{fill:#f4f4f4;stroke:#666;}#mermaid-svg-xixFq1Uol0X36kJZ .activation1{fill:#f4f4f4;stroke:#666;}#mermaid-svg-xixFq1Uol0X36kJZ .activation2{fill:#f4f4f4;stroke:#666;}#mermaid-svg-xixFq1Uol0X36kJZ .actorPopupMenu{position:absolute;}#mermaid-svg-xixFq1Uol0X36kJZ .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#mermaid-svg-xixFq1Uol0X36kJZ .actor-man line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-xixFq1Uol0X36kJZ .actor-man circle,#mermaid-svg-xixFq1Uol0X36kJZ line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;stroke-width:2px;}#mermaid-svg-xixFq1Uol0X36kJZ :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} chat (headers: tenant, feature) routed model usage response + cost headers OTel span + spend $/successful task
| 环节 | 07 §10 | 本篇 |
|---|---|---|
| 记账点 | LiteLLM spend | 统一 metadata |
| 硬顶 | tenant budget | RL + budget |
| 归因 | feature/model | Header 契约 |
| 对账 | Langfuse | 25 |
9.2 27 §7 集成清单
- BFF 只认 Gateway endpoint
- IDP 注入轮换 key(Vault)
- Mesh mTLS 到 Gateway
- Outbox 副作用 不经过 Gateway
-
prompt_rev注册表
10. 部署与高可用
| 模式 | RTO | 说明 |
|---|---|---|
| 单区多副本 | 分钟 | K8s HPA |
| 双区 active-passive | 15m | DNS + health |
| Provider fallback | 秒级 | 有序链 |
11. 高频口述题(15 道 · 60--90s)
11.1 AI Gateway 和 API Gateway 区别?
答:LLM 语义:model 路由、TPM、prompt 缓存、spend;通用 GW 不懂 token。
11.2 为什么推荐 LiteLLM?
答:OpenAI-compat、多 provider、spend/budget 成熟;见 §3.2、07 §10.4。
11.3 Kong 还是 LiteLLM?
答:已有 Kong 用 Kong 边缘;模型层 LiteLLM。§4。
11.4 租户预算穿透?
答:hard budget+独立 key+缓存 tenant 前缀。§6。
11.5 语义缓存风险?
答:regulated 禁用;FAQ 可用;监控 stale。§8.2。
11.6 Bedrock 何时首选?
答:AWS 驻留、合规、统一 IAM。§3.6。
11.7 429 要不要重试?
答:budget_exceeded 不重试;上游 RL 退避+ fallback。§7。
11.8 与 vLLM 关系?
答:Gateway 前置;私有模型走 LOC provider。§3、07。
11.9 Agent 步数预算放哪?
答:应用层;网关管 token。§7、27。
11.10 Portkey 价值?
答:观测+Guardrails 快。§3.4。
11.11 APISIX 场景?
答:国内已有 APISIX。§3.5。
11.12 模型灰度?
答:路由权重 5%→100%。§5。
11.13 DevEx Cursor 成本?
答:不进生产 Gateway;分账。07 D06。
11.14 Header 最少集?
答:tenant+feature+trace。§6.2。
11.15 与 25?
答:spend 与 trace 对账。§9。
12. STAR-M-P 事故复盘:路由表误配导致租户用贵模型
| 字段 | 内容 |
|---|---|
| S | 促销季 Day1,support 租户 $/1k req 升 4x。 |
| T | 4h 定位;冻结错误路由。 |
| A | 查 metadata model=gpt-4o 应为 mini;回滚路由 ConfigMap;补 budget alert;shadow 24h。 |
| R | 无客户-facing SLA 违约;补差价内部承担。 |
| P | route_misconfig_incidents=0 30d;shadow 覆盖 100% alias。 |
| M | ① GitOps 路由;② 发布门禁 diff;③ 按 tenant anomaly 告警;④ 贵模型需 feature 白名单。 |
13. Master Checklist(P0 / P1 / P2)
13.1 P0 --- 上线阻断
- P0-01 统一 Gateway 入口
- P0-02 tenant/feature header 必填
- P0-03 cache key 含 tenant
- P0-04 budget hard stop
- P0-05 budget 429 不重试
- P0-06 fallback 有序链
- P0-07 密钥 Vault 轮换
- P0-08 请求审计脱敏
- P0-09 OTel trace 贯通
- P0-10 路由 GitOps+diff 门禁
- P0-11 regulated 禁 semantic cache
- P0-12 与 07 spend 对账
13.2 P1 --- Staff 答辩
- P1-01 见 §1
- P1-02 见 §2
- P1-03 见 §3
- P1-04 见 §4
- P1-05 见 §5
- P1-06 见 §6
- P1-07 见 §7
- P1-08 见 §8
- P1-09 见 §9
- P1-10 见 §10
13.3 P2 --- 卓越
- P2-01 卓越项
- P2-02 卓越项
- P2-03 卓越项
- P2-04 卓越项
- P2-05 卓越项
附录 R1: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-1 | azure | gpt-4o-mini | support,ops |
| smart-1 | bedrock | claude-3-5 | agent,legal |
| embed-1 | openai | text-embedding-3 | rag-indexer |
追问 R1 :若 smart-1 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R2: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-2 | azure | gpt-4o-mini | support,ops |
| smart-2 | bedrock | claude-3-5 | agent,legal |
| embed-2 | openai | text-embedding-3 | rag-indexer |
追问 R2 :若 smart-2 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R3: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-3 | azure | gpt-4o-mini | support,ops |
| smart-3 | bedrock | claude-3-5 | agent,legal |
| embed-3 | openai | text-embedding-3 | rag-indexer |
追问 R3 :若 smart-3 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R4: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-4 | azure | gpt-4o-mini | support,ops |
| smart-4 | bedrock | claude-3-5 | agent,legal |
| embed-4 | openai | text-embedding-3 | rag-indexer |
追问 R4 :若 smart-4 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R5: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-5 | azure | gpt-4o-mini | support,ops |
| smart-5 | bedrock | claude-3-5 | agent,legal |
| embed-5 | openai | text-embedding-3 | rag-indexer |
追问 R5 :若 smart-5 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R6: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-6 | azure | gpt-4o-mini | support,ops |
| smart-6 | bedrock | claude-3-5 | agent,legal |
| embed-6 | openai | text-embedding-3 | rag-indexer |
追问 R6 :若 smart-6 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R7: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-7 | azure | gpt-4o-mini | support,ops |
| smart-7 | bedrock | claude-3-5 | agent,legal |
| embed-7 | openai | text-embedding-3 | rag-indexer |
追问 R7 :若 smart-7 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R8: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-8 | azure | gpt-4o-mini | support,ops |
| smart-8 | bedrock | claude-3-5 | agent,legal |
| embed-8 | openai | text-embedding-3 | rag-indexer |
追问 R8 :若 smart-8 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R9: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-9 | azure | gpt-4o-mini | support,ops |
| smart-9 | bedrock | claude-3-5 | agent,legal |
| embed-9 | openai | text-embedding-3 | rag-indexer |
追问 R9 :若 smart-9 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R10: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-10 | azure | gpt-4o-mini | support,ops |
| smart-10 | bedrock | claude-3-5 | agent,legal |
| embed-10 | openai | text-embedding-3 | rag-indexer |
追问 R10 :若 smart-10 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R11: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-11 | azure | gpt-4o-mini | support,ops |
| smart-11 | bedrock | claude-3-5 | agent,legal |
| embed-11 | openai | text-embedding-3 | rag-indexer |
追问 R11 :若 smart-11 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R12: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-12 | azure | gpt-4o-mini | support,ops |
| smart-12 | bedrock | claude-3-5 | agent,legal |
| embed-12 | openai | text-embedding-3 | rag-indexer |
追问 R12 :若 smart-12 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R13: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-13 | azure | gpt-4o-mini | support,ops |
| smart-13 | bedrock | claude-3-5 | agent,legal |
| embed-13 | openai | text-embedding-3 | rag-indexer |
追问 R13 :若 smart-13 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R14: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-14 | azure | gpt-4o-mini | support,ops |
| smart-14 | bedrock | claude-3-5 | agent,legal |
| embed-14 | openai | text-embedding-3 | rag-indexer |
追问 R14 :若 smart-14 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R15: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-15 | azure | gpt-4o-mini | support,ops |
| smart-15 | bedrock | claude-3-5 | agent,legal |
| embed-15 | openai | text-embedding-3 | rag-indexer |
追问 R15 :若 smart-15 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R16: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-16 | azure | gpt-4o-mini | support,ops |
| smart-16 | bedrock | claude-3-5 | agent,legal |
| embed-16 | openai | text-embedding-3 | rag-indexer |
追问 R16 :若 smart-16 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R17: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-17 | azure | gpt-4o-mini | support,ops |
| smart-17 | bedrock | claude-3-5 | agent,legal |
| embed-17 | openai | text-embedding-3 | rag-indexer |
追问 R17 :若 smart-17 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R18: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-18 | azure | gpt-4o-mini | support,ops |
| smart-18 | bedrock | claude-3-5 | agent,legal |
| embed-18 | openai | text-embedding-3 | rag-indexer |
追问 R18 :若 smart-18 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R19: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-19 | azure | gpt-4o-mini | support,ops |
| smart-19 | bedrock | claude-3-5 | agent,legal |
| embed-19 | openai | text-embedding-3 | rag-indexer |
追问 R19 :若 smart-19 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R20: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-20 | azure | gpt-4o-mini | support,ops |
| smart-20 | bedrock | claude-3-5 | agent,legal |
| embed-20 | openai | text-embedding-3 | rag-indexer |
追问 R20 :若 smart-20 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R21: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-21 | azure | gpt-4o-mini | support,ops |
| smart-21 | bedrock | claude-3-5 | agent,legal |
| embed-21 | openai | text-embedding-3 | rag-indexer |
追问 R21 :若 smart-21 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R22: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-22 | azure | gpt-4o-mini | support,ops |
| smart-22 | bedrock | claude-3-5 | agent,legal |
| embed-22 | openai | text-embedding-3 | rag-indexer |
追问 R22 :若 smart-22 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R23: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-23 | azure | gpt-4o-mini | support,ops |
| smart-23 | bedrock | claude-3-5 | agent,legal |
| embed-23 | openai | text-embedding-3 | rag-indexer |
追问 R23 :若 smart-23 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R24: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-24 | azure | gpt-4o-mini | support,ops |
| smart-24 | bedrock | claude-3-5 | agent,legal |
| embed-24 | openai | text-embedding-3 | rag-indexer |
追问 R24 :若 smart-24 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R25: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-25 | azure | gpt-4o-mini | support,ops |
| smart-25 | bedrock | claude-3-5 | agent,legal |
| embed-25 | openai | text-embedding-3 | rag-indexer |
追问 R25 :若 smart-25 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R26: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-26 | azure | gpt-4o-mini | support,ops |
| smart-26 | bedrock | claude-3-5 | agent,legal |
| embed-26 | openai | text-embedding-3 | rag-indexer |
追问 R26 :若 smart-26 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R27: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-27 | azure | gpt-4o-mini | support,ops |
| smart-27 | bedrock | claude-3-5 | agent,legal |
| embed-27 | openai | text-embedding-3 | rag-indexer |
追问 R27 :若 smart-27 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R28: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-28 | azure | gpt-4o-mini | support,ops |
| smart-28 | bedrock | claude-3-5 | agent,legal |
| embed-28 | openai | text-embedding-3 | rag-indexer |
追问 R28 :若 smart-28 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R29: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-29 | azure | gpt-4o-mini | support,ops |
| smart-29 | bedrock | claude-3-5 | agent,legal |
| embed-29 | openai | text-embedding-3 | rag-indexer |
追问 R29 :若 smart-29 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R30: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-30 | azure | gpt-4o-mini | support,ops |
| smart-30 | bedrock | claude-3-5 | agent,legal |
| embed-30 | openai | text-embedding-3 | rag-indexer |
追问 R30 :若 smart-30 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R31: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-31 | azure | gpt-4o-mini | support,ops |
| smart-31 | bedrock | claude-3-5 | agent,legal |
| embed-31 | openai | text-embedding-3 | rag-indexer |
追问 R31 :若 smart-31 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R32: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-32 | azure | gpt-4o-mini | support,ops |
| smart-32 | bedrock | claude-3-5 | agent,legal |
| embed-32 | openai | text-embedding-3 | rag-indexer |
追问 R32 :若 smart-32 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R33: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-33 | azure | gpt-4o-mini | support,ops |
| smart-33 | bedrock | claude-3-5 | agent,legal |
| embed-33 | openai | text-embedding-3 | rag-indexer |
追问 R33 :若 smart-33 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R34: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-34 | azure | gpt-4o-mini | support,ops |
| smart-34 | bedrock | claude-3-5 | agent,legal |
| embed-34 | openai | text-embedding-3 | rag-indexer |
追问 R34 :若 smart-34 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R35: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-35 | azure | gpt-4o-mini | support,ops |
| smart-35 | bedrock | claude-3-5 | agent,legal |
| embed-35 | openai | text-embedding-3 | rag-indexer |
追问 R35 :若 smart-35 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R36: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-36 | azure | gpt-4o-mini | support,ops |
| smart-36 | bedrock | claude-3-5 | agent,legal |
| embed-36 | openai | text-embedding-3 | rag-indexer |
追问 R36 :若 smart-36 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R37: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-37 | azure | gpt-4o-mini | support,ops |
| smart-37 | bedrock | claude-3-5 | agent,legal |
| embed-37 | openai | text-embedding-3 | rag-indexer |
追问 R37 :若 smart-37 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R38: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-38 | azure | gpt-4o-mini | support,ops |
| smart-38 | bedrock | claude-3-5 | agent,legal |
| embed-38 | openai | text-embedding-3 | rag-indexer |
追问 R38 :若 smart-38 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R39: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-39 | azure | gpt-4o-mini | support,ops |
| smart-39 | bedrock | claude-3-5 | agent,legal |
| embed-39 | openai | text-embedding-3 | rag-indexer |
追问 R39 :若 smart-39 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R40: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-40 | azure | gpt-4o-mini | support,ops |
| smart-40 | bedrock | claude-3-5 | agent,legal |
| embed-40 | openai | text-embedding-3 | rag-indexer |
追问 R40 :若 smart-40 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R41: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-41 | azure | gpt-4o-mini | support,ops |
| smart-41 | bedrock | claude-3-5 | agent,legal |
| embed-41 | openai | text-embedding-3 | rag-indexer |
追问 R41 :若 smart-41 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R42: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-42 | azure | gpt-4o-mini | support,ops |
| smart-42 | bedrock | claude-3-5 | agent,legal |
| embed-42 | openai | text-embedding-3 | rag-indexer |
追问 R42 :若 smart-42 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R43: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-43 | azure | gpt-4o-mini | support,ops |
| smart-43 | bedrock | claude-3-5 | agent,legal |
| embed-43 | openai | text-embedding-3 | rag-indexer |
追问 R43 :若 smart-43 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R44: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-44 | azure | gpt-4o-mini | support,ops |
| smart-44 | bedrock | claude-3-5 | agent,legal |
| embed-44 | openai | text-embedding-3 | rag-indexer |
追问 R44 :若 smart-44 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R45: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-45 | azure | gpt-4o-mini | support,ops |
| smart-45 | bedrock | claude-3-5 | agent,legal |
| embed-45 | openai | text-embedding-3 | rag-indexer |
追问 R45 :若 smart-45 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R46: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-46 | azure | gpt-4o-mini | support,ops |
| smart-46 | bedrock | claude-3-5 | agent,legal |
| embed-46 | openai | text-embedding-3 | rag-indexer |
追问 R46 :若 smart-46 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R47: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-47 | azure | gpt-4o-mini | support,ops |
| smart-47 | bedrock | claude-3-5 | agent,legal |
| embed-47 | openai | text-embedding-3 | rag-indexer |
追问 R47 :若 smart-47 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R48: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-48 | azure | gpt-4o-mini | support,ops |
| smart-48 | bedrock | claude-3-5 | agent,legal |
| embed-48 | openai | text-embedding-3 | rag-indexer |
追问 R48 :若 smart-48 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R49: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-49 | azure | gpt-4o-mini | support,ops |
| smart-49 | bedrock | claude-3-5 | agent,legal |
| embed-49 | openai | text-embedding-3 | rag-indexer |
追问 R49 :若 smart-49 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
附录 R50: 路由别名演练
| alias | provider | model | feature_allowlist |
|---|---|---|---|
| fast-50 | azure | gpt-4o-mini | support,ops |
| smart-50 | bedrock | claude-3-5 | agent,legal |
| embed-50 | openai | text-embedding-3 | rag-indexer |
追问 R50 :若 smart-50 延迟超 SLO,fallback 顺序?答 :smart→fast→human(降质),并打点 degraded_route=true。
99. 冲刺
99.2 冲刺 Q&A(T01--T40)
| ID | Q | A(brief) | 锚点 |
|---|---|---|---|
| T01 | 网关题1 | 见 §3--§9 | §2 |
| T02 | 网关题2 | 见 §3--§9 | §3 |
| T03 | 网关题3 | 见 §3--§9 | §4 |
| T04 | 网关题4 | 见 §3--§9 | §5 |
| T05 | 网关题5 | 见 §3--§9 | §6 |
| T06 | 网关题6 | 见 §3--§9 | §7 |
| T07 | 网关题7 | 见 §3--§9 | §8 |
| T08 | 网关题8 | 见 §3--§9 | §9 |
| T09 | 网关题9 | 见 §3--§9 | §1 |
| T10 | 网关题10 | 见 §3--§9 | §2 |
| T11 | 网关题11 | 见 §3--§9 | §3 |
| T12 | 网关题12 | 见 §3--§9 | §4 |
| T13 | 网关题13 | 见 §3--§9 | §5 |
| T14 | 网关题14 | 见 §3--§9 | §6 |
| T15 | 网关题15 | 见 §3--§9 | §7 |
| T16 | 网关题16 | 见 §3--§9 | §8 |
| T17 | 网关题17 | 见 §3--§9 | §9 |
| T18 | 网关题18 | 见 §3--§9 | §1 |
| T19 | 网关题19 | 见 §3--§9 | §2 |
| T20 | 网关题20 | 见 §3--§9 | §3 |
| T21 | 网关题21 | 见 §3--§9 | §4 |
| T22 | 网关题22 | 见 §3--§9 | §5 |
| T23 | 网关题23 | 见 §3--§9 | §6 |
| T24 | 网关题24 | 见 §3--§9 | §7 |
| T25 | 网关题25 | 见 §3--§9 | §8 |
| T26 | 网关题26 | 见 §3--§9 | §9 |
| T27 | 网关题27 | 见 §3--§9 | §1 |
| T28 | 网关题28 | 见 §3--§9 | §2 |
| T29 | 网关题29 | 见 §3--§9 | §3 |
| T30 | 网关题30 | 见 §3--§9 | §4 |
| T31 | 网关题31 | 见 §3--§9 | §5 |
| T32 | 网关题32 | 见 §3--§9 | §6 |
| T33 | 网关题33 | 见 §3--§9 | §7 |
| T34 | 网关题34 | 见 §3--§9 | §8 |
| T35 | 网关题35 | 见 §3--§9 | §9 |
| T36 | 网关题36 | 见 §3--§9 | §1 |
| T37 | 网关题37 | 见 §3--§9 | §2 |
| T38 | 网关题38 | 见 §3--§9 | §3 |
| T39 | 网关题39 | 见 §3--§9 | §4 |
| T40 | 网关题40 | 见 §3--§9 | §5 |
下一步:§0 → §3 五层 → §4 对比 → 07 §10 → 27 §7.3。
官方文档与源码(一级依据)
AI Engineering · 正文机制应来自下方 官方文档(L1) 与 官方源码仓库(L2) ;
禁止用教程站/博客充当机制依据。本章 QPS/延迟/STAR 为面试示意。
L1 · 官方文档
L2 · 官方源码
L3 · 论文 / 开放规范