Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions apps/opencode/src/cost-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,28 @@ import { Result } from '@praha/byethrow';
/**
* Model aliases for OpenCode-specific model names that don't exist in LiteLLM.
* Maps OpenCode model names to their LiteLLM equivalents for pricing lookup.
*
* GitHub Copilot uses dot notation (e.g., claude-opus-4.5) while LiteLLM uses
* hyphen notation (e.g., claude-opus-4-5). This mapping handles those differences.
*
* GitHub Copilot model names are sourced from: https://models.dev/api.json
*/
const MODEL_ALIASES: Record<string, string> = {
// GitHub Copilot uses dots, LiteLLM uses hyphens for Claude 4.5 models
'claude-opus-4.5': 'claude-opus-4-5',
'claude-sonnet-4.5': 'claude-sonnet-4-5',
'claude-haiku-4.5': 'claude-haiku-4-5',
// GitHub Copilot shorthand names for Claude 4 models
'claude-opus-4': 'claude-opus-4-20250514',
'claude-opus-41': 'claude-opus-4-1',
'claude-sonnet-4': 'claude-sonnet-4-20250514',
// GitHub Copilot Claude 3.x model names
'claude-3.5-sonnet': 'claude-3-5-sonnet-latest',
'claude-3.7-sonnet': 'claude-3-7-sonnet-latest',
// Extended thinking variant uses same pricing as base model
'claude-3.7-sonnet-thought': 'claude-3-7-sonnet-latest',
// Grok models require provider prefix
'grok-code-fast-1': 'xai/grok-code-fast-1',
// OpenCode uses -high suffix for higher tier/thinking mode variants
'gemini-3-pro-high': 'gemini-3-pro-preview',
};
Expand Down