Skip to content

refactor: make internal/models the single source of truth for models - #19

Merged
Mapleeeeeeeeeee merged 3 commits into
mainfrom
claude/model-registry-ssot
Sep 28, 2026
Merged

Mapleeeeeeeeeee merged 3 commits into
mainfrom
claude/model-registry-ssot

Conversation

@Mapleeeeeeeeeee

Copy link
Copy Markdown
Owner

Summary

  • Add internal/models holding every model's API ID, per-token pricing, aliases and the default models (DefaultBenchmark, DefaultCountTokens) in one registry.
  • --model help text and the unknown-model error are now generated from the registry instead of hand-written lists.
  • Remove ResolveModel, ModelConfig and the per-model PricingXxx / TokenCountModelXxx constants from internal/benchmark; cost.go and render.go use models.Pricing directly.
  • internal/tokens uses models.DefaultCountTokens.ID instead of its own hard-coded model ID string.
  • Move alias/pricing tests to internal/models, and add checks for duplicate names/IDs, duplicate family aliases, registered defaults and cache-read ratios.

Behavior

No behavior change. Aliases, default model (opus), pricing and the count_tokens default are unchanged from main.

Adding a model later

Declare it in internal/models/models.go, add it to registry, and update Family / the defaults if it becomes the newest in its family. docs/benchmark.md is the only place still updated by hand.

Test plan

  • gofmt clean
  • go vet ./...
  • go test ./...

🤖 Generated with Claude Code

https://claude.ai/code/session_01HX8KccseqQb2rUserM2BDT


Generated by Claude Code

Move pricing, model IDs, aliases and defaults out of internal/benchmark
and internal/tokens into a new internal/models package. ResolveModel,
flag help, and the unknown-model error are now derived from one
registry, and DefaultCountTokensModel references it instead of
duplicating an ID string. No behavior change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HX8KccseqQb2rUserM2BDT
Reference models.Pricing and models.DefaultCountTokens.ID directly
instead of re-exporting them, and trim redundant comments.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HX8KccseqQb2rUserM2BDT
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HX8KccseqQb2rUserM2BDT
@Mapleeeeeeeeeee
Mapleeeeeeeeeee merged commit 7a60e5c into main Sep 28, 2026
3 checks passed
@Mapleeeeeeeeeee
Mapleeeeeeeeeee deleted the claude/model-registry-ssot branch September 28, 2026 19:25
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.

2 participants