feat(ai): add --latest model version resolution support #11564
+217
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
When AI providers release new model versions (e.g., Anthropic's
claude-sonnet-4-5→claude-sonnet-5-0), users currently need to update model IDs throughout their entire codebase. This creates maintenance overhead and makes applications brittle to version changes.Summary
Added automatic model version resolution using
--latestsuffix (similar to Docker's:latesttag). Users can now reference models likeanthropic:claude-sonnet--latestwhich automatically resolves to the newest version defined in a centralized mapping file.Changes:
LATEST_VERSIONSmapping for major providers (Anthropic, OpenAI, Google, Mistral, DeepSeek, xAI, Cohere, Groq)resolveLatestVersion()function to handle version resolutionlanguageModel()method to use version resolutionManual Verification
pnpm build)--latestsuffixChecklist
pnpm changesetin the project root)Future Work
--latestsupport for other model types (embedding, image, transcription, speech)--stable,--experimental)LATEST_VERSIONSmappingRelated Issues
N/A - This is a new feature enhancement