Language Models

This section describes the language model (LLM) functionality in the Dify client.

Model Provider Management

class ModelProvider

Represents a language model provider.

__init__(client: DifyBaseClient, id: str)

Initialize a new model provider.

property info ModelProviderInfo

Get provider information.

update_credentials(credentials: dict)

Update provider credentials.

validate_credentials(credentials: dict)

Validate provider credentials.

delete()

Delete the provider.

Data Models

class SupportedModelType(str, Enum)

Enumeration of supported model types.

text_embedding
Text embedding models
speech2text
Speech-to-text models
moderation
Content moderation models
tts
Text-to-speech models
llm
Language models
rerank
Reranking models
class ModelProviderInfo

Information about a model provider.

provider: str
Provider identifier
label: Optional[Union[dict, str]]
Display label
description: Optional[Union[dict, str]]
Provider description
icon_small: Optional[Union[dict, str]]
Small icon URL
icon_large: Optional[Union[dict, str]]
Large icon URL
background: Optional[str]
Background color
help: Optional[ModelProviderHelp]
Help information
supported_model_types: list[SupportedModelType]
List of supported model types
configurate_methods: Optional[list[str]]
Available configuration methods
preferred_provider_type: Optional[Literal["predefined", "custom"]]
Preferred provider type
class ModelProviderHelp

Help information for a model provider.

title: Union[dict, str]
Help title
url: Union[dict, str]
Help documentation URL