aliases.ts
utils/model/aliases.ts
26
Lines
793
Bytes
5
Exports
0
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with modes. It contains 26 lines, 0 detected imports, and 5 detected exports.
Important relationships
Detected exports
MODEL_ALIASESModelAliasisModelAliasMODEL_FAMILY_ALIASESisModelFamilyAlias
Keywords
opusmodelmodel_aliasessonnetmodelaliasmodelinputallowlisthaikuincludeswhen
Detected imports
- No import paths detected.
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
export const MODEL_ALIASES = [
'sonnet',
'opus',
'haiku',
'best',
'sonnet[1m]',
'opus[1m]',
'opusplan',
] as const
export type ModelAlias = (typeof MODEL_ALIASES)[number]
export function isModelAlias(modelInput: string): modelInput is ModelAlias {
return MODEL_ALIASES.includes(modelInput as ModelAlias)
}
/**
* Bare model family aliases that act as wildcards in the availableModels allowlist.
* When "opus" is in the allowlist, ANY opus model is allowed (opus 4.5, 4.6, etc.).
* When a specific model ID is in the allowlist, only that exact version is allowed.
*/
export const MODEL_FAMILY_ALIASES = ['sonnet', 'opus', 'haiku'] as const
export function isModelFamilyAlias(model: string): boolean {
return (MODEL_FAMILY_ALIASES as readonly string[]).includes(model)
}