/ utils / model / aliases.ts
aliases.ts
 1  export const MODEL_ALIASES = [
 2    'sonnet',
 3    'opus',
 4    'haiku',
 5    'best',
 6    'sonnet[1m]',
 7    'opus[1m]',
 8    'opusplan',
 9  ] as const
10  export type ModelAlias = (typeof MODEL_ALIASES)[number]
11  
12  export function isModelAlias(modelInput: string): modelInput is ModelAlias {
13    return MODEL_ALIASES.includes(modelInput as ModelAlias)
14  }
15  
16  /**
17   * Bare model family aliases that act as wildcards in the availableModels allowlist.
18   * When "opus" is in the allowlist, ANY opus model is allowed (opus 4.5, 4.6, etc.).
19   * When a specific model ID is in the allowlist, only that exact version is allowed.
20   */
21  export const MODEL_FAMILY_ALIASES = ['sonnet', 'opus', 'haiku'] as const
22  
23  export function isModelFamilyAlias(model: string): boolean {
24    return (MODEL_FAMILY_ALIASES as readonly string[]).includes(model)
25  }