feat(ai): fetch the Claude model list and offer Latest choices (#46) #52

Manually merged
jfro merged 1 commit from feat/46-models into main 2026-11-10 21:28:43 +00:00
Owner

Closes #46.

Two parts, as decided:

  • The model list comes from the Anthropic API. GET /v1/models with the saved Claude API key, newest first, kept for a day (retried after an hour when it fails). The fetch runs in the background, so pages never wait on it. Until it's fetched, or with no Claude API key saved, a built-in list is used. That list now includes Claude Haiku 5.5 and Claude Fable 5.2. Saving a new Claude API key fetches the list again. Claude Code uses the same list and never sends its subscription token to the API.
  • Latest Opus, Sonnet, Haiku and Fable choices. These are stored as latest:<family> and resolved on each request. The Claude API asks for the family's newest model in the list. Claude Code gets its own opus/sonnet/haiku/fable alias. Each label shows what the choice points to now, like "Latest Opus (Claude Opus 5.5)". Latest Opus is the default for a new provider. Saved settings are left as they are.

The chat's model picker uses the same list, so it gets the Latest choices too.

New code is in lib/lamplighter/ai/providers/claude_models.ex. There are no new settings, env vars or dependencies (tests turn the background fetch off with the fetch_models: false app config).

mix precommit passes (827 tests).

Screenshots (example data, built-in list)

ai-settings-desktop
ai-settings-desktop

ai-models-desktop
ai-models-desktop

ai-settings-390
ai-settings-390

ai-models-390
ai-models-390

Closes #46. Two parts, as decided: - **The model list comes from the Anthropic API.** `GET /v1/models` with the saved Claude API key, newest first, kept for a day (retried after an hour when it fails). The fetch runs in the background, so pages never wait on it. Until it's fetched, or with no Claude API key saved, a built-in list is used. That list now includes Claude Haiku 5.5 and Claude Fable 5.2. Saving a new Claude API key fetches the list again. Claude Code uses the same list and never sends its subscription token to the API. - **Latest Opus, Sonnet, Haiku and Fable choices.** These are stored as `latest:<family>` and resolved on each request. The Claude API asks for the family's newest model in the list. Claude Code gets its own `opus`/`sonnet`/`haiku`/`fable` alias. Each label shows what the choice points to now, like "Latest Opus (Claude Opus 5.5)". Latest Opus is the default for a new provider. Saved settings are left as they are. The chat's model picker uses the same list, so it gets the Latest choices too. New code is in `lib/lamplighter/ai/providers/claude_models.ex`. There are no new settings, env vars or dependencies (tests turn the background fetch off with the `fetch_models: false` app config). `mix precommit` passes (827 tests). ### Screenshots (example data, built-in list) **ai-settings-desktop** ![ai-settings-desktop](https://git.knope.dev/attachments/507f8053-015e-49ea-95df-089df95785eb) **ai-models-desktop** ![ai-models-desktop](https://git.knope.dev/attachments/fa378306-0d9b-476b-a39e-b10a9cba38d8) **ai-settings-390** ![ai-settings-390](https://git.knope.dev/attachments/878a5c15-4eae-456e-9ca6-82b471a32180) **ai-models-390** ![ai-models-390](https://git.knope.dev/attachments/d330a9b9-d51f-47d4-81c8-26ad8b6ffdaa)
feat(ai): fetch the Claude model list and offer Latest choices per family
All checks were successful
CI / test (pull_request) Successful in 1m13s
4b85ca6509
jfro manually merged commit 3c89fc13a7 into main 2026-11-10 21:28:43 +00:00
Sign in to join this conversation.
No description provided.