diff --git a/api/core/model_runtime/model_providers/_position.yaml b/api/core/model_runtime/model_providers/_position.yaml
index 8c878d67d8..2dcdc1bf2e 100644
--- a/api/core/model_runtime/model_providers/_position.yaml
+++ b/api/core/model_runtime/model_providers/_position.yaml
@@ -7,6 +7,7 @@
- togetherai
- ollama
- mistralai
+- groq
- replicate
- huggingface_hub
- zhipuai
diff --git a/api/core/model_runtime/model_providers/groq/_assets/icon_l_en.svg b/api/core/model_runtime/model_providers/groq/_assets/icon_l_en.svg
new file mode 100644
index 0000000000..2505a5f493
--- /dev/null
+++ b/api/core/model_runtime/model_providers/groq/_assets/icon_l_en.svg
@@ -0,0 +1,11 @@
+
diff --git a/api/core/model_runtime/model_providers/groq/_assets/icon_s_en.svg b/api/core/model_runtime/model_providers/groq/_assets/icon_s_en.svg
new file mode 100644
index 0000000000..087f37e471
--- /dev/null
+++ b/api/core/model_runtime/model_providers/groq/_assets/icon_s_en.svg
@@ -0,0 +1,4 @@
+
diff --git a/api/core/model_runtime/model_providers/groq/groq.py b/api/core/model_runtime/model_providers/groq/groq.py
new file mode 100644
index 0000000000..1421aaaf2b
--- /dev/null
+++ b/api/core/model_runtime/model_providers/groq/groq.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 GroqProvider(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='llama2-70b-4096',
+ 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/groq/groq.yaml b/api/core/model_runtime/model_providers/groq/groq.yaml
new file mode 100644
index 0000000000..db17cc8bdd
--- /dev/null
+++ b/api/core/model_runtime/model_providers/groq/groq.yaml
@@ -0,0 +1,32 @@
+provider: groq
+label:
+ zh_Hans: GroqCloud
+ en_US: GroqCloud
+description:
+ en_US: GroqCloud provides access to the Groq Cloud API, which hosts models like LLama2 and Mixtral.
+ zh_Hans: GroqCloud 提供对 Groq Cloud API 的访问,其中托管了 LLama2 和 Mixtral 等模型。
+icon_small:
+ en_US: icon_s_en.svg
+icon_large:
+ en_US: icon_l_en.svg
+background: "#F5F5F4"
+help:
+ title:
+ en_US: Get your API Key from GroqCloud
+ zh_Hans: 从 GroqCloud 获取 API Key
+ url:
+ en_US: https://console.groq.com/
+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
diff --git a/api/core/model_runtime/model_providers/groq/llm/llama2-70b-4096.yaml b/api/core/model_runtime/model_providers/groq/llm/llama2-70b-4096.yaml
new file mode 100644
index 0000000000..384912b0dd
--- /dev/null
+++ b/api/core/model_runtime/model_providers/groq/llm/llama2-70b-4096.yaml
@@ -0,0 +1,25 @@
+model: llama2-70b-4096
+label:
+ zh_Hans: Llama-2-70B-4096
+ en_US: Llama-2-70B-4096
+model_type: llm
+features:
+ - agent-thought
+model_properties:
+ mode: chat
+ context_size: 4096
+parameter_rules:
+ - name: temperature
+ use_template: temperature
+ - name: top_p
+ use_template: top_p
+ - name: max_tokens
+ use_template: max_tokens
+ default: 512
+ min: 1
+ max: 4096
+pricing:
+ input: '0.7'
+ output: '0.8'
+ unit: '0.000001'
+ currency: USD
diff --git a/api/core/model_runtime/model_providers/groq/llm/llm.py b/api/core/model_runtime/model_providers/groq/llm/llm.py
new file mode 100644
index 0000000000..915f7a4e1a
--- /dev/null
+++ b/api/core/model_runtime/model_providers/groq/llm/llm.py
@@ -0,0 +1,26 @@
+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 GroqLargeLanguageModel(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)
+
+ @staticmethod
+ def _add_custom_parameters(credentials: dict) -> None:
+ credentials['mode'] = 'chat'
+ credentials['endpoint_url'] = 'https://api.groq.com/openai/v1'
+
diff --git a/api/core/model_runtime/model_providers/groq/llm/mixtral-8x7b-instruct-v0.1.yaml b/api/core/model_runtime/model_providers/groq/llm/mixtral-8x7b-instruct-v0.1.yaml
new file mode 100644
index 0000000000..0dc6678fa2
--- /dev/null
+++ b/api/core/model_runtime/model_providers/groq/llm/mixtral-8x7b-instruct-v0.1.yaml
@@ -0,0 +1,25 @@
+model: mixtral-8x7b-32768
+label:
+ zh_Hans: Mixtral-8x7b-Instruct-v0.1
+ en_US: Mixtral-8x7b-Instruct-v0.1
+model_type: llm
+features:
+ - agent-thought
+model_properties:
+ mode: chat
+ context_size: 32768
+parameter_rules:
+ - name: temperature
+ use_template: temperature
+ - name: top_p
+ use_template: top_p
+ - name: max_tokens
+ use_template: max_tokens
+ default: 512
+ min: 1
+ max: 20480
+pricing:
+ input: '0.27'
+ output: '0.27'
+ unit: '0.000001'
+ currency: USD