Comment on page
Environments
Deployment version.
SELF_HOSTED
: Self-hosted version- Only supports single team/tenant mode
- Can only use email and password to log in
- No trial hosted OpenAI API-Key feature
CLOUD
: Cloud version- Supports multi-team/tenant mode
- Unable to log in using email and password, only supports GitHub, Google authorization login.
- Has 200 trials hosted OpenAI API-Key feature
The backend URL of the console API, used to concatenate the authorization callback. If empty, it is the same domain. Example:
https://api.console.dify.ai
The front-end URL of the console web, used to concatenate some front-end addresses and for CORS configuration use. If empty, it is the same domain. Example:
https://console.dify.ai
Service API Url, used to display Service API Base Url to the front-end. If empty, it is the same domain. Example:
https://api.dify.ai
WebApp API backend Url, used to declare the back-end URL for the front-end API. If empty, it is the same domain. Example:
https://app.dify.ai
WebApp Url, used to display WebAPP API Base Url to the front-end. If empty, it is the same domain. Example:
https://api.app.dify.ai
File preview or download URL prefix, used to display the file preview or download URL to the front-end or as a multi-modal model input; In order to prevent others from forging, the image preview URL is signed and has a 5-minute expiration time.
Startup mode, only available when starting with docker, not effective when starting from source code.
- apiStart API Server.
- workerStart asynchronous queue worker.
Debug mode, default is false. It is recommended to turn on this configuration for local development to prevent some problems caused by monkey patch.
Flask debug mode, it can output trace information at the interface when turned on, which is convenient for debugging.
A key used to securely sign session cookies and encrypt sensitive information in the database.
This variable needs to be set when starting for the first time.
You can use
openssl rand -base64 42
to generate a strong key.Deployment environment.
- PRODUCTION (default)Production environment.
- TESTINGTesting environment. There will be a distinct color label on the front-end page, indicating that this environment is a testing environment.
Log output level, default is INFO.
It is recommended to set it to ERROR for production.
When set to true, the database migration will be automatically executed when the container starts, only available when starting with docker, not effective when starting from source code.
You need to manually execute
flask db upgrade
in the api directory when starting from source code.Whether to enable the version check policy. If set to false,
https://updates.dify.ai
will not be called for version check.Since the version interface based on CloudFlare Worker cannot be directly accessed in China at present, setting this variable to empty can shield this interface call.
When OpenAI cannot be accessed in China, replace it with a domestic mirror address, or when a local model provides OpenAI compatible API, it can be replaced.
Only effective when starting with docker image or docker-compose.
- DIFY_BIND_ADDRESSAPI service binding address, default: 0.0.0.0, i.e., all addresses can be accessed.
- DIFY_PORTAPI service binding port number, default 5001.
- SERVER_WORKER_AMOUNTThe number of API server workers, i.e., the number of gevent workers. Formula:
number of cpu cores x 2 + 1
- SERVER_WORKER_CLASSDefaults to gevent. If using windows, it can be switched to sync or solo.
- GUNICORN_TIMEOUTRequest handling timeout. The default is 200, it is recommended to set it to 360 to support a longer sse connection time.
- CELERY_WORKER_CLASSSimilar to
SERVER_WORKER_CLASS
. Default is gevent. If using windows, it can be switched to sync or solo. - CELERY_WORKER_AMOUNTThe number of Celery workers. The default is 1, and can be set as needed.
The database uses PostgreSQL. Please use the public schema.
- DB_USERNAME: username
- DB_PASSWORD: password
- DB_HOST: database host
- DB_PORT: database port number, default is 5432
- DB_DATABASE: database name
- SQLALCHEMY_POOL_SIZE: The size of the database connection pool. The default is 30 connections, which can be appropriately increased.
- SQLALCHEMY_POOL_RECYCLE: Database connection pool recycling time, the default is 3600 seconds.
- SQLALCHEMY_ECHO: Whether to print SQL, default is false.
This Redis configuration is used for caching and for pub/sub during conversation.
- REDIS_HOST: Redis host
- REDIS_PORT: Redis port, default is 6379
- REDIS_DB: Redis Database, default is 0. Please use a different Database from Session Redis and Celery Broker.
- REDIS_USERNAME: Redis username, default is empty
- REDIS_PASSWORD: Redis password, default is empty. It is strongly recommended to set a password.
- REDIS_USE_SSL: Whether to use SSL protocol for connection, default is false
- CELERY_BROKER_URLFormat as follows:redis://<redis_username>:<redis_password>@<redis_host>:<redis_port>/<redis_database>Example:
redis://:difyai123456@redis:6379/1
- BROKER_USE_SSLIf set to true, use SSL protocol for connection, default is false
Used to set the front-end cross-domain access policy.
- CONSOLE_CORS_ALLOW_ORIGINSConsole CORS cross-domain policy, default is
*
, that is, all domains can access. - WEB_API_CORS_ALLOW_ORIGINSWebAPP CORS cross-domain policy, default is
*
, that is, all domains can access.
Used to store uploaded data set files, team/tenant encryption keys, and other files.
- STORAGE_TYPEType of storage facility
- local (default)Local file storage, if this option is selected, the following
STORAGE_LOCAL_PATH
configuration needs to be set. - s3S3 object storage, if this option is selected, the following S3_ prefixed configurations need to be set.
- STORAGE_LOCAL_PATHDefault is storage, that is, it is stored in the storage directory of the current directory.If you are deploying with docker or docker-compose, be sure to mount the
/app/api/storage
directory in both containers to the same local directory, otherwise, you may encounter file not found errors. - S3_ENDPOINT: S3 endpoint address
- S3_BUCKET_NAME: S3 bucket name
- S3_ACCESS_KEY: S3 Access Key
- S3_SECRET_KEY: S3 Secret Key
- S3_REGION: S3 region information, such as: us-east-1
- VECTOR_STORE
- Available enumeration types include:
weaviate
qdrant
milvus
zilliz
(share the same configuration asmilvus
)pinecone
(not yet open)
- WEAVIATE_ENDPOINTWeaviate endpoint address, such as:
http://weaviate:8080
. - WEAVIATE_API_KEYThe api-key credential used to connect to Weaviate.
- WEAVIATE_BATCH_SIZEThe number of index Objects created in batches in Weaviate, default is 100.Refer to this document: https://weaviate.io/developers/weaviate/manage-data/import#how-to-set-batch-parameters
- WEAVIATE_GRPC_ENABLEDWhether to use the gRPC method to interact with Weaviate, performance will greatly increase when enabled, may not be usable locally, default is true.
- QDRANT_URLQdrant endpoint address, such as:
https://your-qdrant-cluster-url.qdrant.tech/
- QDRANT_API_KEYThe api-key credential used to connect to Qdrant.
- PINECONE_API_KEYThe api-key credential used to connect to Pinecone.
- PINECONE_ENVIRONMENTThe environment where Pinecone is located, such as:
us-east4-gcp
- MILVUS_HOSTMilvus host configuration.
- MILVUS_PORTMilvus port configuration.
- MILVUS_USERMilvus user configuration, default is empty.
- MILVUS_PASSWORDMilvus password configuration, default is empty.
- MILVUS_USE_SECUREWhether Milvus uses SSL connection, default is false.
- UPLOAD_FILE_SIZE_LIMIT:Upload file size limit, default 15M.
- UPLOAD_FILE_BATCH_LIMITThe maximum number of files that can be uploaded at a time, default 5.
- TENANT_DOCUMENT_COUNT:Number of files that can be uploaded per tenant, default 100.
- MULTIMODAL_SEND_IMAGE_FORMATThe format of the image sent when the multi-modal model is input, the default is
base64
, optionalurl
. The delay of the call inurl
mode will be lower than that inbase64
mode. It is generally recommended to use the more compatiblebase64
mode. If configured asurl
, you need to configureFILES_URL
as an externally accessible address so that the multi-modal model can access the image. - UPLOAD_IMAGE_FILE_SIZE_LIMITUpload image file size limit, default 10M.
Used for application monitoring and error log tracking.
- SENTRY_DSNSentry DSN address, default is empty, when empty, all monitoring information is not reported to Sentry.
- SENTRY_TRACES_SAMPLE_RATEThe reporting ratio of Sentry events, if it is 0.01, it is 1%.
- SENTRY_PROFILES_SAMPLE_RATEThe reporting ratio of Sentry profiles, if it is 0.01, it is 1%.
Notion integration configuration, variables can be obtained by applying for Notion integration: https://www.notion.so/my-integrations
- NOTION_CLIENT_ID
- NOTION_CLIENT_SECRET
- MAIL_TYPEThe type of mail provider, currently only supports: resend (https://resend.com). If left empty, no mail will be sent.
- MAIL_DEFAULT_SEND_FROM
- RESEND_API_KEYAPI-Key for the Resend email provider, can be obtained from API-Key.
Only available for cloud version.
- GITHUB_CLIENT_ID: GitHub authorization login Client ID
- GITHUB_CLIENT_SECRET: GitHub authorization login Client Secret
- GOOGLE_CLIENT_ID: Google authorization login Client ID
- GOOGLE_CLIENT_SECRET: Google authorization login Client Secret
Only available for cloud version, used for model hosting configuration.
- HOSTED_OPENAI_ENABLED: Enable OpenAI hosted service, default False
- HOSTED_OPENAI_API_KEY: OpenAI hosted service API key
- HOSTED_OPENAI_API_BASE: OpenAI hosted service API base URL, default is empty, i.e.
https://api.openai.com/v1
- HOSTED_OPENAI_API_ORGANIZATION: OpenAI hosted service organization ID, default is empty
- HOSTED_OPENAI_QUOTA_LIMIT: OpenAI hosted service default trial quota (unit: call count), default 200 calls
- HOSTED_OPENAI_PAID_ENABLED: Enable OpenAI hosted paid service, default False
- HOSTED_OPENAI_PAID_STRIPE_PRICE_ID: OpenAI hosted paid service Stripe price ID
- HOSTED_OPENAI_PAID_INCREASE_QUOTA: Increase quota amount after payment for OpenAI hosted paid service
- HOSTED_AZURE_OPENAI_ENABLED: Enable Azure OpenAI hosted service, default False
- HOSTED_AZURE_OPENAI_API_KEY: Azure OpenAI hosted service API key
- HOSTED_AZURE_OPENAI_API_BASE: Azure OpenAI hosted service API base URL
- HOSTED_AZURE_OPENAI_QUOTA_LIMIT: Azure OpenAI hosted service default trial quota (unit: call count)
- HOSTED_ANTHROPIC_ENABLED: Enable Anthropic hosted service, default False
- HOSTED_ANTHROPIC_API_BASE: Anthropic hosted service API base URL, default is empty
- HOSTED_ANTHROPIC_API_KEY: Anthropic hosted service API key
- HOSTED_ANTHROPIC_QUOTA_LIMIT: Anthropic hosted service default trial quota (unit: tokens), default 600,000 tokens
- HOSTED_ANTHROPIC_PAID_ENABLED: Enable Anthropic hosted paid service, default False
- HOSTED_ANTHROPIC_PAID_STRIPE_PRICE_ID: Anthropic hosted paid service Stripe price ID
- HOSTED_ANTHROPIC_PAID_INCREASE_QUOTA: Increase quota amount for Anthropic hosted paid service
- HOSTED_ANTHROPIC_PAID_MIN_QUANTITY: Minimum purchase quantity for Anthropic hosted paid service
- HOSTED_ANTHROPIC_PAID_MAX_QUANTITY: Maximum purchase quantity for Anthropic hosted paid service
- STRIPE_API_KEY: Stripe's API key
- STRIPE_WEBHOOK_SECRET: Stripe's Webhook secret
- INVITE_EXPIRY_HOURS: Member invitation link valid time (hours), Default: 72.
Sentry DSN address, default is empty, when empty, all monitoring information is not reported to Sentry.
⚠️ Modified in 0.3.8, will be deprecated in 0.4.0, replaced by:CONSOLE_API_URL
andCONSOLE_WEB_URL
.
Console URL, used to concatenate the authorization callback, console front-end address, and CORS configuration use. If empty, it is the same domain. Example:
https://console.dify.ai
.⚠️ Modified in 0.3.8, will be deprecated in 0.4.0, replaced bySERVICE_API_URL
.
API URL, used to display Service API Base URL to the front-end. If empty, it is the same domain. Example:
https://api.dify.ai
⚠️ Modified in 0.3.8, will be deprecated in 0.4.0, replaced byAPP_API_URL
andAPP_WEB_URL
.
WebApp Url, used to display WebAPP API Base Url to the front-end. If empty, it is the same domain. Example:
https://api.app.dify.ai
⚠️ This configuration is no longer valid since v0.3.24, will be deprecated in 0.4.0.
Only used by the API service for interface identity verification.
- SESSION_TYPE:Session component type
- redis (default)If you choose this, you need to set the environment variables starting with SESSION_REDIS_ below.
- sqlalchemyIf you choose this, the current database connection will be used and the sessions table will be used to read and write session records.
- SESSION_REDIS_HOST: Redis host
- SESSION_REDIS_PORT: Redis port, default is 6379
- SESSION_REDIS_DB: Redis Database, default is 0. Please use a different Database from Redis and Celery Broker.
- SESSION_REDIS_USERNAME: Redis username, default is empty
- SESSION_REDIS_PASSWORD: Redis password, default is empty. It is strongly recommended to set a password.
- SESSION_REDIS_USE_SSL: Whether to use SSL protocol for connection, default is false
⚠️ This configuration is no longer valid since v0.3.24, will be deprecated in 0.4.0.
Used to set the browser policy for session cookies used for identity verification.
- COOKIE_HTTPONLYCookie HttpOnly configuration, default is true.
- COOKIE_SAMESITECookie SameSite configuration, default is Lax.
- COOKIE_SECURECookie Secure configuration, default is false.