All files / web/src/utils models-dev-mapping.ts

3.22% Statements 2/62
100% Branches 0/0
0% Functions 0/1
3.22% Lines 2/62

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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 691x           1x                                                                                                                            
import { AIProvider } from '@shared/types/constants';
 
/**
 * Maps internal AIProvider enum values to models.dev provider identifiers
 * Returns null if no mapping exists
 */
export const mapAIProviderToModelsDev = (
  provider: AIProvider,
): string | null => {
  const mapping: Record<AIProvider, string | null> = {
    [AIProvider.AI21]: null,
    [AIProvider.ANTHROPIC]: 'anthropic',
    [AIProvider.ANYSCALE]: null,
    [AIProvider.AZURE_AI_FOUNDRY]: null,
    [AIProvider.AZURE_OPENAI]: null,
    [AIProvider.BEDROCK]: 'amazon-bedrock',
    [AIProvider.CEREBRAS]: 'cerebras',
    [AIProvider.COHERE]: 'cohere',
    [AIProvider.CORTEX]: null,
    [AIProvider.DASHSCOPE]: 'alibaba',
    [AIProvider.DEEPBRICKS]: null,
    [AIProvider.DEEPINFRA]: 'deepinfra',
    [AIProvider.DEEPSEEK]: 'deepseek',
    [AIProvider.FIREWORKS_AI]: 'fireworks-ai',
    [AIProvider.GITHUB]: 'github-models',
    [AIProvider.GOOGLE]: 'google',
    [AIProvider.GOOGLE_VERTEX_AI]: 'google-vertex',
    [AIProvider.GROQ]: 'groq',
    [AIProvider.HUGGINGFACE]: 'huggingface',
    [AIProvider.INFERENCE_NET]: null,
    [AIProvider.JINA]: null,
    [AIProvider.LAMBDA]: null,
    [AIProvider.LEMONFOX_AI]: null,
    [AIProvider.LEPTON]: null,
    [AIProvider.LINGYI]: null,
    [AIProvider.MILVUS]: null,
    [AIProvider.MISTRAL_AI]: 'mistral',
    [AIProvider.MONSTERAPI]: null,
    [AIProvider.MOONSHOT]: 'moonshotai',
    [AIProvider.NCOMPASS]: null,
    [AIProvider.NEBIUS]: 'nebius',
    [AIProvider.NOMIC]: null,
    [AIProvider.NOVITA_AI]: null,
    [AIProvider.OLLAMA]: 'ollama-cloud',
    [AIProvider.OPENAI]: 'openai',
    [AIProvider.OPENROUTER]: 'openrouter',
    [AIProvider.PALM]: null,
    [AIProvider.PERPLEXITY_AI]: 'perplexity',
    [AIProvider.PREDIBASE]: null,
    [AIProvider.RECRFT_AI]: null,
    [AIProvider.REKA_AI]: null,
    [AIProvider.REPLICATE]: null,
    [AIProvider.SAGEMAKER]: null,
    [AIProvider.SAMBANOVA]: null,
    [AIProvider.SEGMIND]: null,
    [AIProvider.SILICONFLOW]: 'siliconflow',
    [AIProvider.STABILITY_AI]: null,
    [AIProvider.TOGETHER_AI]: 'togetherai',
    [AIProvider.TRITON]: null,
    [AIProvider.UPSTAGE]: 'upstage',
    [AIProvider.VOYAGE]: null,
    [AIProvider.WORKERS_AI]: 'cloudflare-workers-ai',
    [AIProvider.XAI]: 'xai',
    [AIProvider.ZHIPU]: 'zhipuai',
  };
 
  return mapping[provider] ?? null;
};