Skip to content

feat(mobile): show model picker costs - #4939

Merged
iscekic merged 4 commits into
mainfrom
model-picker-cost-048c
Aug 3, 2026
Merged

feat(mobile): show model picker costs#4939
iscekic merged 4 commits into
mainfrom
model-picker-cost-048c

Conversation

@iscekic

@iscekic iscekic commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

What

  • Shows gateway catalog input/output pricing per 1M tokens in mobile agent model-picker rows.
  • Hides prices for free, BYOK, zero, invalid, missing, and one-sided pricing.

Why

  • Lets users compare the catalog price before selecting a model without changing the compact selected-model pill.

How

  • Carries optional catalog pricing through mobile picker option types.
  • Adds tested formatting and free/BYOK suppression helpers.
  • Renders the cost line under the model ID and includes it in VoiceOver row labels.

Verification

  • cd apps/mobile && pnpm format && pnpm typecheck && pnpm lint && pnpm check:unused && pnpm test
  • git diff --check
  • Fresh cumulative implementation review: no findings.
  • iOS E2E: IOS-01 verified paid rows render In $… · Out $… per 1M tokens and include that text in the row accessibility label. IOS-02 verified Auto Free has no cost text or accessibility-label segment. VERIFICATION PASSED. on 2966a006627fd52b34c160fe64417dc47631f7ab.
  • CI is green and Kilobot approved the latest head; no review threads remain.

Visual Changes

After-only: the base branch did not have this cost line to capture in the same verified run.

iOS model picker with per-model cost

Non-goals

  • No backend or billing changes.
  • Collapsed model pill, session-list live cost, Kiloclaw picker, and backend ($$$$) name suffix remain unchanged.

@iscekic
iscekic requested a review from jeanduplessis July 31, 2026 19:15
@iscekic iscekic self-assigned this Jul 31, 2026
Comment thread apps/mobile/src/lib/hooks/use-available-models.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Since the last review at 2966a00, this branch only gained a main merge and an empty retrigger commit; no PR-owned source changed, and no findings remain.

Verification notes
  • Incremental range 2966a006..63f95b3a contains two commits: 31b27608 (merge of origin/main) and 63f95b3a (empty chore: retrigger kilobot review).
  • git diff 2966a006..63f95b3a -- apps/mobile/src is empty, so the merge introduced no conflict resolutions or edits to any file in gh pr diff --name-only.
  • The merged main changes (admin session-container telemetry, container capacity/metrics, model-experiment request partitions, migration 0201, cloud-agent-next usage context) are outside this PR's changed-file set and unrelated to the mobile model picker, so they carry no interaction risk with the pricing code.
  • Both prior inline threads on apps/mobile/src/lib/hooks/use-available-models.ts report line: null from the GitHub API, confirming the ModelResponse export warning is outdated and fixed; no active defect threads remain.
  • HEAD re-confirmed as 63f95b3a1aba1779ac248c42d9ea442e1d053b43 immediately before publishing.
  • Not run (read-only review): pnpm typecheck, pnpm lint, pnpm test, pnpm check:unused.
Files Reviewed (0 changed PR files in this increment)
  • No PR-owned files changed since 2966a00; previously reviewed scope was apps/mobile/src/components/agents/model-selector.tsx, apps/mobile/src/lib/hooks/use-available-models.ts, apps/mobile/src/lib/hooks/use-available-models.test.ts, apps/mobile/src/lib/hooks/use-session-model-options.ts, apps/mobile/src/lib/model-cost.ts, apps/mobile/src/lib/model-cost.test.ts, apps/mobile/src/lib/use-session-model-options.test.ts.
Previous Review Summaries (2 snapshots, latest commit 2966a00)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 2966a00)

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental change since 36028c8 only drops the export keyword from ModelResponse, resolving the previously reported knip unused-export warning with no new risk.

Verification notes
  • ModelResponse is now module-private and still referenced only inside use-available-models.ts (toModelOptions parameter, fetchModels return type, and the response.json() annotation), so the narrowed visibility cannot break any importer.
  • A repo-wide scan for ModelResponse under apps/mobile/src confirms no other file (including use-available-models.test.ts) imports the type.
  • toModelOptions remains exported while accepting a non-exported parameter type; this is valid TypeScript for an app package with no declaration emit.
  • The prior inline warning thread is now outdated on GitHub, consistent with the fix landing.
  • Not run (read-only review): pnpm typecheck, pnpm lint, pnpm test, pnpm check:unused.
Files Reviewed (1 file)
  • apps/mobile/src/lib/hooks/use-available-models.ts

Previous review (commit 36028c8)

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

The pricing formatting and suppression logic is sound; the only issue is a newly exported type with no cross-file consumer that knip will flag in CI.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/mobile/src/lib/hooks/use-available-models.ts 22 ModelResponse newly exported but never imported elsewhere; knip check:unused runs in CI and this is the only such export under src/lib/hooks
Verification notes
  • formatSide trailing-zero trim (/\.?0+$/) was traced against 120.00, 100.50, 1.00, 0.01, 20.10, and 1200.00; it never over-strips integer digits, and every asserted value in model-cost.test.ts matches the implementation including float-error cases (0.00012 * 1e6 = 120.00000000000001).
  • Non-string/null/"NaN" pricing values from the unvalidated /api/openrouter/models payload fall through Number.isFinite/<= 0 and hide the line rather than crashing, so the missing Zod parse at this boundary is pre-existing and not newly risky.
  • pricing reaches SessionModelOption via the existing ...rest spread in createGatewayOption, so the new carry-through test reflects real behavior.
  • Both new test files are matched by vitest.pure.config.ts includes, so vitest-project-coverage.test.ts stays green.
  • FlatList in model-picker-content.tsx has no getItemLayout/fixed row height, so the added cost line cannot desync row measurement.
  • Not run (read-only review): pnpm typecheck, pnpm lint, pnpm test, pnpm check:unused; the knip finding is inferred from config plus a repo-wide export-usage scan.
Files Reviewed (7 files)
  • apps/mobile/src/components/agents/model-selector.tsx - 0 issues
  • apps/mobile/src/lib/hooks/use-available-models.ts - 1 issue
  • apps/mobile/src/lib/hooks/use-available-models.test.ts - 0 issues
  • apps/mobile/src/lib/hooks/use-session-model-options.ts - 0 issues
  • apps/mobile/src/lib/model-cost.ts - 0 issues
  • apps/mobile/src/lib/model-cost.test.ts - 0 issues
  • apps/mobile/src/lib/use-session-model-options.test.ts - 0 issues

Fix these issues in Kilo Cloud


Reviewed by claude-opus-5 · Input: 26 · Output: 4.2K · Cached: 477.9K

Review guidance: REVIEW.md from base branch main

@iscekic

iscekic commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

(bot) E2E is blocked before verifier dispatch: two iOS bundle attempts reached Started 20 services then failed readiness with services not up: mobile, mobile. Both owned stacks, simulator claims, and slots were released; no product failure was observed.

@iscekic iscekic added the human-ready The PR is ready for human review. label Aug 1, 2026
@iscekic

iscekic commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

(bot) Follow-up: fresh iOS E2E completed on 2966a00. Paid rows rendered the per-1M cost and included it in VoiceOver labels; Auto Free omitted it. VERIFICATION PASSED. Screenshot and full evidence are in the PR description.

@iscekic
iscekic merged commit e815e35 into main Aug 3, 2026
21 checks passed
@iscekic
iscekic deleted the model-picker-cost-048c branch August 3, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

human-ready The PR is ready for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants