Model Gateway|模型网关
非敏感配置受控编辑 · Route/Profile server-side 更新 · Key 只读脱敏
Route / Profile 支持受控编辑;调用日志与摘要基于 model_call_logs 聚合;成本字段为 Estimated cost(Estimate only, not billing-grade)。
Provider 3Routes 4Profiles 3Today calls 1Success / Failed / Skipped 0 / 1 / 0Input tokens —Output tokens —Avg latency 2519msEstimated cost Not estimatedRecent errors 1Key 2/3 healthyData source Connected databaseEnvironment db
RoutesProvidersProfilesModule UsageLogsCostSecurity
数据来源:Connected database。Read-only snapshot from 预发布 staging.
Routes 主表
| 路由 | 状态 | 风险 | 归属模块 | 主 Profile | Fallback | 成本上限 | 更新时间 | 短说明 | 编辑(非敏感) |
|---|---|---|---|---|---|---|---|---|---|
Book Review Long book_review_long | testing | - | content_marketing | qwen_content_main | deepseek_low_cost | — | 2026-05-24 06:56Z | v1 seed route | MG2-P6B staging route switched to qwen_content_main for real validation | 编辑 |
Book Review Short book_review_short | testing | - | content_marketing | openai_review_main | deepseek_low_cost | — | 2026-05-23 13:29Z | v1 seed route | 编辑 |
DocOps Summary docops_summary | testing | - | docops | qwen_content_main | deepseek_low_cost | — | 2026-05-23 13:29Z | v1 seed route | 编辑 |
Task Planner Default task_planner_default | testing | - | task_bridge | qwen_content_main | deepseek_low_cost | — | 2026-05-23 13:29Z | v1 seed route | 编辑 |
Provider Health Check
只读诊断:检查 route/profile/provider 配置与 runtime env;Provider ping 仅在 staging/local 手动触发,不写 DB、不展示 Key。
fallback 数据源下禁用;production 拒绝 provider ping。
API Key Governance
只读治理:展示 provider / profile / secret_ref / env 变量名关系;仅显示 env set/missing,不展示 Key 值、不写入 DB、不触发 rotation。
| Provider | Profile | Secret Ref | Masked Hint | Secret Status | Env Variable | Env Status | Rotation Status | Action Hint |
|---|---|---|---|---|---|---|---|---|
| deepseek | deepseek_low_cost | DEEPSEEK_API_KEY | ds-...needs_rotation | needs_rotation | DEEPSEEK_API_KEY | set | needs_rotation | rotate manually |
| openai | openai_review_main | OPENAI_API_KEY | sk-...configured | configured | OPENAI_API_KEY | set | ok | ok |
| qwen | qwen_content_main | QWEN_API_KEY | qwen-...configured | configured | DASHSCOPE_API_KEY QWEN_API_KEY | mixed | ok | check staging env |
Rotation checklist(只读说明)
- Confirm target environment: staging / production
- Create new key in provider console
- Update env source manually
- Restart runtime if required
- Run Provider Health Check
- Run fallback dry-run if route has fallback
- Verify no secret leak
- Record audit note manually
Fallback Dry Run
只读判定:模拟 primary 失败后是否允许 fallback;不写 DB、不调用 fallback provider、不展示 Key。
Dry-run invocation
此操作只写入 model_call_logs skipped 记录,不调用真实模型 API,不读取 API Key。
Profiles 配置
| Profile | Provider | Model ID | 状态 | 温度 | Max Tokens | Cost Tier | Purpose | 说明 | 更新时间 | 编辑(非敏感) |
|---|---|---|---|---|---|---|---|---|---|---|
DeepSeek Low Cost deepseek_low_cost | deepseek | deepseek-chat | testing | 0.60 | 2048 | low | low-cost fallback tasks | v1 seed profile | 2026-05-24 04:31Z | 编辑 |
OpenAI Review Main openai_review_main | openai | gpt-4o-mini | testing | 0.70 | 4096 | medium | book review generation | v1 seed profile | 2026-05-23 13:29Z | 编辑 |
Qwen Content Main qwen_content_main | qwen | qwen-plus | testing | 0.80 | 4096 | medium | content marketing drafts | v1 seed profile | 2026-05-23 13:29Z | 编辑 |
Provider 摘要
DeepSeek · testing
provider_key: deepseek
base_url: https://api.deepseek.com/v1
notes: v1 seed provider
OpenAI · testing
provider_key: openai
base_url: https://api.openai.com/v1
notes: v1 seed provider
Qwen · testing
provider_key: qwen
base_url: https://dashscope.aliyuncs.com/compatible-mode/v1
notes: v1 seed provider
Key 引用(只读脱敏)
| provider_key | secret_name | masked_hint | status | last_checked_at | last_checked_status |
|---|---|---|---|---|---|
| deepseek | DEEPSEEK_API_KEY | ds-...needs_rotation | needs_rotation | - | - |
| openai | OPENAI_API_KEY | sk-...configured | configured | - | - |
| qwen | QWEN_API_KEY | qwen-...configured | configured | - | - |
Cost Pricing Rules
Estimate only, not billing-grade. Pricing rules require manual confirmation before estimated_cost is calculated.
| Provider | Model | Currency | Input price / 1M | Output price / 1M | Pricing status | Cost estimate readiness | Source | Notes |
|---|---|---|---|---|---|---|---|---|
| deepseek | deepseek-chat | USD | — | — | needs_review | Needs review | manual | Placeholder until manual price confirmation; not used for estimation. |
| qwen | qwen-plus | USD | — | — | needs_review | Needs review | manual | Placeholder until manual price confirmation; not used for estimation. |
Production Canary / Daily-use Readiness
只读状态:production 默认仍 blocked;MG-PROD-P2A canary-only runtime guard 已补齐,仅服务 one-shot script 路径。`HB_MODEL_GATEWAY_PRODUCTION_CANARY_ENABLED` 不是 daily-use 开关;本区块无 generate / execute / retry 操作。
风险说明与 next step
Production remains blocked by default; one-shot canary requires P2A guard + P3 approval + short-lived canary env gate.
Next allowed step: Set HB_MODEL_GATEWAY_PRODUCTION_CANARY_ENABLED=1 only during MG-PROD-P3 window
| Field | Value | Status |
|---|---|---|
| current_stage | MG-PROD-P2A | planned |
| production_execution | blocked | blocked |
| production_canary_gate | missing | not_ready |
| runtime_guard | canary_execution_surface_ready | canary_execution_surface_ready |
| next_allowed_step | Set HB_MODEL_GATEWAY_PRODUCTION_CANARY_ENABLED=1 only during MG-PROD-P3 window | pending |
| route_key | book_review_long | locked |
| source_module | content | locked |
| primary_profile | qwen_content_main | locked |
| provider / model | qwen / qwen-plus | locked |
| fallback | disabled for canary | disabled |
| max_calls | 1 | locked |
| script_path | scripts/model-gateway/run-production-canary-once.ts | implemented |
| script_status | implemented | ready |
| daily_use_status | not_enabled | not_enabled |
| content flag env | HB_MODEL_GATEWAY_CONTENT_ENABLED | name only |
| canary env var | HB_MODEL_GATEWAY_PRODUCTION_CANARY_ENABLED | name only; set/missing only |
| app env var | HB_APP_ENV | name only |
| reason | Production remains blocked by default; one-shot canary requires P2A guard + P3 approval + short-lived canary env gate. | |
最近调用日志
| 时间 | 模块 | Route | Provider / Profile / Model | 状态 | Latency | Input tokens | Output tokens | Estimated cost | Request summary | Response / Error |
|---|---|---|---|---|---|---|---|---|---|---|
| 2026-06-06 11:27Z | content | book_review_long | qwen / qwen_content_main / qwen-plus | failed | 2519ms | — | — | Not estimated | MG-PROD-P2B staging rehearsal execute-once; fixed prompt | Model Gateway text generation failed. |
| 2026-05-28 03:40Z | content | book_review_long | qwen / qwen_content_main / qwen-plus | success | 3666ms | 44 | 96 | Not estimated | mg2-p7-closeout flag-on runtime smoke | During the Gateway Closeout Check, all smoke detection and suppression systems were verified as fully operational and compliant with safety standards. No smoke sources, hazards, or obstructions were observed in the gateway area. Ventilation systems were confirmed functional, and fire extinguishers w... |
| 2026-05-25 10:15Z | content | book_review_long | qwen / qwen_content_main / qwen-plus | success | 14298ms | 2817 | 444 | Not estimated | book=Smoke Book 001; book_id=8f25e81a-8203-4b5b-8493-4ac6f7778c3d; angle=misconception_fix; strategy=auto; material_range=full_book; source_mode=metadata_only; ui_provider=qwen | # 封面像实验报告,读进去才发觉它在拆解“烟”这个字 第一次看见《Smoke Book 001》,我下意识把它塞进设计类工具书那一格——灰白封面上只印着斜体英文书名和作者缩写,排版冷得像一份未署名的实验室日志。我甚至没翻开,就认定它大概讲的是某种视觉系统、参数化烟雾模拟,或是用算法生成烟的形态学图谱。 结果翻开第一页,没有代码,没有坐标系,也没有任何一张烟的照片。它从一个被反复擦掉又重写的铅笔稿开始:同一缕烟,在不同人笔下,被画成螺旋、散点、拖尾、断续的线,甚至被写成“消散”“遮蔽”“未落定”这几个词。原来它不研究烟是什么,而研究人怎么“认出”烟——不是靠光学特征,而是靠它出现时周围事物的暂停... |
| 2026-05-25 09:57Z | content | book_review_long | qwen / qwen_content_main / qwen-plus | success | 5946ms | 44 | 191 | Not estimated | MG2-P7 staging usage-cost smoke | 《深度工作》(卡尔·纽波特著)是一本直击当代知识工作者核心困境的务实之作。作者犀利指出:在碎片化、即时反馈盛行的时代,能持续专注、高强度思考的能力正成为稀缺的认知资源。书中不仅剖析了“深度工作”的定义与价值——它并非苦修,而是经科学训练可习得的高产出状态;更提供了切实可行的四大准则:工作哲学选择、习惯化实践、仪式感构建与干扰隔离策略。尤为可贵的是,纽波特不鼓吹盲目加班,而强调“节奏型”或“双峰型”等适配个体节律的工作模式,并以大量真实案例(如作家、科学家、程序员)佐证其有效性。读罢令人豁然:所谓高效,不在忙碌表象,而在心流之下的刻意沉淀——这既是一种工作方式,更是一种清醒而有力的生活姿态。 |
| 2026-05-24 07:43Z | content | book_review_long | qwen / qwen_content_main / qwen-plus | success | 12336ms | — | — | Not estimated | book=佛教世界观; book_id=b809cd6f-05ba-4952-b95e-cc751749b68b; angle=misconception_fix; strategy=auto; material_range=full_book; source_mode=imported_book_text; ui_provider=qwen | # 封面写着“佛教”,我却把它当成了哲学教材 第一次在书店看见《佛教世界观》这本,书名下印着“明贤法师著”,封面素净,排版规整,纸张厚实。我下意识把它归到“哲学普及读物”那一类——像讲康德或维特根斯坦的书那样,用现代语言重述古老思想,好让没读过原典的人也能搭个梯子上去。 结果翻开第一章,就卡住了。它不从“什么是佛教”开始,也不解释“四圣谛”“八正道”这些常识性框架,而是直接问:你此刻看见的这张纸,是独立存在的,还是依赖于你的眼睛、光线、记忆、命名习惯才成为“纸”的?这个问题不是比喻,它后面跟着三页对视觉神经传导路径的拆解,又立刻转回《中论》里“眼不见色”的古训。我原以为它会用哲学语言翻译佛教,... |
| 2026-05-24 07:02Z | content | book_review_long | qwen / qwen_content_main / qwen-plus | success | 14847ms | — | — | Not estimated | book=佛教世界观; book_id=b809cd6f-05ba-4952-b95e-cc751749b68b; angle=misconception_fix; strategy=auto; material_range=full_book; source_mode=imported_book_text; ui_provider=qwen | # 封面写着“佛教”,我却把它当成了哲学入门读物 第一次在书店看见《佛教世界观》这本,书名下印着“明贤法师著”,封面素净,没有佛像,没有莲花,倒像某套大学通识丛书里的一册。我下意识把它归到“给对佛教好奇但没基础的人写的导论”那一类——类似《十分钟读懂禅宗》那种,准备快速扫一眼,确认几个概念就放回架上。 结果翻开第一章,就卡住了。它没讲“什么是佛”“三宝是什么”,也没从四圣谛、十二因缘开始铺陈。它直接问:你此刻看到的这张纸,是“纸”本身,还是你眼识、意识、习气共同参与造出来的“纸相”?这个问法让我停住,不是因为它深奥,而是它绕开了所有我对“佛教书”的预设路径——它不提供答案,只拆解“你正在用什么... |
| 2026-05-24 06:07Z | content | book_review_long | openai / openai_review_main / gpt-4o-mini | failed | 77ms | — | — | Not estimated | book=佛教世界观; book_id=b809cd6f-05ba-4952-b95e-cc751749b68b; angle=misconception_fix; strategy=auto; material_range=full_book; source_mode=imported_book_text; ui_provider=qwen | Model Gateway provider key is not configured in current runtime. |
| 2026-05-24 05:47Z | system | book_review_long | openai / openai_review_main / gpt-4o-mini | skipped | 0ms | 0 | 0 | $0.000000 | MG2-P5 closeout browser dry-run; no real model call | Model Gateway dry-run only; no real model API call |
| 2026-05-24 04:46Z | system | book_review_long | openai / openai_review_main / gpt-4o-mini | skipped | 0ms | 0 | 0 | $0.000000 | MG2-P5 browser dry-run invocation; no real model call | Model Gateway dry-run only; no real model API call |
| 2026-05-24 04:40Z | system | book_review_long | openai / openai_review_main / gpt-4o-mini | skipped | 0ms | 0 | 0 | $0.000000 | MG2-P5 dry-run invocation; no real model call | Model Gateway dry-run only; no real model API call |
| 2026-05-23 13:29Z | system | book_review_long | openai / openai_review_main / gpt-4.1 | skipped | 0ms | 0 | 0 | $0.000000 | staging migration smoke only; no real model call | migration smoke inserted successfully |
安全边界:本页只允许编辑 `model_routes` / `model_profiles` 的非敏感字段,写入仅走 server-side 且 production 环境拒绝;`model_secret_refs` 保持只读脱敏展示,不读取、不写入真实 API Key,不接真实模型 API。