Skip to content

Add favorite models and pricing to model selector#21

Open
GSmithBoltz wants to merge 1 commit into
beradeep:masterfrom
GSmithBoltz:feature/favorite-models-and-pricing
Open

Add favorite models and pricing to model selector#21
GSmithBoltz wants to merge 1 commit into
beradeep:masterfrom
GSmithBoltz:feature/favorite-models-and-pricing

Conversation

@GSmithBoltz

@GSmithBoltz GSmithBoltz commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What

Two related improvements to the model selection sheet (used by both the chat top bar and the Settings default-model picker):

  1. Favorite models — each model row now has a star toggle. Favorited models are pinned to the top of the list (and stay on top within search results). Favorites are persisted in MMKV (favorite_models key) and exposed as a Flow from ModelRepository, so both screens stay in sync live — same pattern as the font-size settings.

  2. Per-model pricing — the sheet now shows OpenRouter input/output token cost on each row, e.g. deepseek-v4-pro $0.44/M in | $0.87/M out. Free models show Free; models with dynamic pricing (e.g. openrouter/auto, which reports -1) show nothing. To get pricing, getModels() now fetches /api/v1/models directly with ktor and parses it with kotlinx.serialization instead of going through the openai-kotlin client, which drops the pricing field. Side benefit: the models list loads even before an API key is set, since the endpoint is public.

Implementation notes

  • New dependency: ktor-client-core in :data (version managed by the existing openai-client BOM, same as the already-present ktor-client-okhttp).
  • Model/ModelEntity gain nullable inputPricePerMillion/outputPricePerMillion fields with defaults, so previously stored default-model JSON still deserializes fine.
  • UI uses only basics components (IconButton, Icon, Text), mirroring the star pattern from ChatOptions.
  • No migrations, no new permissions.

Testing

  • :app:compileDebugKotlin, testDebugUnitTest, and :app:assembleDebug all pass.
  • ktlintCheck passes for :domain, :data, and :app. The :ui check reports only violations that already exist on master (Slider.kt, MessageBubble.kt, SettingsScreen.kt import order) — this change adds none.
  • Manually tested on a physical device: starring/unstarring, pinning order, search interaction, persistence across restart, and pricing display in both the chat sheet and Settings.

Screenshot

Model selection sheet showing favorited models pinned to the top with star toggles and per-model input/output pricing

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant