Skip to content

AI model picker: carry each model's cost multiplier to the browser, show it per model, and confirm before switching to an expensive model #33660

Closed

Description

@objectstack-fleet

repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

The framework half of objectstack-ai/cloud#4536. The account owner wants the paid model picker opened on production, with Claude models only, on one condition: 「只要选择时能够看清楚倍数」, so that a person sees the multiplier at the moment of choice. Measured read-only at objectstack main c32bb6c and cloud main 3a9efce29: today the picker shows a label only.

维护者速读

  1. 问题:聊天和 Studio 里的模型选择器,每个模型只显示一个名字(比如「Advanced · Claude Sonnet 5」)。用户看不到倍数,看不到对剩余额度的影响,切换到贵的模型时也没有任何确认。
  2. 为什么:维护者要求开放付费版的模型选择时,用户在选的那一刻必须看清楚倍数。
  3. 修法:
    • 模型列表的接口增加一个可选的「倍数」字段,云端负责填;
    • 选择器在每个模型旁显示「×20」这样的倍数;
    • 结合现有的额度用量(百分比),提示大约还能用多少;
    • 切换到 20 倍及以上的模型时,确认一次。
  4. 验收:三个使用选择器的页面(AI 对话、对话侧栏、Studio 助手)都显示倍数,切换贵模型时都有确认;有测试覆盖。
  5. 范围:框架的接口定义和界面,加上云端一行(停止丢弃倍数),云端那行另开卡。
  6. 需要你做的:无。

Facts (file:line at the shas above)

  • Contract. packages/spec/src/api/protocol.zod.ts:4127-4142, AiModelsResponseSchema, is { id, label, default } or a bare string, plus defaultModel. It has no cost field.
  • Hook. ui/packages/plugin-chatbot/src/useAiModels.ts:60-64: normalize keeps only id and label.
  • Picker.
    • ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx:1128-1132: ChatbotModelOption is { id, label?, provider? }.
    • :1175-1213, ModelPicker: it renders the label and provider, and onValueChange calls onPick at once (:1190-1194), with no confirm.
  • Hosts.
    • ui/packages/app-shell/src/console/ai/AiChatPage.tsx:2073 (wired at :2979)
    • ui/packages/app-shell/src/layout/ChatDockConversation.tsx:145
    • ui/packages/app-shell/src/views/studio-design/StudioAiCopilot.tsx:118
  • Allowance reading that already exists.
    • GET /api/v1/ai/usage, served by cloud, answers pool.fraction (0..1), already weighted per model. By rule D5 it answers no token counts.
    • ui/packages/app-shell/src/hooks/useAiUsage.ts and AiUsageIndicator.tsx read it.
    • A multiplier is a ratio, not a token count, so D5 does not forbid it. The owner's words above ask for it explicitly.

Change

  • Spec: add an optional costMultiplier (a positive number; the default model is 1) to the model entry of AiModelsResponseSchema. Document it as the factor by which one message on this model draws on the allowance compared with the default.
  • UI:
    • useAiModels keeps the field.
    • ChatbotModelOption carries it.
    • ModelPicker renders ×N beside each label. With useAiUsage it shows a plain-language note of what the pick does to the remaining allowance; the wording is the implementer's, and it must not invent token numbers.
    • A pick at ×20 or above asks once before applying, in all three hosts.
  • Tests and ablation.

Seam: spec: AiModelsResponseSchema model entry costMultiplier → runtime: cloud packages/service-ai/src/routes/ai-routes.ts GET /api/v1/ai/models fills it from cost_weight (cloud card, Blocked-by this one, once a release carries it).

