Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: support siliconflow (#5129)

orangeclk79e848994287
diff --git a/api/core/model_runtime/model_providers/_position.yaml b/api/core/model_runtime/model_providers/_position.yaml
index 21eea7ef3bf..da654d21741 100644
--- a/api/core/model_runtime/model_providers/_position.yaml
+++ b/api/core/model_runtime/model_providers/_position.yaml
@@ -32,3 +32,4 @@
- openai_api_compatible
- deepseek
- hunyuan
+- siliconflow
diff --git a/api/core/model_runtime/model_providers/siliconflow/_assets/siliconflow.svg b/api/core/model_runtime/model_providers/siliconflow/_assets/siliconflow.svg
new file mode 100644
index 00000000000..16e406f0302
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/_assets/siliconflow.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="213" height="24" viewBox="0 0 213 24"><g><g><path d="M0,4.8L0,19.2C0,21.851,2.14903,24,4.8,24L19.2,24C21.851,24,24,21.851,24,19.2L24,4.8C24,2.14903,21.851,0,19.2,0L4.8,0C2.14903,0,0,2.14903,0,4.8ZM19.2666,1.66666L17.7666,1.66666C12.9666,1.66666,10.2,4.73333,10.2,9.43333L10.2,10.239C9.64723,10.0804,9.07504,10,8.50002,10C5.09426,10,2.33335,12.7609,2.33335,16.1667C2.33335,19.5724,5.09426,22.3333,8.50002,22.3333C11.9058,22.3333,14.6667,19.5724,14.6667,16.1667C14.6667,15.7524,14.6249,15.3392,14.5421,14.9333L14.5666,14.9333L19.2666,14.9333C20.5106,14.9287,21.5167,13.919,21.5167,12.675C21.5167,11.431,20.5106,10.4212,19.2666,10.4167L19.2659,10.4167L19.2583,10.4166L19.2508,10.4167L14.5666,10.4167L14.5666,9.23333C14.5666,7.43333,15.8666,6.13333,17.7666,6.13333L19.2317,6.13333L19.2333,6.13333L19.2349,6.13333L19.2666,6.13333L19.2666,6.13333C20.4869,6.11488,21.4667,5.12044,21.4667,3.9C21.4667,2.67955,20.4869,1.68512,19.2666,1.66666L19.2666,1.66666ZM10.3334,16.1667C10.3334,15.1541,9.51254,14.3333,8.50002,14.3333C7.4875,14.3333,6.66669,15.1541,6.66669,16.1667C6.66669,17.1792,7.4875,18,8.50002,18C9.51254,18,10.3334,17.1792,10.3334,16.1667Z" fill-rule="evenodd" fill="#8358F6" fill-opacity="1"/></g><g><path d="M50.803,20L50.803,4L53.5877,4L53.5877,20L50.803,20ZM58.4005,4L58.4005,16.534399999999998L72.3905,16.534399999999998L72.3905,20L57.4446,20Q56.6965,20,56.1562,19.343600000000002Q55.615899999999996,18.6873,55.615899999999996,17.7421L55.615899999999996,4L58.4005,4ZM75.1286,20L75.1286,4L77.9132,4L77.9132,20L75.1286,20ZM130.9109,16.534399999999998L130.9109,4L133.571,4L133.571,20L130.9109,20L119.4975,7.55536L119.4975,20L116.8377,20L116.8377,5.2448999999999995Q116.8377,4.772321,117.0871,4.431012Q117.3363,4.0897125,117.7104,4.0897125L119.4975,4.0897125L130.9109,16.534399999999998ZM157.85500000000002,4L157.85500000000002,16.534399999999998L171.845,16.534399999999998L171.845,20L156.899,20Q156.151,20,155.611,19.343600000000002Q155.07,18.6873,155.07,17.7421L155.07,4L157.85500000000002,4ZM211.504,18.1096Q213,16.2193,213,13.59387L213,4L210.257,4L210.257,13.59387Q210.257,14.8016,209.571,15.6417Q208.885,16.4819,207.929,16.4819L204.147,16.4819L204.147,4L201.487,4L201.487,16.4819L197.664,16.4819Q196.708,16.4819,196.043,15.6417Q195.378,14.8016,195.378,13.59387L195.378,4L192.635,4L192.635,13.59387Q192.635,16.2193,194.11,18.1096Q195.586,20,197.664,20L207.929,20Q210.008,20,211.504,18.1096ZM86.2589,16.534399999999998L96.7578,16.534399999999998L96.7578,20L86.2589,20Q84.5548,20,83.1002,18.9235Q81.6455,17.847099999999998,80.7935,16.0355Q79.9416,14.224,79.9416,12.07114Q79.94149999999999,9.86575,80.7935,8.05419Q81.6455,6.24261,83.1002,5.16618Q84.5549,4.0897125,86.2589,4.0897125L96.7578,4.0897125L96.7578,7.55536L86.2589,7.55536Q84.8043,7.55534,83.7653,8.86807Q82.7262,10.180810000000001,82.7262,12.07114Q82.7262,13.90891,83.7653,15.2216Q84.8043,16.534399999999998,86.2589,16.534399999999998ZM113.3339,18.1359Q111.8584,20,109.7388,20L103.1052,20Q101.0271,20,99.5516,18.1359Q98.0762,16.271900000000002,98.0762,13.64643L98.0762,10.49585Q98.0762,7.87039,99.5516,5.98006Q101.0271,4.0897125,103.1052,4.0897125L109.7388,4.0897125Q111.8584,4.0897349,113.3339,5.98006Q114.8095,7.87039,114.8095,10.49585L114.8095,13.64643Q114.8093,16.2718,113.3339,18.1359ZM152.332,4.0897125L152.332,7.55536L138.27800000000002,7.55536L138.27800000000002,10.28584L152.332,10.28584L152.332,13.7514L138.34199999999998,13.7514L138.34199999999998,20L135.599,20L135.599,11.733329999999999L135.59199999999998,11.733329999999999L135.59199999999998,4.5L135.599,4.5L135.599,4.0897125L152.332,4.0897125ZM189.131,18.1359Q187.655,20,185.536,20L178.902,20Q176.824,20,175.349,18.1359Q173.873,16.271900000000002,173.873,13.64643L173.873,10.49585Q173.873,7.87039,175.349,5.98006Q176.824,4.0897125,178.902,4.0897125L185.536,4.0897125Q187.655,4.0897349,189.131,5.98006Q190.607,7.87039,190.607,10.49585L190.607,13.64643Q190.606,16.2718,189.131,18.1359ZM47.6526,18.5822Q46.5303,20,44.951,20L32,20L32,16.534399999999998L44.951,16.534399999999998Q45.4082,16.534399999999998,45.7199,16.1406Q46.0316,15.7468,46.0316,15.1692Q46.0316,14.5916,45.7199,14.1977Q45.4082,13.80396,44.951,13.80396L35.8237,13.80392Q34.24434,13.80392,33.12217,12.38618Q32,10.96843,32,8.97308Q32,6.97773,33.12217,5.55999Q34.24434,4.14224,35.8237,4.14224L48.068200000000004,4.142279L48.068200000000004,7.6078399999999995L35.8237,7.6078399999999995Q35.36651,7.6078399999999995,35.0548,8.001660000000001Q34.74309,8.39548,34.74309,8.97308Q34.74309,9.55068,35.0548,9.9445Q35.36651,10.33832,35.8237,10.33832L44.951,10.33832Q46.5304,10.338339999999999,47.6526,11.75608Q48.7748,13.17381,48.7748,15.1692Q48.7748,17.1645,47.6526,18.5822ZM111.3805,8.44797Q110.6947,7.6078399999999995,109.7388,7.6078399999999995L103.1052,7.6078399999999995Q102.1494,7.60782,101.4844,8.44797Q100.8193,9.28814,100.8193,10.49585L100.8193,13.64643Q100.8194,14.8541,101.4844,15.6942Q102.1492,16.534399999999998,103.1052,16.534399999999998L109.7388,16.534399999999998Q110.6948,16.534399999999998,111.3805,15.6942Q112.0663,14.8541,112.0663,13.64643L112.0663,10.49585Q112.0663,9.28811,111.3805,8.44797ZM187.178,8.44797Q186.492,7.6078399999999995,185.536,7.6078399999999995L178.902,7.6078399999999995Q177.946,7.60782,177.281,8.44797Q176.616,9.28814,176.616,10.49585L176.616,13.64643Q176.616,14.8541,177.281,15.6942Q177.946,16.534399999999998,178.902,16.534399999999998L185.536,16.534399999999998Q186.492,16.534399999999998,187.178,15.6942Q187.863,14.8541,187.863,13.64643L187.863,10.49585Q187.863,9.28811,187.178,8.44797Z" fill-rule="evenodd" fill="#131414" fill-opacity="1"/></g></g></svg>
\ No newline at end of file
diff --git a/api/core/model_runtime/model_providers/siliconflow/_assets/siliconflow_square.svg b/api/core/model_runtime/model_providers/siliconflow/_assets/siliconflow_square.svg
new file mode 100644
index 00000000000..ad6b384f7ac
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/_assets/siliconflow_square.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="128" height="128" viewBox="0 0 128 128"><g><g style="opacity:0;"><rect x="0" y="0" width="128" height="128" rx="0" fill="#FFFFFF" fill-opacity="1"/></g><g><path d="M100.74,12L93.2335,12C69.21260000000001,12,55.3672,27.3468,55.3672,50.8672L55.3672,54.8988C52.6011,54.1056,49.7377,53.7031,46.8601,53.7031C29.816499999999998,53.7031,16,67.5196,16,84.5632C16,101.6069,29.816499999999998,115.423,46.8601,115.423C63.9037,115.423,77.72030000000001,101.6069,77.72030000000001,84.5632C77.72030000000001,82.4902,77.51140000000001,80.4223,77.0967,78.3911L77.2197,78.3911L100.74,78.3911C106.9654,78.3681,112,73.3151,112,67.08959999999999C112,60.8642,106.9654,55.8111,100.74,55.7882L100.7362,55.7882L100.6985,55.7879L100.6606,55.7882L77.2197,55.7882L77.2195,49.8663C77.2195,40.8584,83.7252,34.352900000000005,93.2335,34.352900000000005L100.5653,34.352900000000005L100.5733,34.352900000000005L100.5812,34.352900000000005L100.74,34.352900000000005L100.74,34.352900000000005C106.8469,34.2605,111.7497,29.284,111.7497,23.1764C111.7497,17.06889,106.8469,12.0923454,100.74,12L100.74,12ZM56.0347,84.5632C56.0347,79.4962,51.9271,75.3885,46.8601,75.3885C41.793099999999995,75.3885,37.6854,79.4962,37.6854,84.5632C37.6854,89.6303,41.793099999999995,93.7378,46.8601,93.7378C51.9271,93.7378,56.0347,89.6303,56.0347,84.5632Z" fill-rule="evenodd" fill="#8358F6" fill-opacity="1"/></g></g></svg>
\ No newline at end of file
diff --git a/api/core/model_runtime/model_providers/siliconflow/llm/_position.yaml b/api/core/model_runtime/model_providers/siliconflow/llm/_position.yaml
new file mode 100644
index 00000000000..20bb0790c22
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/llm/_position.yaml
@@ -0,0 +1,8 @@
+- deepseek-v2-chat
+- qwen2-72b-instruct
+- qwen2-57b-a14b-instruct
+- qwen2-7b-instruct
+- yi-1.5-34b-chat
+- yi-1.5-9b-chat
+- yi-1.5-6b-chat
+- glm4-9B-chat
diff --git a/api/core/model_runtime/model_providers/siliconflow/llm/deepseek-v2-chat.yaml b/api/core/model_runtime/model_providers/siliconflow/llm/deepseek-v2-chat.yaml
new file mode 100644
index 00000000000..da58e822f90
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/llm/deepseek-v2-chat.yaml
@@ -0,0 +1,32 @@
+model: deepseek-ai/deepseek-v2-chat
+label:
+ en_US: deepseek-ai/deepseek-v2-chat
+model_type: llm
+features:
+ - multi-tool-call
+ - agent-thought
+ - stream-tool-call
+model_properties:
+ mode: chat
+ context_size: 32768
+parameter_rules:
+ - name: temperature
+ use_template: temperature
+ - name: max_tokens
+ use_template: max_tokens
+ type: int
+ default: 512
+ min: 1
+ max: 4096
+ help:
+ zh_Hans: 指定生成结果长度的上限。如果生成结果截断,可以调大该参数。
+ en_US: Specifies the upper limit on the length of generated results. If the generated results are truncated, you can increase this parameter.
+ - name: top_p
+ use_template: top_p
+ - name: frequency_penalty
+ use_template: frequency_penalty
+pricing:
+ input: '1.33'
+ output: '1.33'
+ unit: '0.000001'
+ currency: RMB
diff --git a/api/core/model_runtime/model_providers/siliconflow/llm/glm4-9b-chat.yaml b/api/core/model_runtime/model_providers/siliconflow/llm/glm4-9b-chat.yaml
new file mode 100644
index 00000000000..115fc50b943
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/llm/glm4-9b-chat.yaml
@@ -0,0 +1,32 @@
+model: zhipuai/glm4-9B-chat
+label:
+ en_US: zhipuai/glm4-9B-chat
+model_type: llm
+features:
+ - multi-tool-call
+ - agent-thought
+ - stream-tool-call
+model_properties:
+ mode: chat
+ context_size: 32768
+parameter_rules:
+ - name: temperature
+ use_template: temperature
+ - name: max_tokens
+ use_template: max_tokens
+ type: int
+ default: 512
+ min: 1
+ max: 4096
+ help:
+ zh_Hans: 指定生成结果长度的上限。如果生成结果截断,可以调大该参数。
+ en_US: Specifies the upper limit on the length of generated results. If the generated results are truncated, you can increase this parameter.
+ - name: top_p
+ use_template: top_p
+ - name: frequency_penalty
+ use_template: frequency_penalty
+pricing:
+ input: '0.6'
+ output: '0.6'
+ unit: '0.000001'
+ currency: RMB
diff --git a/api/core/model_runtime/model_providers/siliconflow/llm/llm.py b/api/core/model_runtime/model_providers/siliconflow/llm/llm.py
new file mode 100644
index 00000000000..a9ce7b98c35
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/llm/llm.py
@@ -0,0 +1,25 @@
+from collections.abc import Generator
+from typing import Optional, Union
+
+from core.model_runtime.entities.llm_entities import LLMResult
+from core.model_runtime.entities.message_entities import PromptMessage, PromptMessageTool
+from core.model_runtime.model_providers.openai_api_compatible.llm.llm import OAIAPICompatLargeLanguageModel
+
+
+class SiliconflowLargeLanguageModel(OAIAPICompatLargeLanguageModel):
+ def _invoke(self, model: str, credentials: dict,
+ prompt_messages: list[PromptMessage], model_parameters: dict,
+ tools: Optional[list[PromptMessageTool]] = None, stop: Optional[list[str]] = None,
+ stream: bool = True, user: Optional[str] = None) \
+ -> Union[LLMResult, Generator]:
+ self._add_custom_parameters(credentials)
+ return super()._invoke(model, credentials, prompt_messages, model_parameters, tools, stop, stream)
+
+ def validate_credentials(self, model: str, credentials: dict) -> None:
+ self._add_custom_parameters(credentials)
+ super().validate_credentials(model, credentials)
+
+ @classmethod
+ def _add_custom_parameters(cls, credentials: dict) -> None:
+ credentials['mode'] = 'chat'
+ credentials['endpoint_url'] = 'https://api.siliconflow.cn/v1'
diff --git a/api/core/model_runtime/model_providers/siliconflow/llm/qwen2-57b-a14b-instruct.yaml b/api/core/model_runtime/model_providers/siliconflow/llm/qwen2-57b-a14b-instruct.yaml
new file mode 100644
index 00000000000..75eca7720c2
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/llm/qwen2-57b-a14b-instruct.yaml
@@ -0,0 +1,32 @@
+model: alibaba/Qwen2-57B-A14B-Instruct
+label:
+ en_US: alibaba/Qwen2-57B-A14B-Instruct
+model_type: llm
+features:
+ - multi-tool-call
+ - agent-thought
+ - stream-tool-call
+model_properties:
+ mode: chat
+ context_size: 32768
+parameter_rules:
+ - name: temperature
+ use_template: temperature
+ - name: max_tokens
+ use_template: max_tokens
+ type: int
+ default: 512
+ min: 1
+ max: 4096
+ help:
+ zh_Hans: 指定生成结果长度的上限。如果生成结果截断,可以调大该参数。
+ en_US: Specifies the upper limit on the length of generated results. If the generated results are truncated, you can increase this parameter.
+ - name: top_p
+ use_template: top_p
+ - name: frequency_penalty
+ use_template: frequency_penalty
+pricing:
+ input: '1.26'
+ output: '1.26'
+ unit: '0.000001'
+ currency: RMB
diff --git a/api/core/model_runtime/model_providers/siliconflow/llm/qwen2-72b-instruct.yaml b/api/core/model_runtime/model_providers/siliconflow/llm/qwen2-72b-instruct.yaml
new file mode 100644
index 00000000000..fcbc9e0b685
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/llm/qwen2-72b-instruct.yaml
@@ -0,0 +1,32 @@
+model: alibaba/Qwen2-72B-Instruct
+label:
+ en_US: alibaba/Qwen2-72B-Instruct
+model_type: llm
+features:
+ - multi-tool-call
+ - agent-thought
+ - stream-tool-call
+model_properties:
+ mode: chat
+ context_size: 32768
+parameter_rules:
+ - name: temperature
+ use_template: temperature
+ - name: max_tokens
+ use_template: max_tokens
+ type: int
+ default: 512
+ min: 1
+ max: 4096
+ help:
+ zh_Hans: 指定生成结果长度的上限。如果生成结果截断,可以调大该参数。
+ en_US: Specifies the upper limit on the length of generated results. If the generated results are truncated, you can increase this parameter.
+ - name: top_p
+ use_template: top_p
+ - name: frequency_penalty
+ use_template: frequency_penalty
+pricing:
+ input: '4.13'
+ output: '4.13'
+ unit: '0.000001'
+ currency: RMB
diff --git a/api/core/model_runtime/model_providers/siliconflow/llm/qwen2-7b-instruct.yaml b/api/core/model_runtime/model_providers/siliconflow/llm/qwen2-7b-instruct.yaml
new file mode 100644
index 00000000000..eda1d40642d
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/llm/qwen2-7b-instruct.yaml
@@ -0,0 +1,32 @@
+model: alibaba/Qwen2-7B-Instruct
+label:
+ en_US: alibaba/Qwen2-7B-Instruct
+model_type: llm
+features:
+ - multi-tool-call
+ - agent-thought
+ - stream-tool-call
+model_properties:
+ mode: chat
+ context_size: 32768
+parameter_rules:
+ - name: temperature
+ use_template: temperature
+ - name: max_tokens
+ use_template: max_tokens
+ type: int
+ default: 512
+ min: 1
+ max: 4096
+ help:
+ zh_Hans: 指定生成结果长度的上限。如果生成结果截断,可以调大该参数。
+ en_US: Specifies the upper limit on the length of generated results. If the generated results are truncated, you can increase this parameter.
+ - name: top_p
+ use_template: top_p
+ - name: frequency_penalty
+ use_template: frequency_penalty
+pricing:
+ input: '0.35'
+ output: '0.35'
+ unit: '0.000001'
+ currency: RMB
diff --git a/api/core/model_runtime/model_providers/siliconflow/llm/yi-1.5-34b-chat.yaml b/api/core/model_runtime/model_providers/siliconflow/llm/yi-1.5-34b-chat.yaml
new file mode 100644
index 00000000000..6656e663e91
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/llm/yi-1.5-34b-chat.yaml
@@ -0,0 +1,32 @@
+model: 01-ai/Yi-1.5-34B-Chat
+label:
+ en_US: 01-ai/Yi-1.5-34B-Chat
+model_type: llm
+features:
+ - multi-tool-call
+ - agent-thought
+ - stream-tool-call
+model_properties:
+ mode: chat
+ context_size: 16384
+parameter_rules:
+ - name: temperature
+ use_template: temperature
+ - name: max_tokens
+ use_template: max_tokens
+ type: int
+ default: 512
+ min: 1
+ max: 4096
+ help:
+ zh_Hans: 指定生成结果长度的上限。如果生成结果截断,可以调大该参数。
+ en_US: Specifies the upper limit on the length of generated results. If the generated results are truncated, you can increase this parameter.
+ - name: top_p
+ use_template: top_p
+ - name: frequency_penalty
+ use_template: frequency_penalty
+pricing:
+ input: '1.26'
+ output: '1.26'
+ unit: '0.000001'
+ currency: RMB
diff --git a/api/core/model_runtime/model_providers/siliconflow/llm/yi-1.5-6b-chat.yaml b/api/core/model_runtime/model_providers/siliconflow/llm/yi-1.5-6b-chat.yaml
new file mode 100644
index 00000000000..ba6e0c51134
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/llm/yi-1.5-6b-chat.yaml
@@ -0,0 +1,32 @@
+model: 01-ai/Yi-1.5-6B-Chat
+label:
+ en_US: 01-ai/Yi-1.5-6B-Chat
+model_type: llm
+features:
+ - multi-tool-call
+ - agent-thought
+ - stream-tool-call
+model_properties:
+ mode: chat
+ context_size: 4096
+parameter_rules:
+ - name: temperature
+ use_template: temperature
+ - name: max_tokens
+ use_template: max_tokens
+ type: int
+ default: 512
+ min: 1
+ max: 4096
+ help:
+ zh_Hans: 指定生成结果长度的上限。如果生成结果截断,可以调大该参数。
+ en_US: Specifies the upper limit on the length of generated results. If the generated results are truncated, you can increase this parameter.
+ - name: top_p
+ use_template: top_p
+ - name: frequency_penalty
+ use_template: frequency_penalty
+pricing:
+ input: '0.35'
+ output: '0.35'
+ unit: '0.000001'
+ currency: RMB
diff --git a/api/core/model_runtime/model_providers/siliconflow/llm/yi-1.5-9b-chat.yaml b/api/core/model_runtime/model_providers/siliconflow/llm/yi-1.5-9b-chat.yaml
new file mode 100644
index 00000000000..64be8998c55
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/llm/yi-1.5-9b-chat.yaml
@@ -0,0 +1,32 @@
+model: 01-ai/Yi-1.5-9B-Chat
+label:
+ en_US: 01-ai/Yi-1.5-9B-Chat
+model_type: llm
+features:
+ - multi-tool-call
+ - agent-thought
+ - stream-tool-call
+model_properties:
+ mode: chat
+ context_size: 16384
+parameter_rules:
+ - name: temperature
+ use_template: temperature
+ - name: max_tokens
+ use_template: max_tokens
+ type: int
+ default: 512
+ min: 1
+ max: 4096
+ help:
+ zh_Hans: 指定生成结果长度的上限。如果生成结果截断,可以调大该参数。
+ en_US: Specifies the upper limit on the length of generated results. If the generated results are truncated, you can increase this parameter.
+ - name: top_p
+ use_template: top_p
+ - name: frequency_penalty
+ use_template: frequency_penalty
+pricing:
+ input: '0.42'
+ output: '0.42'
+ unit: '0.000001'
+ currency: RMB
diff --git a/api/core/model_runtime/model_providers/siliconflow/siliconflow.py b/api/core/model_runtime/model_providers/siliconflow/siliconflow.py
new file mode 100644
index 00000000000..63f76fa8b58
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/siliconflow.py
@@ -0,0 +1,29 @@
+import logging
+
+from core.model_runtime.entities.model_entities import ModelType
+from core.model_runtime.errors.validate import CredentialsValidateFailedError
+from core.model_runtime.model_providers.__base.model_provider import ModelProvider
+
+logger = logging.getLogger(__name__)
+
+class SiliconflowProvider(ModelProvider):
+
+ def validate_provider_credentials(self, credentials: dict) -> None:
+ """
+ Validate provider credentials
+ if validate failed, raise exception
+
+ :param credentials: provider credentials, credentials form defined in `provider_credential_schema`.
+ """
+ try:
+ model_instance = self.get_model_instance(ModelType.LLM)
+
+ model_instance.validate_credentials(
+ model='deepseek-ai/deepseek-v2-chat',
+ credentials=credentials
+ )
+ except CredentialsValidateFailedError as ex:
+ raise ex
+ except Exception as ex:
+ logger.exception(f'{self.get_provider_schema().provider} credentials validate failed')
+ raise ex
diff --git a/api/core/model_runtime/model_providers/siliconflow/siliconflow.yaml b/api/core/model_runtime/model_providers/siliconflow/siliconflow.yaml
new file mode 100644
index 00000000000..cf44c185d59
--- /dev/null
+++ b/api/core/model_runtime/model_providers/siliconflow/siliconflow.yaml
@@ -0,0 +1,29 @@
+provider: siliconflow
+label:
+ zh_Hans: 硅基流动
+ en_US: SiliconFlow
+icon_small:
+ en_US: siliconflow_square.svg
+icon_large:
+ en_US: siliconflow.svg
+background: "#ffecff"
+help:
+ title:
+ en_US: Get your API Key from SiliconFlow
+ zh_Hans: 从 SiliconFlow 获取 API Key
+ url:
+ en_US: https://cloud.siliconflow.cn/keys
+supported_model_types:
+ - llm
+configurate_methods:
+ - predefined-model
+provider_credential_schema:
+ credential_form_schemas:
+ - variable: api_key
+ label:
+ en_US: API Key
+ type: secret-input
+ required: true
+ placeholder:
+ zh_Hans: 在此输入您的 API Key
+ en_US: Enter your API Key