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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat: add trial model list in system features (#31313)
zyssyz1237c12e923b6cd
diff --git a/api/enums/hosted_provider.py b/api/enums/hosted_provider.pynew file mode 100644index 00000000000..c6d3715dc17--- /dev/null+++ b/api/enums/hosted_provider.py@@ -0,0 +1,21 @@+from enum import StrEnum+++class HostedTrialProvider(StrEnum):+ """+ Enum representing hosted model provider names for trial access.+ """++ OPENAI = "langgenius/openai/openai"+ ANTHROPIC = "langgenius/anthropic/anthropic"+ GEMINI = "langgenius/gemini/google"+ X = "langgenius/x/x"+ DEEPSEEK = "langgenius/deepseek/deepseek"+ TONGYI = "langgenius/tongyi/tongyi"++ @property+ def config_key(self) -> str:+ """Return the config key used in dify_config (e.g., HOSTED_{config_key}_PAID_ENABLED)."""+ if self == HostedTrialProvider.X:+ return "XAI"+ return self.namediff --git a/api/services/feature_service.py b/api/services/feature_service.pyindex b2fb3784e8e..d94ae49d919 100644--- a/api/services/feature_service.py+++ b/api/services/feature_service.py@@ -4,6 +4,7 @@ from pydantic import BaseModel, ConfigDict, Fieldfrom configs import dify_configfrom enums.cloud_plan import CloudPlan+from enums.hosted_provider import HostedTrialProviderfrom services.billing_service import BillingServicefrom services.enterprise.enterprise_service import EnterpriseService@@ -170,6 +171,7 @@ class SystemFeatureModel(BaseModel):plugin_installation_permission: PluginInstallationPermissionModel = PluginInstallationPermissionModel()enable_change_email: bool = Trueplugin_manager: PluginManagerModel = PluginManagerModel()+ trial_models: list[str] = []enable_trial_app: bool = Falseenable_explore_banner: bool = False@@ -227,9 +229,21 @@ class FeatureService:system_features.is_allow_register = dify_config.ALLOW_REGISTERsystem_features.is_allow_create_workspace = dify_config.ALLOW_CREATE_WORKSPACEsystem_features.is_email_setup = dify_config.MAIL_TYPE is not None and dify_config.MAIL_TYPE != ""+ system_features.trial_models = cls._fulfill_trial_models_from_env()system_features.enable_trial_app = dify_config.ENABLE_TRIAL_APPsystem_features.enable_explore_banner = dify_config.ENABLE_EXPLORE_BANNER+ @classmethod+ def _fulfill_trial_models_from_env(cls) -> list[str]:+ return [+ provider.value+ for provider in HostedTrialProvider+ if (+ getattr(dify_config, f"HOSTED_{provider.config_key}_PAID_ENABLED", False)+ and getattr(dify_config, f"HOSTED_{provider.config_key}_TRIAL_ENABLED", False)+ )+ ]+@classmethoddef _fulfill_params_from_env(cls, features: FeatureModel):features.can_replace_logo = dify_config.CAN_REPLACE_LOGO