Improve: Update model selection to use aliases instead of specific versions#379
Open
austinbjohnson wants to merge 3 commits intowinfunc:mainfrom
Open
Improve: Update model selection to use aliases instead of specific versions#379austinbjohnson wants to merge 3 commits intowinfunc:mainfrom
austinbjohnson wants to merge 3 commits intowinfunc:mainfrom
Conversation
The ClaudeInstallation struct at line 224 was missing the required installation_type field, causing compilation failures. Added: installation_type: InstallationType::System This is a quick fix to resolve the build error. The NVM-discovered installations are treated as System type since they're found in the system's Node Version Manager. Fixes compilation error: 'missing field `installation_type` in initializer' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…rsions
Changes:
- Updated AgentExecution.tsx and CreateAgent.tsx UI to display 'Sonnet'
and 'Opus' instead of 'Claude 4 Sonnet' and 'Claude 4 Opus'
- Enhanced pricing logic in usage.rs to recognize both model aliases
('opus', 'sonnet') and full model names ('claude-opus-4', 'claude-sonnet-4')
- Added case-insensitive model name matching
- Updated cc_agents/README.md to reflect proper model alias usage per
Claude Code documentation
- Added comprehensive unit tests for calculate_cost function with alias
support (test_calculate_cost_with_aliases, test_calculate_cost_partial_tokens)
Rationale:
Claude Code recommends using model aliases (sonnet, opus) which
automatically map to the latest model versions, avoiding hardcoded
version numbers that become outdated. This aligns with best practices
from https://docs.claude.com/en/docs/claude-code/model-config#model-aliases
Testing:
- Manually tested agent execution with both 'opus' and 'sonnet' aliases
- Both models execute successfully and display correct alias names in UI
- Unit tests added but cannot run due to pre-existing compilation error
(now fixed in previous commit)
Backward Compatibility:
- Fully backward compatible: existing agents using full model names will
continue to work
- Pricing calculation now supports both aliases and full names via OR logic
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Applied automatic Rust code formatting via cargo fmt as per contribution guidelines. No functional changes, only formatting improvements for consistency. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
marlon-costa-dc
pushed a commit
to marlon-costa-dc/opcode
that referenced
this pull request
Jan 25, 2026
Updates model selection to use aliases instead of version numbers: - UI shows 'Sonnet' and 'Opus' with 'Uses latest X model' descriptions - Maintains i18n translations with fallbacks - calculate_cost now recognizes both aliases and full model names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Updates model selection UI and pricing logic to use Claude Code model aliases (
sonnet,opus) instead of hardcoded version numbers, following best practices from the Claude Code documentation.Changes
calculate_costfunction in usage.rs to recognize both model aliases ('opus', 'sonnet') and full model names ('claude-opus-4', 'claude-sonnet-4')test_calculate_cost_with_aliases,test_calculate_cost_partial_tokens)installation_typefield)Rationale
Claude Code recommends using model aliases which automatically map to the latest model versions, avoiding hardcoded version numbers that become outdated. This keeps the UI and cost calculations accurate as new model versions are released.
Testing
Backward Compatibility
Fully backward compatible. Existing agents using full model names (
claude-opus-4-20250514,claude-sonnet-4-5-20250929) will continue to work. The pricing calculation now supports both aliases and full names via OR logic.Commits
installation_typefield to ClaudeInstallation struct🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com