RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Feat/support 302ai provider (#8742)
JI4JUNaeaeb169e4d3
diff --git a/conf/llm_factories.json b/conf/llm_factories.jsonindex 14715cb483..daa00baf57 100644--- a/conf/llm_factories.json+++ b/conf/llm_factories.json@@ -160,7 +160,6 @@"max_tokens": 131072,"model_type": "chat","is_tools": true-},{"llm_name": "grok-3-fast",@@ -168,7 +167,6 @@"max_tokens": 131072,"model_type": "chat","is_tools": true-},{"llm_name": "grok-3-mini",@@ -176,7 +174,6 @@"max_tokens": 131072,"model_type": "chat","is_tools": true-},{"llm_name": "grok-3-mini-mini-fast",@@ -184,7 +181,6 @@"max_tokens": 131072,"model_type": "chat","is_tools": true-},{"llm_name": "grok-2-vision",@@ -192,7 +188,6 @@"max_tokens": 32768,"model_type": "image2text","is_tools": true-}]},@@ -851,7 +846,7 @@{"name": "BAAI","logo": "",- "tags": "TEXT EMBEDDING",+ "tags": "TEXT EMBEDDING","status": "1","llm": [{@@ -4130,6 +4125,175 @@"model_type": "embedding"}]+ },+ {+ "name": "302.AI",+ "logo": "",+ "tags": "LLM,TEXT EMBEDDING,TEXT RE-RANK,IMAGE2TEXT",+ "status": "1",+ "llm": [+ {+ "llm_name": "deepseek-chat",+ "tags": "LLM,CHAT",+ "max_tokens": 32000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "gpt-4o",+ "tags": "LLM,CHAT,128k",+ "max_tokens": 128000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "chatgpt-4o-latest",+ "tags": "LLM,CHAT,128k",+ "max_tokens": 128000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "llama3.3-70b",+ "tags": "LLM,CHAT,128k",+ "max_tokens": 128000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "deepseek-reasoner",+ "tags": "LLM,CHAT,64k",+ "max_tokens": 64000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "gemini-2.0-flash",+ "tags": "LLM,CHAT",+ "max_tokens": 1000000,+ "model_type": "image2text",+ "is_tools": true+ },+ {+ "llm_name": "claude-3-7-sonnet-20250219",+ "tags": "LLM,CHAT",+ "max_tokens": 200000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "claude-3-7-sonnet-latest",+ "tags": "LLM,CHAT",+ "max_tokens": 200000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "grok-3-beta",+ "tags": "LLM,CHAT",+ "max_tokens": 131072,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "grok-3-mini-beta",+ "tags": "LLM,CHAT",+ "max_tokens": 131072,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "gpt-4.1",+ "tags": "LLM,CHAT",+ "max_tokens": 1000000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "o3",+ "tags": "LLM,CHAT",+ "max_tokens": 200000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "o4-mini",+ "tags": "LLM,CHAT",+ "max_tokens": 200000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "qwen3-235b-a22b",+ "tags": "LLM,CHAT,128k",+ "max_tokens": 128000,+ "model_type": "chat",+ "is_tools": false+ },+ {+ "llm_name": "qwen3-32b",+ "tags": "LLM,CHAT,128k",+ "max_tokens": 128000,+ "model_type": "chat",+ "is_tools": false+ },+ {+ "llm_name": "gemini-2.5-pro-preview-05-06",+ "tags": "LLM,CHAT",+ "max_tokens": 1000000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "llama-4-maverick",+ "tags": "LLM,CHAT,128k",+ "max_tokens": 128000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "gemini-2.5-flash",+ "tags": "LLM,CHAT",+ "max_tokens": 1000000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "claude-sonnet-4-20250514",+ "tags": "LLM,CHAT",+ "max_tokens": 200000,+ "model_type": "chat",+ "is_tools": true+ },+ {+ "llm_name": "claude-opus-4-20250514",+ "tags": "LLM,CHAT",+ "max_tokens": 200000,+ "model_type": "image2text",+ "is_tools": true+ },+ {+ "llm_name": "gemini-2.5-pro",+ "tags": "LLM,CHAT",+ "max_tokens": 1000000,+ "model_type": "image2text",+ "is_tools": true+ },+ {+ "llm_name": "jina-clip-v2",+ "tags": "TEXT EMBEDDING,TEXT RE-RANK",+ "max_tokens": 8192,+ "model_type": "embedding",+ "is_tools": false+ },+ {+ "llm_name": "jina-reranker-m0",+ "tags": "TEXT EMBEDDING,TEXT RE-RANK",+ "max_tokens": 10240,+ "model_type": "rerank",+ "is_tools": false+ }+ ]}]}diff --git a/docs/references/supported_models.mdx b/docs/references/supported_models.mdxindex 472e5fbe4d..f106ef850c 100644--- a/docs/references/supported_models.mdx+++ b/docs/references/supported_models.mdx@@ -4,6 +4,7 @@ slug: /supported_models---# Supported models+import APITable from '@site/src/components/APITable';A complete list of models supported by RAGFlow, which will continue to expand.@@ -63,6 +64,7 @@ A complete list of models supported by RAGFlow, which will continue to expand.| ZHIPU-AI | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | || 01.AI | :heavy_check_mark: | | | | | || DeepInfra | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | :heavy_check_mark: |+| 302.AI | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |```mdx-code-block</APITable>@@ -70,7 +72,7 @@ A complete list of models supported by RAGFlow, which will continue to expand.:::danger IMPORTANTIf your model is not listed here but has APIs compatible with those of OpenAI, click **OpenAI-API-Compatible** on the **Model providers** page to configure your model.-:::+::::::noteThe list of supported models is extracted from [this source](https://github.com/infiniflow/ragflow/blob/main/rag/llm/__init__.py) and may not be the most current. For the latest supported model list, please refer to the Python file.diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.pyindex 9ecd7a1f24..4f37cf482b 100644--- a/rag/llm/chat_model.py+++ b/rag/llm/chat_model.py@@ -1724,8 +1724,6 @@ class GPUStackChat(Base):raise ValueError("Local llm url cannot be None")base_url = urljoin(base_url, "v1")super().__init__(key, model_name, base_url, **kwargs)--class DeepInfraChat(Base):_FACTORY_NAME = "DeepInfra"@@ -1733,3 +1731,12 @@ class DeepInfraChat(Base):if not base_url:base_url = "https://api.deepinfra.com/v1/openai"super().__init__(key, model_name, base_url, **kwargs)+++class Ai302Chat(Base):+ _FACTORY_NAME = "302.AI"++ def __init__(self, key, model_name, base_url="https://api.302.ai/v1", **kwargs):+ if not base_url:+ base_url = "https://api.302.ai/v1"+ super().__init__(key, model_name, base_url, **kwargs)diff --git a/rag/llm/embedding_model.py b/rag/llm/embedding_model.pyindex 93b5982be7..2a270e82c9 100644--- a/rag/llm/embedding_model.py+++ b/rag/llm/embedding_model.py@@ -930,8 +930,7 @@ class GiteeEmbed(SILICONFLOWEmbed):if not base_url:base_url = "https://ai.gitee.com/v1/embeddings"super().__init__(key, model_name, base_url)--+class DeepInfraEmbed(OpenAIEmbed):_FACTORY_NAME = "DeepInfra"@@ -939,3 +938,12 @@ class DeepInfraEmbed(OpenAIEmbed):if not base_url:base_url = "https://api.deepinfra.com/v1/openai"super().__init__(key, model_name, base_url)+++class Ai302Embed(Base):+ _FACTORY_NAME = "302.AI"++ def __init__(self, key, model_name, base_url="https://api.302.ai/v1/embeddings"):+ if not base_url:+ base_url = "https://api.302.ai/v1/embeddings"+ super().__init__(key, model_name, base_url)diff --git a/rag/llm/rerank_model.py b/rag/llm/rerank_model.pyindex 7f2181bdf1..a1fa466d84 100644--- a/rag/llm/rerank_model.py+++ b/rag/llm/rerank_model.py@@ -617,3 +617,12 @@ class GiteeRerank(JinaRerank):if not base_url:base_url = "https://ai.gitee.com/v1/rerank"super().__init__(key, model_name, base_url)+++class Ai302Rerank(Base):+ _FACTORY_NAME = "302.AI"++ def __init__(self, key, model_name, base_url="https://api.302.ai/v1/rerank"):+ if not base_url:+ base_url = "https://api.302.ai/v1/rerank"+ super().__init__(key, model_name, base_url)diff --git a/rag/llm/sequence2txt_model.py b/rag/llm/sequence2txt_model.pyindex 1300144ad8..3a26b88355 100644--- a/rag/llm/sequence2txt_model.py+++ b/rag/llm/sequence2txt_model.py@@ -208,7 +208,6 @@ class GiteeSeq2txt(Base):self.client = OpenAI(api_key=key, base_url=base_url)self.model_name = model_name-class DeepInfraSeq2txt(Base):_FACTORY_NAME = "DeepInfra"diff --git a/rag/llm/tts_model.py b/rag/llm/tts_model.pyindex 32e7064b3b..2e944d6e9a 100644--- a/rag/llm/tts_model.py+++ b/rag/llm/tts_model.py@@ -383,7 +383,6 @@ class SILICONFLOWTTS(Base):if chunk:yield chunk-class DeepInfraTTS(OpenAITTS):_FACTORY_NAME = "DeepInfra"diff --git a/web/src/assets/svg/llm/ai302.svg b/web/src/assets/svg/llm/ai302.svgnew file mode 100644index 0000000000..80a864ee94--- /dev/null+++ b/web/src/assets/svg/llm/ai302.svg@@ -0,0 +1 @@+<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>302.AI</title><path d="M13.086 23.25c5.614 0 10.164-4.559 10.164-10.182 0-5.624-4.55-10.182-10.164-10.182-5.613 0-10.163 4.558-10.163 10.182 0 5.623 4.55 10.182 10.163 10.182z" fill="#3F3FAA"></path><path d="M10.914 21.114c5.613 0 10.163-4.559 10.163-10.182S16.527.75 10.914.75C5.3.75.75 5.309.75 10.932S5.3 21.114 10.914 21.114z" fill="#8E47FF"></path><path d="M10.755 17.708c-.722 0-1.416-.24-1.995-.69a3.25 3.25 0 01-1.23-2.177 3.248 3.248 0 01-.006-.782c-.201.04-.407.056-.618.056a3.265 3.265 0 01-3.261-3.262A3.27 3.27 0 017.65 7.67a3.27 3.27 0 013.241-3.638 3.266 3.266 0 013.242 3.577 3.269 3.269 0 012.694 5.693 3.227 3.227 0 01-2.365.782 3.26 3.26 0 01-.466-.066c0 .008.005.014.005.02a3.254 3.254 0 01-.664 2.41 3.235 3.235 0 01-2.583 1.259zm-1.808-4.313c-.228.397-.32.847-.263 1.304a2.092 2.092 0 002.335 1.826 2.086 2.086 0 001.398-.791 2.08 2.08 0 00.425-1.548 2.091 2.091 0 00-.405-1.004 3.253 3.253 0 01-.39-.462.58.58 0 11.947-.675c.044.062.088.117.137.173a.61.61 0 01.111.101l.056.071a2.096 2.096 0 003.49-1.405 2.096 2.096 0 00-1.93-2.248 2.076 2.076 0 00-1.251.304.579.579 0 01-.648.061.59.59 0 01-.233-.796A2.102 2.102 0 0010.888 5.2 2.1 2.1 0 009.14 8.457l.03.056c.61.594.993 1.42.993 2.339A3.273 3.273 0 018.947 13.4v-.005zM6.901 8.752a2.098 2.098 0 00-2.092 2.1c0 1.16.936 2.101 2.092 2.101a2.1 2.1 0 000-4.201z" fill="#fff"></path></svg>\ No newline at end of filediff --git a/web/src/constants/llm.ts b/web/src/constants/llm.tsindex 60e2aeb77c..63469b9690 100644--- a/web/src/constants/llm.ts+++ b/web/src/constants/llm.ts@@ -50,6 +50,7 @@ export enum LLMFactory {GPUStack = 'GPUStack',VLLM = 'VLLM',GiteeAI = 'GiteeAI',+ Ai302 = '302.AI',DeepInfra = 'DeepInfra',}@@ -106,5 +107,6 @@ export const IconMap = {[LLMFactory.GPUStack]: 'gpustack',[LLMFactory.VLLM]: 'vllm',[LLMFactory.GiteeAI]: 'gitee-ai',+ [LLMFactory.Ai302]: 'ai302',[LLMFactory.DeepInfra]: 'deepinfra',};diff --git a/web/src/utils/common-util.ts b/web/src/utils/common-util.tsindex ededa41213..60e5d4c7d1 100644--- a/web/src/utils/common-util.ts+++ b/web/src/utils/common-util.ts@@ -43,6 +43,7 @@ const orderFactoryList = [LLMFactory.ZhipuAI,LLMFactory.Ollama,LLMFactory.Xinference,+ LLMFactory.Ai302,];export const sortLLmFactoryListBySpecifiedOrder = (list: IFactory[]) => {