FastGPTFastGPT
System Configuration

Environment variables (V4.18.0+)

Environment variables for FastGPT App, Pro, Code Sandbox, Volume Manager, and Agent Sandbox Proxy in V4.18.0 and later.

Starting with V4.18.0, environment configuration is simpler, with business settings managed in Admin. This page lists the remaining environment variables. Set them in the relevant service and restart that service after changes.

Configure the Secure attribute for login cookies under Admin โ†’ Security, and the shared HTTP client response size limit under Admin โ†’ Resource limits (default: 20 MiB; 0 allows only empty responses). Legacy AUTH_COOKIE_SECURE and SERVICE_AXIOS_MAX_CONTENT_LENGTH values are imported only from the App process environment during the upgrade migration; matching Pro values are not imported. Existing form values take precedence. Changing these environment variables after upgrading has no effect. Cookie attributes apply when cookies are reissued; HTTP limits apply to subsequent requests.

Shared App / Pro environment variables

Core settings and secrets

VariableDefaultDescription
DB_MAX_LINK10Maximum connection pool size for MongoDB, PG, OceanBase, openGauss, and other databases. Values are clamped to 10โ€“1000.
FILE_TOKEN_KEYNone, requiredSecret for file read and file authorization flows. Must be at least 6 characters.
AES256_SECRET_KEYNone, requiredSecret used by AES encryption and decryption. Must be at least 6 characters.
INVOKE_TOKEN_SECRETNone, requiredJWT secret for Invoke reverse calls. Must be at least 32 characters.
ROOT_KEYfastgpt_root_keyAdmin API key for the current system. It can call /api/admin/** APIs and must be at least 6 characters.
PRO_TOKENEmptyToken for FastGPT app server calls to pro/admin internal APIs. It must match the pro/admin configuration and is required when App configures PRO_URL.
PRO_URLEmptyCommercial service URL. When set, App can call Pro APIs, and the domain is allowed by file URL validation.
AGENT_USERSUnsetComma-separated usernames for preconfigured Agent accounts. Requires DEFAULT_AGENT_PSW.
DEFAULT_AGENT_PSWUnsetInitial password for the accounts listed in AGENT_USERS.

Service connections

VariableDefaultDescription
PLUGIN_BASE_URLhttp://localhost:3004FastGPT Plugin service URL. Provided at runtime by this environment variable; restart the service after changing it.
PLUGIN_TOKENtokenAuthentication token for calling the Plugin service. Provided at runtime by this environment variable and must match the plugin service AUTH_TOKEN.
MARKETPLACE_URLhttps://v3.marketplace.fastgpt.cnPlugin and template marketplace URL; usually unset because the default tracks FastGPT releases.
FEISHU_BASE_URLhttps://open.feishu.cnLark Open Platform base URL. Override for self-hosted deployments; defaults to the official endpoint.
DINGTALK_BASE_URLhttps://api.dingtalk.comDingTalk API base URL. Defaults to the official endpoint.
DINGTALK_OAPI_BASE_URLhttps://oapi.dingtalk.comDingTalk OAPI base URL. Defaults to the official endpoint.
YUQUE_DATASET_BASE_URLhttps://www.yuque.comYuque data source base URL. Defaults to the official endpoint.
AIPROXY_API_ENDPOINTEmptyAI Proxy service root URL, such as http://aiproxy:3000. Do not append /v1.
AIPROXY_API_TOKENEmptyAI Proxy administrator token. When using the proxy, it must be nonempty and match the server configuration.
CRM_API_URLEmptyLead attribution CRM API base URL (including /api/v1). Empty disables identity reporting.
CRM_API_KEYEmptyCRM admin API key used to bind a FastGPT user to visitor_id after registration or login.
SANGFOR_CHUNK_URLUnsetSangfor intelligent chunking service URL. Used by intelligent chunking requests.
SANGFOR_CHUNK_KEYUnsetBearer token for the Sangfor intelligent chunking service.
SANGFOR_CHUNK_TIMEOUT_MINUTES60Intelligent chunking request timeout, in minutes.

Agent Sandbox

VariableDefaultDescription
AGENT_SANDBOX_SHOW_FREE_TIPfalseWhether the frontend shows the Agent Sandbox free-use hint.

Databases, cache, and vector stores

VariableDefaultDescription
REDIS_URLredis://default:mypassword@localhost:6379Redis connection URL.
MONGODB_URILocal MongoDB example URLMain business MongoDB connection URL.
MONGODB_LOG_URISame example as MONGODB_URIMongoDB connection URL for logs. If unset, it can reuse the main database.
MONGO_DEPRECATE_INDEXtrueNew in V4.18.0: Whether deprecated legacy MongoDB indexes are dropped during the index cleanup migration task. Set to false or 0 to inspect and log without dropping.
SEARCH_MONGO_URLUnsetNew in V4.18.0: Dedicated MongoDB 8.3+ search database URL (requires mongot, default database fastgpt_search). Applies only to newly stored vectors (no automatic migration) and takes precedence without reusing the main database connection.
VECTOR_VQ_LEVEL32Vector quantization level. Supported ranges depend on the vector store.
PG_URLEmptyPostgreSQL/pgvector connection URL.
OCEANBASE_URLEmptyOceanBase vector store connection URL.
SEEKDB_URLEmptySeekDB vector store connection URL.
MILVUS_ADDRESSEmptyMilvus/Zilliz address.
MILVUS_TOKENEmptyMilvus/Zilliz access token.
MILVUS_LANGUAGE_IDENTIFIERlinguaLanguage-identifier for Milvus BM25 full-text search: lingua (default) | whatlang. When the vector store is Milvus, full-text uses BM25 (single modeldata_v2); other vector stores use MongoDB $text.
OPENGAUSS_URLEmptyopenGauss vector store connection URL.

Object storage

VariableDefaultDescription
STORAGE_VENDORminioObject storage vendor. Supported values are minio, aws-s3, r2, cos, and oss.
STORAGE_PUBLIC_BUCKETfastgpt-publicPublic file bucket.
STORAGE_PRIVATE_BUCKETfastgpt-privatePrivate file bucket.
STORAGE_REGIONus-east-1Object storage region.
STORAGE_R2_PUBLIC_ENDPOINTEmptyPublic HTTPS domain for a Cloudflare R2 bucket; required when STORAGE_VENDOR=r2.
STORAGE_S3_ENDPOINThttp://localhost:9000S3/MinIO-compatible API endpoint.
STORAGE_PUBLIC_ACCESS_EXTRA_SUB_PATHEmptyExtra sub-path for public file access URLs.
STORAGE_ACCESS_KEY_IDminioadminObject storage access key.
STORAGE_SECRET_ACCESS_KEYminioadminObject storage secret key.
STORAGE_S3_FORCE_PATH_STYLEfalseWhether S3 path-style access is forced. MinIO usually requires this.
STORAGE_S3_MAX_RETRIES3Maximum S3 client retry count.
STORAGE_COS_PROTOCOLhttps:Tencent Cloud COS protocol, either https: or http:.
STORAGE_COS_USE_ACCELERATEfalseWhether Tencent Cloud COS acceleration domain is used.
STORAGE_COS_CNAME_DOMAINEmptyTencent Cloud COS custom CNAME domain.
STORAGE_COS_PROXYEmptyTencent Cloud COS proxy URL.
STORAGE_OSS_ENDPOINTEmptyAlibaba Cloud OSS endpoint.
STORAGE_OSS_CNAMEfalseWhether Alibaba Cloud OSS uses CNAME.
STORAGE_OSS_INTERNALfalseWhether Alibaba Cloud OSS uses an internal endpoint.
STORAGE_OSS_SECUREfalseWhether Alibaba Cloud OSS uses HTTPS.
FILE_DOWNLOAD_PUBLIC_URL_PREFIXUnsetPublic URL prefix for short download links. Configure your proxy to forward this prefix to FastGPTโ€™s /api/system/file/d/ route.

Configure the File service domain in Admin โ†’ Core settings โ†’ Download links (storage.fileDomain). It points to FastGPT and is used for both upload and download short links. Leave it empty to use the site URL (site.publicUrl). Saved changes apply to newly generated links without a restart. A configured FILE_DOWNLOAD_PUBLIC_URL_PREFIX still takes precedence for downloads. Legacy FILE_DOMAIN and FE_DOMAIN are imported once during upgrade, preserving saved values and explicit clears; runtime no longer reads these ENV variables.

Logs, metrics, and tracing

VariableDefaultDescription
LOG_ENABLE_CONSOLEtrueWhether console logging is enabled.
LOG_CONSOLE_LEVELdebugConsole log level. Supported values are trace, debug, info, warning, error, and fatal.
LOG_ENABLE_OTELfalseWhether OpenTelemetry log export is enabled.
LOG_OTEL_LEVELinfoOTEL log level.
LOG_OTEL_SERVICE_NAMEfastgpt-clientOTEL log service name.
LOG_OTEL_URLEmptyOTEL log export URL.
METRICS_ENABLE_OTELfalseWhether OpenTelemetry metrics export is enabled.
METRICS_EXPORT_INTERVAL30000Metrics export interval, in milliseconds.
METRICS_OTEL_SERVICE_NAMEfastgpt-clientOTEL metrics service name.
METRICS_OTEL_URLEmptyOTEL metrics export URL.
TRACING_ENABLE_OTELfalseWhether OpenTelemetry tracing is enabled.
TRACING_OTEL_SERVICE_NAMEfastgpt-clientOTEL tracing service name.
TRACING_OTEL_URLEmptyOTEL tracing export URL.
TRACING_OTEL_SAMPLE_RATIOEmptyTrace sampling ratio from 0 to 1.
CHAT_LOG_URLEmptyBase URL of the chat log service. Each log is posted separately to {CHAT_LOG_URL}/api/chat/push. Pushing also requires CHAT_LOG_INTERVAL greater than 0.
CHAT_LOG_INTERVALEmptyDelay in milliseconds before sending each chat log separately; logs are not batched. Pushing is disabled when this value is unset or less than or equal to 0, or when CHAT_LOG_URL is empty.
CHAT_LOG_SOURCE_ID_PREFIXfastgpt-Prefix for chat log source IDs.
RETRIEVAL_RESULTS_LIMIT0Maximum number of pre-rerank candidates recorded in dataset search log details when reranking is enabled. Set to 0 to disable recording. Configured only through this environment variable; restart services after changes.
LANGFUSE_SECRET_KEYUnsetLangfuse secret key.
LANGFUSE_PUBLIC_KEYUnsetLangfuse public key.
LANGFUSE_BASE_URLUnsetLangfuse service URL.

Runtime

VariableDefaultDescription
PORT3000Next.js listening port. Also used for local-address detection.
NEXT_PUBLIC_BASE_URLEmptyNext.js sub-path deployment prefix, such as /fastgpt. It must be fixed when building the image.

Network security and proxies

VariableDefaultDescription
TRUSTED_PROXY_ENABLEfalseValidate client IP information provided by reverse proxies.
TRUSTED_PROXY_IPSEmptyTrusted reverse proxy IP/CIDR list, separated by commas or whitespace.
HTTP_PROXYEmptyOutbound HTTP proxy for Node and workers.
HTTPS_PROXYEmptyOutbound HTTPS proxy for Node and workers.
NO_PROXYEmptyAddress list that bypasses proxies.
ALL_PROXYUnsetProxy for outbound clients that support this variable. Default fetch/OpenAI clients require HTTP_PROXY or HTTPS_PROXY.

When protected outbound requests (such as Workflow HTTP Nodes, HTTP tools, the MCP client, and chat channels or file operations using the shared HTTP client) route through HTTP_PROXY, HTTPS_PROXY, or ALL_PROXY, supported proxy schemes are http://, https://, socks://, socks5://, and socks5h://, with target DNS resolution and egress connections delegated to the proxy layer. Enforce egress access controls on the proxy itself (blocking loopback, RFC1918 private networks, and cloud metadata addresses) to mitigate proxy-side DNS rebinding SSRF risks. Destinations matched by NO_PROXY use a direct connection and retain local address and IP checks.

The WeChat Personal channel allows HTTPS requests only to ilinkai.weixin.qq.com (and its subdomains) and cdn.weixin.qq.com (and its subdomains; default media downloads use novac2c.cdn.weixin.qq.com) with redirects disabled. It supports HTTP_PROXY, HTTPS_PROXY, and ALL_PROXY (enforce egress access controls on the proxy itself); direct connections and NO_PROXY targets continue to validate public IP addresses.

Feature controls and service limits

VariableDefaultDescription
DEFAULT_TEAM_BASIC_PERMISSIONS_ENABLEDfalseWhether newly created teams grant their default all-members group permission to create Apps, Skills, Datasets, and API Keys. Does not change existing teams. Configured only through this environment variable; restart services after changes. Configure consistently in FastGPT and Pro Admin.
SYSTEM_MIGRATION_BATCH_SIZE100Records processed per batch by system upgrade tasks. Range: 50โ€“1000.
SYSTEM_MIGRATION_DELAY_SECONDS0Delay before deferred system upgrade tasks, in seconds. 0 means no delay.
AUXILIARY_GENERATION_SHOW_RUN_DETAILfalseShow run details for Skill, Agent, and Workflow generation.
DATASET_SYNONYM_ENABLEDfalseEnable synonym-based Dataset retrieval.
DISABLE_APIDATASET_SUPER_ADMINfalseNew in V4.18.0: Require root and team owners to follow file-level ACLs when managing API Datasets (apiDatasetServer). Does not affect regular Datasets or retrieval.

App environment variables

VariableDefaultDescription
CHINESE_IP_REDIRECT_URLUnsetDestination for the China Mainland IP redirect prompt. Users click to navigate. Leave empty to hide the prompt.
SHOW_GITfalseSet this variable in App only. When PRO_URL is set, it controls Git information visibility regardless of License activation. Community deployments ignore it and always show Git information.
SHOW_OUTLINK_BRANDfalseSet this variable in App only. When PRO_URL is set, it controls branding on public share links regardless of License activation. Community deployments ignore it and always enable branding.
DISABLE_MARKETPLACEfalseHides the plugin marketplace installation entry when true; local file installation remains available.
WECOM_LOGIN_AUTO_REDIRECTfalseAutomatically redirect to WeCom OAuth login when opening the login page inside WeCom.
ENABLE_SAAS_ADMIN_CONFIGfalseShow SaaS-specific settings in Admin. Set this only in App.
ENABLE_SANGFOR_ADMIN_CONFIGfalseShow Sangfor-specific settings in Admin; hidden by default.

Pro environment variables

The following variables are read only by the Commercial Edition fastgpt-pro service; restart fastgpt-pro after changes. fastgpt-pro also reuses PRO_TOKEN and the Shared App / Pro environment variables above.

VariableDefaultDescription
TEAM_MODENone, requiredNew in V4.18.0: Commercial Edition team mode (single, multi, or sync). From V4.18.0 onward, team mode is no longer configured in the Admin panel or database; see Team Mode.
EXTERNAL_USER_SYSTEM_BASE_URLUnsetExternal user system API URL for SSO and member sync. Required when TEAM_MODE=sync (fastgpt-pro fails startup without it); see SSO & External Member Sync.
EXTERNAL_USER_SYSTEM_AUTH_TOKENUnsetAuthentication token for external user system API requests.
SYNC_MEMBER_CRONUnsetUTC cron expression for scheduled external member and organization sync. Runs only when TEAM_MODE=sync; leave empty to disable scheduled sync.
LOGIN_2FA_ENABLEDfalseWhether email or SMS two-factor verification is enabled after password sign-in. Configured only on Pro and propagated to App.
MAX_CRAWL_PAGE2000Default maximum number of pages crawled per website Dataset sync.
CRAWL_MAX_HTML_SIZE10Estimated maximum HTML size per page for the web crawler, in MB.
CRAWL_EXCLUDE_LISTUnsetComma-separated domain or path exclusion rules for the web crawler.
SMS_PROXYUnsetProxy service URL for outbound SMS delivery.
SHOW_WECOM_CONFIGfalseWhether WeCom configuration entries are displayed in the UI.
CLEAR_FREE_ACCOUNTfalseWhether the cleanup job for free accounts' resources is enabled.
WORKORDER_BASE_URLUnsetWork-order system URL. When set, exposes the work-order entry in the UI.
WORKORDER_JWT_SECRETUnsetJWT signing secret for work-order system SSO handoff.
INVOICE_FEISHU_WEBHOOK_URLUnsetLark webhook URL for invoice request notifications.
INVOICE_FEISHU_WEBHOOK_CALLBACK_URLUnsetCallback URL for action buttons in Lark invoice notifications.
WECHAT_AUTH_TOKENTHEAIDATASETPLATFORMCallback signature token for WeChat Official Account integration.
BATCH_UPDATE_TIME3000Batch balance update interval for teams, in milliseconds.
LICENSE_PUBLIC_KEYUnsetOptional License verification public key content overriding the built-in data/public_key.pem.
LICENSE_PUBLIC_KEY_PATHUnsetOptional License verification public key file path overriding the built-in key.

Code Sandbox environment variables

VariableDefaultDescription
SANDBOX_PORT3000Code Sandbox listening port.
SANDBOX_TOKENEmptyBearer token for the /sandbox endpoint. Empty disables API authentication. It only allows printable ASCII characters and cannot contain spaces.
SANDBOX_POOL_SIZE5Number of pre-warmed JS/Python workers, from 1 to 100.
SANDBOX_QUEUE_ID_CONCURRENCYEmptyNumber of requests with the same queueId that may enter execution concurrently. Empty disables queueId queueing. Range: 1 to 100.
SANDBOX_API_MAX_BODY_MB8Maximum /sandbox API JSON body size, including variables, in MB. Range: 1 to 100.
SANDBOX_MAX_TIMEOUT60000Timeout for one code execution, in milliseconds. Range: 1000 to 600000.
SANDBOX_MAX_MEMORY_MB256Maximum memory for one sandbox, in MB. Range: 32 to 4096. The runtime reserves an extra 50 MB for overhead.
SANDBOX_MAX_OUTPUT_MB10Maximum output JSON size for one code execution, including return values and logs, in MB. Range: 1 to 100.
CHECK_INTERNAL_IPtrueWhether internal IP checks are enabled for sandbox network requests.
SANDBOX_REQUEST_MAX_COUNT30Maximum number of network requests allowed during one code execution. Range: 1 to 1000.
SANDBOX_REQUEST_TIMEOUT60000Timeout for one network request from inside the sandbox, in milliseconds. Range: 1000 to 300000.
SANDBOX_REQUEST_MAX_RESPONSE_MB10Maximum response body size for one sandbox network request, in MB. Range: 1 to 100.
SANDBOX_REQUEST_MAX_BODY_MB5Maximum request body size for one sandbox network request, in MB. Range: 1 to 100.
SANDBOX_JS_ALLOWED_MODULESlodash,dayjs,moment,uuid,crypto-js,qs,url,querystringModule allowlist for JavaScript code. Use commas to separate modules.
SANDBOX_PYTHON_ALLOWED_MODULESCommon standard libraries plus numpy,pandas,matplotlibModule allowlist for Python code. Use commas to separate modules.
PORT3000Sandbox local service port used for local-address detection. Actual listening uses SANDBOX_PORT first.
SANDBOX_DISABLE_SECCOMPfalseDisable Linux seccomp system call filtering.
SANDBOX_MAX_TMP_MB16Temporary directory size limit per Python sandbox, in MB. Range: 1โ€“1024.

Volume Manager environment variables

VariableDefaultDescription
PORT3000Volume Manager listening port.
VM_AUTH_TOKENNone, requiredAPI authentication token for Volume Manager.
VM_RUNTIMEkubernetesRuntime type, either docker or kubernetes.
VM_DOCKER_SOCKET/var/run/docker.sockDocker socket path. Required only in docker mode.
VM_DOCKER_API_VERSIONv1.44Docker API version. Required only in docker mode.
VM_K8S_NAMESPACEopensandboxKubernetes namespace. Required only in kubernetes mode.
VM_K8S_PVC_STORAGE_CLASSUnsetKubernetes PVC StorageClass. Leave empty to use the cluster default. Applies only to kubernetes mode.

Volume Manager logging uses the shared LOG_* variables (LOG_ENABLE_CONSOLE, LOG_CONSOLE_LEVEL, LOG_ENABLE_OTEL, and LOG_OTEL_*; defaults to LOG_CONSOLE_LEVEL=info and LOG_OTEL_SERVICE_NAME=fastgpt-volume-manager).

Agent Sandbox Proxy environment variables

VariableDefaultDescription
PORT1006Listening port for WebSocket traffic and, by default, HTTP previews.
PREVIEW_PORTSame as PORTDedicated listening port for HTTP previews; shares PORT when unset.
AGENT_SANDBOX_PROXY_SECRETNone, requiredShared secret for JWT verification and upstream authentication with the FastGPT main service. Must be at least 32 bytes and match Admin โ†’ Subservices โ†’ Agent Sandbox.
FASTGPT_APP_URLhttp://localhost:3000Internal FastGPT main service base URL used for ticket and preview session verification. The official Compose template sets it to http://fastgpt-app:3000.
FASTGPT_APP_REQUEST_TIMEOUT_SECS10Timeout for proxy requests to the FastGPT main service, in seconds. The official Compose template sets it to 60.
AGENT_SANDBOX_PROXY_ADDRESS_CACHE_TTL_SECS30Cache TTL for resolved sandbox endpoints serving preview files, in seconds.
AGENT_SANDBOX_PROXY_REWRITE_HOSTUnsetRewrites loopback hosts in upstream sandbox URLs returned by the main service (for example, host.docker.internal in dev Compose; typically unset in production).
RUST_LOGinfo,fastgpt_agent_sandbox_proxy=debugLog filter level for the proxy service (error, warn, info, debug, trace).
Edit on GitHub

Last updated