Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

14.4 KB
Raw Blame
/*
 *  Copyright 2026 The InfiniFlow Authors. All Rights Reserved.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

export enum ModelStatus {
  Active = 'active',
  Inactive = 'inactive',
}

export enum LLMFactory {
  TongYiQianWen = 'Tongyi-Qianwen',
  Moonshot = 'Moonshot',
  OpenAI = 'OpenAI',
  ZhipuAI = 'ZHIPU-AI',
  WenXinYiYan = '文心一言',
  Ollama = 'Ollama',
  Xinference = 'Xinference',
  ModelScope = 'ModelScope',
  DeepSeek = 'DeepSeek',
  VolcEngine = 'VolcEngine',
  BaiChuan = 'BaiChuan',
  Jina = 'Jina',
  MiniMax = 'MiniMax',
  Mistral = 'Mistral',
  AzureOpenAI = 'Azure-OpenAI',
  Bedrock = 'Bedrock',
  Gemini = 'Gemini',
  Groq = 'Groq',
  OpenRouter = 'OpenRouter',
  LocalAI = 'LocalAI',
  StepFun = 'StepFun',
  NVIDIA = 'NVIDIA',
  LMStudio = 'LM-Studio',
  OpenAiAPICompatible = 'OpenAI-API-Compatible',
  MWS = 'MWS',
  Cohere = 'Cohere',
  LeptonAI = 'LeptonAI',
  TogetherAI = 'TogetherAI',
  PerfXCloud = 'PerfXCloud',
  Upstage = 'Upstage',
  NovitaAI = 'NovitaAI',
  SILICONFLOW = 'SILICONFLOW',
  PPIO = 'PPIO',
  Replicate = 'Replicate',
  TencentHunYuan = 'Tencent Hunyuan',
  XunFeiSpark = 'XunFei Spark',
  BaiduYiYan = 'BaiduYiyan',
  FishAudio = 'Fish Audio',
  TencentCloud = 'Tencent Cloud',
  Anthropic = 'Anthropic',
  VoyageAI = 'Voyage AI',
  GoogleCloud = 'Google Cloud',
  HuggingFace = 'HuggingFace',
  YouDao = 'Youdao',
  BAAI = 'BAAI',
  NomicAI = 'nomic-ai',
  JinaAI = 'jinaai',
  SentenceTransformers = 'sentence-transformers',
  GPUStack = 'GPUStack',
  VLLM = 'VLLM',
  GiteeAI = 'GiteeAI',
  Ai302 = '302.AI',
  DeepInfra = 'DeepInfra',
  Grok = 'Grok',
  XAI = 'xAI',
  TokenPony = 'TokenPony',
  Meituan = 'Meituan',
  Longcat = 'LongCat',
  CometAPI = 'CometAPI',
  DeerAPI = 'DeerAPI',
  JiekouAI = 'Jiekou.AI',
  Builtin = 'Builtin',
  MinerU = 'MinerU',
  MinerUNet = 'MinerU.Net',
  PaddleOCR = 'PaddleOCR',
  PaddleOCRLocal = 'PaddleOCR.local',
  MiniCPMOCR = 'MiniCPM-OCR',
  OpenDataLoader = 'OpenDataLoader',
  SoMark = 'SoMark',
  N1n = 'n1n',
  Avian = 'Avian',
  RAGcon = 'RAGcon',
  Perplexity = 'Perplexity',
  Astraflow = 'Astraflow',
  AstraflowCN = 'Astraflow-CN',
  FastEmbed = 'FastEmbed',
  FuturMix = 'FuturMix',
  SiliconflowIntl = 'siliconflow_intl',
  Xiaomi = 'Xiaomi',
  HuaweiCloud = 'HuaweiCloud',
  OrcaRouter = 'OrcaRouter',
  Qiniu = 'Qiniu',
  TokenHub = 'TokenHub',
  NewAPI = 'New API',
  DaoXE = 'DaoXE',
  FunASR = 'FunASR',
  AIMLAPI = 'aimlapi.com',
  GreenPT = 'GreenPT',
  Synthorai = 'Synthorai',
  RadeonCloud = 'Radeon Cloud',
  ApiRoute = 'API-Route',
  CheaperInference = 'Cheaper Inference',
  Opper = 'Opper',
  DemonRoute = 'Demon Route',
  TrustedRouter = 'TrustedRouter',
  EmpirioLabs = 'EmpirioLabs AI',
  AIStupidLevel = 'AI Stupid Level',
  Runcrate = 'Runcrate',
  WorldRouter = 'WorldRouter',
  CloudGPU = 'CloudGPU',
  Obscurify = 'Obscurify.ai',
  Cheapaimodel = 'cheapaimodel',
  SystemOne = 'SystemOne',
  HostingerRouter = 'Hostinger Router',
  Wally = 'Wally',
  Synap = 'Synap',
}

// Please lowercase the file name
export const IconMap = {
  [LLMFactory.TongYiQianWen]: 'tongyi-qianwen',
  [LLMFactory.Moonshot]: 'moonshot',
  [LLMFactory.OpenAI]: 'openai',
  [LLMFactory.ZhipuAI]: 'zhipu',
  [LLMFactory.WenXinYiYan]: 'wenxin',
  [LLMFactory.Ollama]: 'ollama',
  [LLMFactory.Xinference]: 'xinference',
  [LLMFactory.ModelScope]: 'modelscope',
  [LLMFactory.DeepSeek]: 'deepseek',
  [LLMFactory.VolcEngine]: 'volcengine',
  [LLMFactory.BaiChuan]: 'baichuan',
  [LLMFactory.Jina]: 'jina',
  [LLMFactory.MiniMax]: 'MiniMax',
  [LLMFactory.Mistral]: 'mistral',
  [LLMFactory.AzureOpenAI]: 'azure',
  [LLMFactory.Bedrock]: 'bedrock',
  [LLMFactory.Gemini]: 'gemini',
  [LLMFactory.Groq]: 'groq-next',
  [LLMFactory.OpenRouter]: 'open-router',
  [LLMFactory.LocalAI]: 'local-ai',
  [LLMFactory.StepFun]: 'stepfun',
  [LLMFactory.NVIDIA]: 'nvidia',
  [LLMFactory.LMStudio]: 'lm-studio',
  [LLMFactory.OpenAiAPICompatible]: 'openai-api',
  [LLMFactory.Cohere]: 'cohere',
  [LLMFactory.LeptonAI]: 'lepton',
  [LLMFactory.TogetherAI]: 'together',
  [LLMFactory.PerfXCloud]: 'perfx-cloud',
  [LLMFactory.Upstage]: 'upstage',
  [LLMFactory.NovitaAI]: 'novita-ai',
  [LLMFactory.SILICONFLOW]: 'siliconflow',
  [LLMFactory.PPIO]: 'ppio',
  [LLMFactory.Replicate]: 'replicate',
  [LLMFactory.TencentHunYuan]: 'hunyuan',
  [LLMFactory.XunFeiSpark]: 'spark',
  [LLMFactory.BaiduYiYan]: 'wenxinyiyan',
  [LLMFactory.FishAudio]: 'fish-audio',
  [LLMFactory.TencentCloud]: 'tencent-cloud',
  [LLMFactory.Anthropic]: 'anthropic',
  [LLMFactory.VoyageAI]: 'voyage',
  [LLMFactory.GoogleCloud]: 'google-cloud',
  [LLMFactory.HuggingFace]: 'huggingface',
  [LLMFactory.YouDao]: 'youdao',
  [LLMFactory.BAAI]: 'baai',
  [LLMFactory.NomicAI]: 'nomic-ai',
  [LLMFactory.JinaAI]: 'jina',
  [LLMFactory.SentenceTransformers]: 'sentence-transformers',
  [LLMFactory.GPUStack]: 'gpustack',
  [LLMFactory.VLLM]: 'vllm',
  [LLMFactory.GiteeAI]: 'gitee-ai',
  [LLMFactory.Ai302]: 'ai302',
  [LLMFactory.DeepInfra]: 'deepinfra',
  [LLMFactory.Grok]: 'grok',
  [LLMFactory.XAI]: 'xai',
  [LLMFactory.TokenPony]: 'tokenpony',
  [LLMFactory.Meituan]: 'longcat',
  [LLMFactory.Longcat]: 'longcat',
  [LLMFactory.CometAPI]: 'cometapi',
  [LLMFactory.DeerAPI]: 'deerapi',
  [LLMFactory.JiekouAI]: 'jiekouai',
  [LLMFactory.Builtin]: 'builtin',
  [LLMFactory.MinerU]: 'mineru',
  [LLMFactory.MinerUNet]: 'mineru',
  [LLMFactory.PaddleOCR]: 'paddleocr',
  [LLMFactory.PaddleOCRLocal]: 'paddleocr',
  [LLMFactory.MiniCPMOCR]: 'minicpm-ocr',
  [LLMFactory.N1n]: 'n1n',
  [LLMFactory.Avian]: 'avian',
  [LLMFactory.RAGcon]: 'ragcon',
  [LLMFactory.Perplexity]: 'perplexity',
  [LLMFactory.Astraflow]: 'astraflow',
  [LLMFactory.AstraflowCN]: 'astraflow',
  [LLMFactory.FastEmbed]: 'fastembed',
  [LLMFactory.FuturMix]: 'futurmix',
  [LLMFactory.SiliconflowIntl]: 'siliconflow',
  [LLMFactory.Xiaomi]: 'xiaomi',
  [LLMFactory.HuaweiCloud]: 'huaweicloud',
  [LLMFactory.OrcaRouter]: 'orcarouter',
  [LLMFactory.Qiniu]: 'qiniu',
  [LLMFactory.TokenHub]: 'tokenhub',
  [LLMFactory.SoMark]: 'somark',
  [LLMFactory.NewAPI]: 'new-api',
  [LLMFactory.DaoXE]: 'daoxe',
  [LLMFactory.FunASR]: 'funasr',
  [LLMFactory.AIMLAPI]: 'aimlapi',
  [LLMFactory.GreenPT]: 'greenpt',
  [LLMFactory.Synthorai]: 'synthorai',
  [LLMFactory.RadeonCloud]: 'radeon-cloud',
  [LLMFactory.ApiRoute]: 'apiroute',
  [LLMFactory.MWS]: 'mws',
  [LLMFactory.CheaperInference]: 'cheaperinference',
  [LLMFactory.Opper]: 'opper',
  [LLMFactory.TrustedRouter]: 'trustedrouter',
  [LLMFactory.EmpirioLabs]: 'empiriolabs',
  [LLMFactory.AIStupidLevel]: 'aistupidlevel',
  [LLMFactory.Runcrate]: 'runcrate',
  [LLMFactory.WorldRouter]: 'worldrouter',
  [LLMFactory.CloudGPU]: 'cloudgpu',
  [LLMFactory.Obscurify]: 'obscurify',
  [LLMFactory.HostingerRouter]: 'hostinger-router',
  [LLMFactory.Cheapaimodel]: 'cheapaimodel',
  [LLMFactory.Wally]: 'wally',
  [LLMFactory.Synap]: 'synap',
};

/**
 * Providers that may serve a given model type.
 *
 * Types without an entry are unrestricted — listing every provider here would
 * be a second copy of the catalog that goes stale. Decision is intentionally
 * unrestricted: the backend derives the System One endpoint from the selected
 * instance's own base URL, so any provider that serves that path on its
 * instances can offer decision models.
 */
export const ModelTypeProviderMap: Record<string, string[]> = {};

export const ModelTypeToField: Record<string, string> = {
  chat: 'llm_id',
  decision: 'decision_id',
  embedding: 'embd_id',
  vision: 'img2txt_id',
  asr: 'asr_id',
  rerank: 'rerank_id',
  tts: 'tts_id',
};

export const FieldToModelType: Record<string, string> = {
  llm_id: 'chat',
  decision_id: 'decision',
  embd_id: 'embedding',
  img2txt_id: 'vision',
  asr_id: 'asr',
  rerank_id: 'rerank',
  tts_id: 'tts',
};

export const APIMapUrl = {
  [LLMFactory.OpenAI]: 'https://platform.openai.com/api-keys',
  [LLMFactory.AIMLAPI]: 'https://aimlapi.com/app/keys',
  [LLMFactory.GreenPT]: 'https://greenpt.ai',
  [LLMFactory.Synthorai]: 'https://synthorai.io',
  [LLMFactory.ApiRoute]: 'https://www.api-route.com',
  [LLMFactory.DaoXE]: 'https://daoxe.com',
  [LLMFactory.CheaperInference]: 'https://cheaperinference.com',
  [LLMFactory.Opper]: 'https://platform.opper.ai',
  [LLMFactory.TrustedRouter]: 'https://trustedrouter.com/keys',
  [LLMFactory.EmpirioLabs]:
    'https://platform.empiriolabs.ai/dashboard/api-keys',
  [LLMFactory.AIStupidLevel]: 'https://aistupidlevel.info/router/keys',
  [LLMFactory.Runcrate]:
    'https://www.runcrate.ai/dashboard/api-keys?utm_source=ragflow&utm_medium=directory&utm_campaign=gpu_pricing',
  [LLMFactory.WorldRouter]:
    'https://worldrouter.ai/dashboard/api-keys?utm_source=ragflow&utm_medium=provider&utm_campaign=integration',
  [LLMFactory.CloudGPU]: 'https://cloudgpu.app/api/console',
  [LLMFactory.Obscurify]: 'https://obscurify.ai/account',
  [LLMFactory.HostingerRouter]: 'https://hpanel.hostinger.com/ai-router',
  [LLMFactory.Cheapaimodel]:
    'https://console.cheapaimodel.ai/keys?utm_source=ragflow',
  [LLMFactory.Wally]: 'https://console.runanywhere.ai',
  [LLMFactory.Synap]: 'https://synap.linkrra.com/pricing',
  [LLMFactory.MWS]:
    'https://mws.ru/docs/cloud-platform/gpt/general/inference-text.html',
  [LLMFactory.Anthropic]: 'https://console.anthropic.com/settings/keys',
  [LLMFactory.Gemini]: 'https://aistudio.google.com/app/apikey',
  [LLMFactory.DeepSeek]: 'https://platform.deepseek.com/api_keys',
  [LLMFactory.Moonshot]: 'https://platform.moonshot.cn/console/api-keys',
  [LLMFactory.TongYiQianWen]:
    'https://bailian.console.aliyun.com/?tab=model#/api-key',
  [LLMFactory.ZhipuAI]: 'https://bigmodel.cn/usercenter/proj-mgmt/apikeys',
  [LLMFactory.XAI]: 'https://x.ai/api/',
  [LLMFactory.HuggingFace]: 'https://huggingface.co/settings/tokens',
  [LLMFactory.Mistral]: 'https://console.mistral.ai/api-keys/',
  [LLMFactory.Cohere]: 'https://dashboard.cohere.com/api-keys',
  [LLMFactory.BaiduYiYan]:
    'https://console.bce.baidu.com/qianfan/ais/console/apiKey',
  [LLMFactory.Meituan]: 'https://longcat.chat/platform/api_keys',
  [LLMFactory.Bedrock]:
    'https://us-east-1.console.aws.amazon.com/iam/home?region=us-east-2#/users',
  [LLMFactory.AzureOpenAI]:
    'https://portal.azure.com/#create/Microsoft.CognitiveServicesOpenAI',
  [LLMFactory.OpenRouter]: 'https://openrouter.ai/keys',
  [LLMFactory.XunFeiSpark]: 'https://maas.xfyun.cn/apikey',
  [LLMFactory.MiniMax]:
    'https://platform.minimaxi.com/user-center/basic-information',
  [LLMFactory.Groq]: 'https://console.groq.com/keys',
  [LLMFactory.NVIDIA]: 'https://build.nvidia.com/settings/api-keys',
  [LLMFactory.SILICONFLOW]: 'https://cloud.siliconflow.cn/account/ak',
  [LLMFactory.Replicate]: 'https://replicate.com/account/api-tokens',
  [LLMFactory.VolcEngine]: 'https://console.volcengine.com/ark',
  [LLMFactory.Jina]: 'https://jina.ai/embeddings/',
  [LLMFactory.TencentHunYuan]:
    'https://console.cloud.tencent.com/hunyuan/api-key',
  [LLMFactory.TencentCloud]: 'https://console.cloud.tencent.com/cam/capi',
  [LLMFactory.ModelScope]: 'https://modelscope.cn/my/myaccesstoken',
  [LLMFactory.GoogleCloud]: 'https://console.cloud.google.com/apis/credentials',
  [LLMFactory.FishAudio]: 'https://fish.audio/app/api-keys/',
  [LLMFactory.GiteeAI]: 'https://ai.gitee.com/dashboard/settings/tokens',
  [LLMFactory.StepFun]: 'https://platform.stepfun.com/interface-key',
  [LLMFactory.BaiChuan]: 'https://platform.baichuan-ai.com/console/apikey',
  [LLMFactory.PPIO]: 'https://ppio.com/settings/key-management',
  [LLMFactory.VoyageAI]: 'https://dash.voyageai.com/api-keys',
  [LLMFactory.TogetherAI]: 'https://api.together.xyz/settings/api-keys',
  [LLMFactory.NovitaAI]: 'https://novita.ai/dashboard/key',
  [LLMFactory.Upstage]: 'https://console.upstage.ai/api-keys',
  [LLMFactory.CometAPI]: 'https://api.cometapi.com/console/token',
  [LLMFactory.Ai302]: 'https://302.ai/apis/list',
  [LLMFactory.DeerAPI]: 'https://api.deerapi.com/token',
  [LLMFactory.TokenPony]: 'https://www.tokenpony.cn/#/user/keys',
  [LLMFactory.DeepInfra]: 'https://deepinfra.com/dash/api_keys',
  [LLMFactory.PaddleOCR]: 'https://aistudio.baidu.com/paddleocr',
  [LLMFactory.MiniCPMOCR]: 'https://platform.modelbest.cn/console/keys',
  [LLMFactory.SoMark]: 'https://somark.cn/workbench/apikey',
  [LLMFactory.N1n]: 'https://docs.n1n.ai',
  [LLMFactory.Avian]: 'https://avian.io',
  [LLMFactory.Perplexity]:
    'https://docs.perplexity.ai/docs/embeddings/quickstart',
  [LLMFactory.Astraflow]: 'https://astraflow.ucloud-global.com/en-us',
  [LLMFactory.AstraflowCN]: 'https://astraflow.ucloud.cn/',
  [LLMFactory.FastEmbed]: 'https://qdrant.github.io/fastembed/',
  [LLMFactory.FuturMix]: 'https://futurmix.ai',
  [LLMFactory.SiliconflowIntl]: 'https://cloud.siliconflow.us/account/ak',
  [LLMFactory.Xiaomi]: 'https://mimo.mi.com/',
  [LLMFactory.HuaweiCloud]: 'https://www.huaweicloud.com',
  [LLMFactory.OrcaRouter]: 'https://orcarouter.ai',
  [LLMFactory.Qiniu]: 'https://www.qiniu.com',
  [LLMFactory.TokenHub]: 'https://aitok.cc',
  [LLMFactory.WenXinYiYan]: 'https://yiyan.baidu.com',
  [LLMFactory.Ollama]: 'https://ollama.com',
  [LLMFactory.Xinference]: 'https://github.com/xorbitsai/inference',
  [LLMFactory.LocalAI]: 'https://localai.io',
  [LLMFactory.LMStudio]: 'https://lmstudio.ai',
  [LLMFactory.LeptonAI]: 'https://lepton.ai',
  [LLMFactory.PerfXCloud]: 'https://www.perfxcloud.cn',
  [LLMFactory.YouDao]: 'https://ai.youdao.com',
  [LLMFactory.BAAI]: 'https://www.baai.ac.cn',
  [LLMFactory.NomicAI]: 'https://nomic.ai',
  [LLMFactory.JinaAI]: 'https://jina.ai/embeddings/',
  [LLMFactory.SentenceTransformers]: 'https://www.sbert.net',
  [LLMFactory.GPUStack]: 'https://gpustack.ai',
  [LLMFactory.VLLM]: 'https://vllm.ai',
  [LLMFactory.Grok]: 'https://x.ai',
  [LLMFactory.Longcat]: 'https://longcat.chat',
  [LLMFactory.JiekouAI]: 'https://jiekou.ai',
  [LLMFactory.MinerU]: 'https://mineru.net',
  [LLMFactory.MinerUNet]: 'https://mineru.net',
  [LLMFactory.PaddleOCRLocal]: 'https://aistudio.baidu.com/paddleocr',
  [LLMFactory.RAGcon]: 'https://connect.ragcon.com',
  [LLMFactory.FunASR]: 'https://github.com/modelscope/FunASR',
};