Activity

  1. added
    enhancement
    on Nov 15, 2026
  2. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

    Priority raised 2026-11-15T05:05Z on the account owner's word in seat session session_01Q4EjjPP1zuWBNq3nBXVei9: 「模型选择相关卡都p1」. This card is one of the cards that open the paid model picker on production (cloud#4536): cloud#4438 (haiku-scale weights and doubled allowances), #33660 (the picker shows the multiplier), cloud#4537 (cloud fills the multiplier) and cloud#4536 itself.

  3. added
    priority:p1
    on Nov 15, 2026
  4. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:ui (lead) · p1 · 2026-11-15T05:45Z

    ⛔ Not a claim.

    Framework half of objectstack-ai/cloud#4536: the account owner opens the paid model picker on production on one condition, 「只要选择时能够看清楚倍数」. The pre-grade p1 is confirmed: it gates a production launch. The served half (each model's cost multiplier on the model list) is a small server change in the same PR, or split it if the ui seat prefers. Confirm before switching to an expensive model.

  5. added
    domain:ui
    pm:queue
    on Nov 15, 2026
  6. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Claim: PM loop round 1 · 2026-11-15T06:41Z
    Session: session_01FEkQ5pX4G6G9ZLeRqSRoFu (card thread, dev) · seat session_01FEkQ5oF8GgTHN2jBZoDwz8
    Account: os-project-manager
    Branch: claude/project-thread-cv4ljj
    Worktree: objectstack-issue-33660
    Domain: domain:ui
    Seat: domain:ui#2
    File surface: packages/spec/src/api/protocol.zod.ts and its tests, generated baselines and docs; packages/runtime/src/domains/ai.ts (only if it is a producer); ui/packages/plugin-chatbot/src/** (useAiModels, ChatbotEnhanced ModelPicker); ui/packages/app-shell/src/console/ai/AiChatPage.tsx, ui/packages/app-shell/src/layout/ChatDockConversation.tsx, ui/packages/app-shell/src/views/studio-design/StudioAiCopilot.tsx; the i18n packs the picker uses; their tests; root .changeset/. ⛔ No cloud edit. ⛔ Serial: edits wait for seat 2's PR #33673 (same ChatbotEnhanced.tsx / AiChatPage.tsx) to merge.
    Container & model: L, mode:thread, model: default tier, effort: default
    Clause-②: yes (widening) — @objectstack/spec AiModelsResponseSchema model entry gains optional costMultiplier, and @object-ui/plugin-chatbot ChatbotModelOption (and any new ChatbotEnhanced prop) carries it; a published schema is touched, so a CONTRACT_REVIEW_TIER record is owed
    Metadata-protocol: none
    Responsibility: the AI model picker shows a label only: no cost multiplier, no allowance note, no confirm before an expensive model | useAiModels keeps only id and label; the spec model entry has no cost field | a person choosing a paid model on production (cloud#4536 launch condition 「只要选择时能够看清楚倍数」)
    Thread-read: 6889924748
    Premise: holds: read on main by the card author (file:line facts in the card body); triage#1 first touch 6889924748 confirmed p1
    Serial constraints cleared: no other pm:dispatched domain:ui card claims a file in this surface (live label read; ui seat 1's live PRs #33671 #33677 #33679 are disjoint; ui seat 1 agreed this card is seat 2's); no other ui seat holds a Claim: on these files

    Scope: p1. Order: /mnt/project-files/pm-orders/ui/order-33660.md. Summons: the maintainer's 「同意 给队列最深的 ui 和 spec 各再开一个座位」 (this project, 2026-11-14T22:46Z) and 「任务进展如何,后续只处理 p1 p2」 (2026-11-15T05:05Z).

  7. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 15, 2026
  8. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-project-manager · session_01FEkQ5pX4G6G9ZLeRqSRoFu

    os-dev-report
    {
    "issue": 33660,
    "status": "done",
    "branch": "claude/project-thread-cv4ljj",
    "pr": "#33746",
    "session": "session_01FEkQ5pX4G6G9ZLeRqSRoFu",
    "premise_still_valid": true,
    "summary": "AiModelsResponseSchema's model entry gains an optional positive costMultiplier whose .describe() names its producer, cloud service-ai's GET /api/v1/ai/models (nothing in this repo answers /ai/models: runtime domains/ai.ts only dispatches to the AI service's route table, so no framework number is filled). useAiModels keeps it, ChatbotModelOption carries it, and the shared ModelPicker draws ×N per model (none when absent), notes the share of the allowance left from /ai/usage pool.fraction when served, and asks once (AlertDialog) before a pick at ×20 or above applies; Cancel keeps the model. ChatPane reads useAiUsage only when a model carries a multiplier and passes allowanceUsedFraction, so the /ai page, the console dock and the Studio copilot (all ChatPane hosts) get it with no change of their own. Published widenings: spec AiModelsResponseSchema entry costMultiplier; plugin-chatbot ChatbotModelOption.costMultiplier and ChatbotEnhancedProps.allowanceUsedFraction.",
    "tests": "Head 387c179 (0fcd2cf + one regenerated zh-Hant string). New: AiChatPage.modelCostMultiplier-33660.test.tsx (three real hosts x 5 pins: multipliers drawn / none for the model without one; x20 asks, Cancel keeps, Confirm switches; CONTROL x5 at once; note with usage 0.4 reads 60%; CONTROL no note when /ai/usage 404) 15/15; ChatbotEnhanced.modelCostMultiplier-33660.test.tsx 11/11; spec protocol.test.ts accepts 20 and 0.5, refuses 0, -1, '20', NaN, entry without it parses (256/256 with type-alias-convention pin). Existing ChatbotEnhanced.modelPicker-11865 exact-textContent pins green unchanged. Suites from ui/ on 0fcd2cf over plugin-chatbot, app-shell console/ai, layout, studio-design, hooks, i18n: 829 files, 7587 passed, 1 failed (zh-hant-generated.test.ts: zh-Hant is generated from zh-Hans) -> gen:zh-hant, committed 387c179; i18n + both pin files rerun on 387c179: 104 files, 1920 passed (lock VERDICT command-exit 0). Ablations via scripts/ablation-replace.mjs on 0fcd2cf (src-aliased, no rebuild), each restored blob == HEAD and git diff HEAD empty, over both pin files (26 tests): no confirmation 7 failed/19 passed; no x-N rendering 12/14; hook drops costMultiplier 15/11; ChatPane passes no allowanceUsedFraction 3/23.",
    "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack: 115 families on tree 387c179, all 115 exit 0 (codes captured before any pipe); --ran: 115 derived, 115 run, 0 NOT-MEASURED, 0 UNRUN. Round 1 on 0fcd2cf had three exit-3 prerequisite reads (teardown-shape --self-test shallow fixture, dual-build-cjs-loads missing dists, type-check-debt lock queue-timeout), all exit 0 in round 2. spec check:generated: only check:docs stale -> --fix regenerated content/docs/references/api/protocol.mdx; authorable-surface unchanged (Metadata-protocol: none holds). plugin-chatbot and app-shell type-check exit 0; eslint --no-inline-config on changed files exit 0; check:new-line-citations exit 0. CI check-runs: in_progress at report time (seat reads them).",
    "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
    "line_budget": "about 718 changed lines excluding the regenerated protocol.mdx: production ~200, pins 392, i18n 89 (all 11 packs), changeset 17, docs 5, spec 18. Over ~600; seat agreed one PR (overage = pins + forced i18n parity).",
    "files_changed": [
    ".changeset/33660-ai-model-picker-cost-multiplier.md",
    "content/docs/frontend/plugins/plugin-chatbot.mdx",
    "content/docs/references/api/protocol.mdx",
    "packages/spec/src/api/protocol.test.ts",
    "packages/spec/src/api/protocol.zod.ts",
    "ui/packages/app-shell/src/console/ai/AiChatPage.tsx",
    "ui/packages/app-shell/src/console/ai/tests/AiChatPage.modelCostMultiplier-33660.test.tsx",
    "ui/packages/i18n/src/locales/{ar,de,en,es,fr,ja,ko,pt-BR,ru,zh-Hans,zh-Hant}.ts",
    "ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx",
    "ui/packages/plugin-chatbot/src/tests/ChatbotEnhanced.modelCostMultiplier-33660.test.tsx",
    "ui/packages/plugin-chatbot/src/useAiModels.ts"
    ],
    "deviations": [
    "i18n keys written to all 11 packs, not only en + zh-CN: all-locales-key-parity.test.ts requires every pack to define every en key; zh-Hant is generated (gen:zh-hant).",
    "ChatDockConversation.tsx and StudioAiCopilot.tsx are unchanged: both render ChatPane, which now reads usage and renders the shared picker; their pins drive them through the real host.",
    "content/docs/frontend/plugins/plugin-chatbot.mdx gained one Features bullet (ui AGENTS.md #2 docs-driven); not named in the order's file surface.",
    "Local suites narrowed to the touched packages and app-shell AI directories; the full app-shell and spec suites are CI's.",
    "pr_create sent no assignees per the order and AGENTS.md; os-dev.md rule text still lists assignees in the pr_create write (known conflict)."
    ],
    "mcp_calls": "4 — mcp__github__issue_read (get, get_comments x2), mcp__github__pull_request_read (get #33673); reads only",
    "api_writes": "2 — relay pr_create (#33746, run 43696342896) and this os-dev-report comment via post-stamped; plus 2 git pushes (not REST)",
    "open_questions": [],
    "security_findings": "none",
    "out_of_scope_findings": [
    "carrier: cloud · cloud service-ai GET /api/v1/ai/models must fill costMultiplier from cost_weight (card comment names cloud#4537); until it does the picker looks as before. Seat files/links it Blocked-by #33660."
    ]
    }


    Generated by Claude Code

  9. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Seat review: PR #33746 ACCEPT on head 8e2c2d79 (2026-11-15T10:53Z). K was synced, CI is green, and ready + auto-merge are set in the same stroke. Contract records at CONTRACT_REVIEW_TIER: PASS 6891993315, delta PASS 6892455683, delta-2 PASS 6892921764. The cloud producer is cloud#4537.

  10. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Landed · 2026-11-15T11:50Z

    reading value
    PR #33746 MERGED as 0feb5fff on main (closes this card via Fixes #33660)

    State: pm:dispatched removed, assignee cleared; card closed by the merge. The seat ACCEPT is 6893248551. Contract records at CONTRACT_REVIEW_TIER:

    • 6891993315, PASS;
    • 6892455683, delta PASS;
    • 6892921764, delta-2 PASS;
    • 6893735002, review#1's merge-delta PASS.

    The model picker now draws each model's costMultiplier and asks before a pick at a drawn ×20 or above. ⛔ It stays dark until the producer writes the member: cloud service-ai's GET /api/v1/ai/models is owed on cloud#4537 (Blocked-by this card). That card can cite the spec's describe for the default-is-1 normalisation.

  11. removed
    pm:dispatched
    on Nov 15, 2026
  12. added a commit that references this issue on Nov 16, 2026
    0feb5ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:uienhancementpriority:p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions