# All files / src model_aliases.ts

100% Statements 10/10
100% Branches 6/6
100% Functions 1/1
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34

    110x
    1x

    109x

    109x
    49x
    43x
    43x
    43x

    66x
    66x

     import aliases from "./aliases.js";

    import { logger } from "./utils/logger.js";

    export type ProviderName =
      | "openai"
      | "anthropic"
      | "gemini"
      | "vertexai"
      | "openrouter"
      | "mistral"
      | "deepseek"
      | "bedrock"
      | string;

    export function resolveModelAlias(alias: string, provider?: ProviderName): string {
      if (!provider) {
        return alias;
      }

      const aliasEntry = (aliases as Record<string, Record<string, string>>)[alias];

      if (aliasEntry) {
        if (aliasEntry[provider.toLowerCase()]) {
          const resolved = aliasEntry[provider.toLowerCase()] as string;
          logger.debug(`Resolved model alias '${alias}' → '${resolved}' for provider '${provider}'`);
          return resolved;
        }
      }

      logger.debug(`No alias mapping found for '${alias}' with provider '${provider}', using as-is`);
      return alias;
    }