FastGPTFastGPT

Environment variables (V4.18.0+)

Environment variables for FastGPT App, Pro, Code Sandbox, and Volume Manager 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. Build-time variables require a new build.

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.
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.
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 FE_DOMAIN. 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 is imported once during upgrade, preserving saved values and explicit clears; runtime no longer reads this ENV variable.

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.

Domains, frontend, and runtime

VariableDefaultDescription
FE_DOMAINRequiredThe origin clients use to access FastGPT, including the scheme, host, and optional port. It completes file and image URLs. Local development can use http://localhost:3000.
NEXT_PUBLIC_BASE_URLEmptyNext.js sub-path deployment prefix, such as /fastgpt. It must be fixed when building the image.
PORT3000Next.js listening port. Also used for local-address detection.

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.

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.

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.
ENABLE_SAAS_ADMIN_CONFIGfalseShow SaaS-specific settings in Admin. Set this only in App.
NEXT_PUBLIC_WORKFLOW_LEAVE_CONFIRMtrueConfirm before leaving the Workflow editor. Only the literal value false disables it. Set at build time.

Pro / Admin environment variables

VariableDefaultDescription
PRO_TOKENNone, requiredService-to-service token for FastGPT app calls to pro/admin internal APIs. Must be at least 32 characters and match App.
BATCH_UPDATE_TIME3000Wallet balance batch update interval, in milliseconds.
INVOICE_FEISHU_WEBHOOK_URLEmptyLark webhook URL for invoice request notifications.
INVOICE_FEISHU_WEBHOOK_CALLBACK_URLEmptyCallback URL for buttons in invoice notifications.
SMS_PROXYEmptySMS sending proxy service URL.
MAX_CRAWL_PAGE2000Maximum number of pages to crawl during website sync.
CRAWL_MAX_HTML_SIZE10Estimated maximum HTML size for one static crawled page, in MB.
CRAWL_EXCLUDE_LISTEmptyCrawler exclusion rules for domains or paths. Use commas to separate values.
CLEAR_FREE_ACCOUNTfalseWhether free account resource cleanup is enabled.
SYNC_MEMBER_CRONEmptyCron expression for automatic member sync. Empty disables the sync task.
WORKORDER_BASE_URLEmptyWork order system URL. The entry is shown only when both this URL and WORKORDER_JWT_SECRET are configured.
WORKORDER_JWT_SECRETEmptySecret used to sign JWTs when creating work orders.
EXTERNAL_USER_SYSTEM_BASE_URLEmptyExternal user system URL.
EXTERNAL_USER_SYSTEM_AUTH_TOKENEmptyAuthentication token for the external user system.
BAIDU_CONVERSION_TOKENEmptyBaidu conversion tracking token.
BAIDU_CONVERSION_BASE_URLEmptyLanding page URL for Baidu conversion tracking, without query parameters. The code appends ?bd_vid=... to build the payload's logidUrl. The upload endpoint is fixed at https://ocpc.baidu.com/ocpcapi/api/uploadConvertData.
BING_ADS_DEVELOPER_TOKENEmptyBing Ads developer token.
BING_ADS_CUSTOMER_IDEmptyBing Ads customer ID.
BING_ADS_CUSTOMER_ACCOUNT_IDEmptyBing Ads customer account ID.
BING_ADS_CONVERSION_NAMEfastgptcnBing Ads conversion goal name.
BING_OAUTH_CLIENT_IDEmptyBing OAuth client ID.
BING_OAUTH_CLIENT_SECRETEmptyBing OAuth client secret.
BING_OAUTH_REFRESH_TOKENEmptyBing OAuth refresh token.
SHOW_WECOM_CONFIGfalseWhether WeCom configuration is shown.
WECOM_DEVfalseDevelopment mode switch for WeCom Pay.
LICENSE_PUBLIC_KEYUnsetLicense verification public key contents. Uses the public key bundled in the image when unset.
LICENSE_PUBLIC_KEY_PATHUnsetPath to a public key file that overrides the bundled License verification key.
TEAM_MODEsingleTeam mode: single for one team, multi for multiple teams, or sync for external account synchronization. Restart Pro after changing it.
LOGIN_2FA_ENABLEDfalseRequire email or SMS verification after password login. Set this only in Pro.
WECHAT_AUTH_TOKENTHEAIDATASETPLATFORMWeChat Official Account callback signing token. Must match the account’s configuration.
TRANSFER_RESOURCE_ON_MEMBER_LEAVEtrueTransfer a member’s resources to root when external synchronization marks the member as having left.
LICENSE_AUTH_METHODUnsetSet to sangfor to use the Sangfor License service. Other values use built-in License verification.
LICENSE_BASE_URLhttp://127.0.0.1:10003Sangfor License service URL.

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.
VM_LOG_LEVELinfoLog level. Supported values are debug, info, and none.
Edit on GitHub

Last updated