Auto-discovering Claude models and tracking the best one as the default
claudemodels-apimodel-selectionautomationllm-as-judgeoauthclaude-code
Hardcoded model lists go stale within weeks. TLDR's AI feature now discovers models from Anthropic's Models API, gates them by rule, and keeps a single "default model" pointer that a daily job moves forward when a better model for software development ships. Built September 2026.
Discovery chain
- claude-service
GET /modelscallshttps://api.anthropic.com/v1/modelsusing Claude Code's own OAuth login (token from~/.claude/.credentials.json, sent asAuthorization: Bearerwith headeranthropic-beta: oauth-2025-04-20), so no separate API key is needed. Cached 24 h; serves the stale cache if a refresh fails. Returns{id, display_name, created_at}newest first (the API's order; alias resolution depends on it). - The app's API turns that into choices: family chips (fable, opus, sonnet, haiku, plus the
newest id of any new family found by
^claude-([a-z]+)) and a full version list for pinning. Falls back to a static list when the service is unreachable. - The app caches the list per session (and clears it on session change).
Tag semantics
- Any bare
#claude-*tag or a family alias selects a model. #fableresolves server-side at trigger time to the newest discovered fable model (it picked upclaude-fable-5-1the day it appeared); opus, sonnet and haiku pass through as CLI-native aliases. Store the resolved id in the job metadata.- Gating is a rule (names containing
fableormythosare admin-only), so new models are covered without edits. See Securing a shared AI agent that other users can drive.
One pointer for "the default"
default_model in the service's config.json is the single source of truth, read fresh per request
and reported by GET /models. The app API uses it when a post names no model, falling back to a
server constant. Store the concrete id (claude-opus-5-5), not an alias: the CLI alias opus also
resolved to it, but an alias can move without anyone deciding.
UI rule (Justin): the default should not get its own chip; the matching family chip is simply preselected, and choosing "default" sends no model tag at all.
The updater (daily systemd user timer)
- List models. No unseen id: exit, zero tokens spent.
- Unseen id: run a headless
claude -pjudge with onlyWebSearchandWebFetchallowed and a JSON schema for its answer{best, confidence, reason, sources}. It researches official Anthropic sources. The judge cannot edit anything; the script does. - Switch only if
bestis in the discovered list, confidence ishigh, it differs from the current default, and a smoke run of the new model succeeds. - A switch rewrites the service config and Claude Code's
settings.jsonmodel(keeping a[1m]long-context suffix if the new model supports it), and posts the outcome where Justin will see it. - Manual modes:
--set <model>,--dry-run --force-judge. The running service only picks up code changes after a restart, so the message says when one is needed. See claude-service (ProcrastinAI's webhook runner for headless Claude).
Model lineup facts (as observed, 2026)
Released after older assistants' training cutoffs, so do not dismiss unfamiliar names; verify against
Anthropic's docs:
- Claude Fable 5 and Claude Mythos 5, released 2026-06-09 (Fable 5: $10 / $50 per million input /
output tokens at launch; disabled under zero-data-retention).
- Opus 4.8; Fable 5.1 (claude-fable-5-1, seen live 2026-08-28 to 09-03); Opus 5.5
(claude-opus-5-5), made the TLDR and Claude Code default on 2026-09-27 after the judge picked it
with high confidence.
Gotchas
- An unauthenticated
GET /modelsprobe logs a harmless 422. - The service queue is global: a test request queues behind real work; cancel tests with
DELETE /request/{id}.
See also
- claude-service (ProcrastinAI's webhook runner for headless Claude)
- Lifecycle of an async AI request (status machine, expiry, retries, failure)