# Environment Variables

> Environment variables for projects/app, projects/code-sandbox, and pro/admin

Source: https://doc.fastgpt.io/en/self-host/config/env

This page describes the environment variables commonly used in a self-hosted FastGPT deployment. `projects/app` and `pro/admin` both reuse many settings from `packages/service/env.ts`, so database, secret, object storage, vector database, and service-level variables are documented together. Variables that are only read by `projects/app` or `pro/admin` are listed separately.

## Notes

* `projects/app`: the main Next.js app, including pages, API routes, Workflows, Datasets, object storage, and vector storage.
* `pro/admin`: the commercial Admin service. Besides its own Admin variables, it also reuses App/Service settings such as database, secrets, object storage, models, and logging.
* `projects/code-sandbox`: the code execution sandbox service. It exposes the `/sandbox` endpoint and is called by App through `CODE_SANDBOX_URL`.
* `packages/service/env.ts` exports `serviceEnv`; `projects/app/src/env.ts` exports `appEnv`.
* Shared App/Admin boolean variables use `true`, `1`, `yes`, `y`, or `on` to enable a feature. Other values are treated as disabled.
* `FILE_TOKEN_KEY`, `AES256_SECRET_KEY`, and `INVOKE_TOKEN_SECRET` are required at runtime. Use separate strong random secrets and do not use the example values in production.

## Shared App/Admin Variables

These variables are mainly validated by `packages/service/env.ts` and apply to `projects/app` and to `pro/admin` when it imports `@fastgpt/service`. A few App-side switches are still defined in `packages/service/env.ts`; they are also called out in the App-specific section below.

### Basics and Secrets

| Variable              | Default            | Description                                                                                                                                                                      |
| --------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DB_MAX_LINK`         | `10`               | Maximum connection pool size for MongoDB, PG, OceanBase, openGauss, and other databases. Values are clamped to 10–1000.                                                          |
| `SYNC_INDEX`          | `true`             | Whether to create missing MongoDB indexes and remove explicitly declared deprecated indexes at startup. Maintain indexes manually when disabled.                                 |
| `FILE_TOKEN_KEY`      | None, **required** | Secret for file read and file authorization flows. Must be at least 6 characters.                                                                                                |
| `AES256_SECRET_KEY`   | None, **required** | Secret used by AES encryption and decryption. Must be at least 6 characters.                                                                                                     |
| `INVOKE_TOKEN_SECRET` | None, **required** | JWT secret for Invoke reverse calls. Must be at least 32 characters.                                                                                                             |
| `ROOT_KEY`            | `fastgpt_root_key` | Admin API key for the current system. It can call `/api/admin/**` APIs and must be at least 6 characters.                                                                        |
| `PRO_TOKEN`           | Empty              | Token for FastGPT app server calls to pro/admin internal APIs. Must be at least 32 characters, match the pro/admin configuration, and is required when App configures `PRO_URL`. |
| `PRO_URL`             | Empty              | Commercial service URL. When set, App can call Pro APIs, and the domain is allowed by file URL validation.                                                                       |
| `AGENT_USERS`         | Empty              | Comma-separated built-in Agent usernames. When set, `DEFAULT_AGENT_PSW` is also required, or startup fails.                                                                      |
| `DEFAULT_AGENT_PSW`   | Empty              | Default password for built-in Agent users. Required when `AGENT_USERS` is set.                                                                                                   |

### Service URLs and Integrations

Starting with V4.17.0, AI Proxy serves as the unified model routing layer for FastGPT. App and Admin services that share App/Service configuration require `AIPROXY_API_ENDPOINT` and valid `AIPROXY_API_TOKEN`. Configure provider channels in AI Proxy and verify any model-specific request overrides separately.

| Variable                 | Default                     | Description                                                                                               |
| ------------------------ | --------------------------- | --------------------------------------------------------------------------------------------------------- |
| `PLUGIN_BASE_URL`        | `http://localhost:3004`     | FastGPT Plugin service URL. Deployment templates usually set this to the internal Plugin service URL.     |
| `PLUGIN_TOKEN`           | `token`                     | Authentication token for calling the Plugin service. It must match the Plugin service configuration.      |
| `CODE_SANDBOX_URL`       | `http://localhost:3002`     | Code Sandbox service URL. Deployment templates usually set this to the internal Code Sandbox service URL. |
| `CODE_SANDBOX_TOKEN`     | `codesandbox`               | Token used by App when calling Code Sandbox. It must match the sandbox service `SANDBOX_TOKEN`.           |
| `AIPROXY_API_ENDPOINT`   | None, **required**          | AI Proxy service root URL, such as `http://aiproxy:3000`. Do not append `/v1`.                            |
| `AIPROXY_API_TOKEN`      | None, **required**          | A nonempty AI Proxy administrator token matching the server configuration.                                |
| `CRM_API_URL`            | Empty                       | Lead attribution CRM API base URL (including `/api/v1`). Empty disables identity reporting.               |
| `CRM_API_KEY`            | Empty                       | CRM admin API key used to bind a FastGPT user to `visitor_id` after registration or login.                |
| `FEISHU_BASE_URL`        | `https://open.feishu.cn`    | Lark Open Platform URL. Use your private Lark domain when self-hosting Lark.                              |
| `DINGTALK_BASE_URL`      | `https://api.dingtalk.com`  | DingTalk new API base URL.                                                                                |
| `DINGTALK_OAPI_BASE_URL` | `https://oapi.dingtalk.com` | DingTalk OAPI base URL.                                                                                   |
| `YUQUE_DATASET_BASE_URL` | `https://www.yuque.com`     | Yuque Dataset URL.                                                                                        |

### Agent Sandbox

| Variable                                         | Default                  | Description                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------ | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AGENT_SANDBOX_PROVIDER`                         | Empty                    | Agent Sandbox provider. Supported values are `sealosdevbox` and `opensandbox`. Empty disables Sandbox. Once set, the matching provider variables are required. See [OpenSandbox Configuration](/en/self-host/config/sandbox/opensandbox) when using OpenSandbox. `fastgpt-app` also requires all three proxy variables, while `fastgpt-pro` requires only the preview proxy URL.          |
| `AGENT_SANDBOX_SEALOS_BASEURL`                   | Empty                    | Sealos Devbox service URL.                                                                                                                                                                                                                                                                                                                                                                |
| `AGENT_SANDBOX_SEALOS_TOKEN`                     | Empty                    | Sealos Devbox access token.                                                                                                                                                                                                                                                                                                                                                               |
| `AGENT_SANDBOX_SEALOS_WORK_DIRECTORY`            | `/home/devbox/workspace` | Working directory inside the Sealos Devbox sandbox.                                                                                                                                                                                                                                                                                                                                       |
| `AGENT_SANDBOX_SEALOS_IMAGE`                     | Empty                    | Runtime image used by Sealos Devbox. Required when `sealosdevbox` is enabled.                                                                                                                                                                                                                                                                                                             |
| `AGENT_SANDBOX_OPENSANDBOX_BASEURL`              | Empty                    | OpenSandbox service URL.                                                                                                                                                                                                                                                                                                                                                                  |
| `AGENT_SANDBOX_OPENSANDBOX_API_KEY`              | Empty                    | OpenSandbox API key. Required when OpenSandbox is enabled, and must match OpenSandbox server `[server].api_key`.                                                                                                                                                                                                                                                                          |
| `AGENT_SANDBOX_OPENSANDBOX_RUNTIME`              | `docker`                 | OpenSandbox runtime, either `docker` or `kubernetes`.                                                                                                                                                                                                                                                                                                                                     |
| `AGENT_SANDBOX_OPENSANDBOX_IMAGE`                | Empty                    | Full runtime image used by OpenSandbox. Required when `opensandbox` is enabled.                                                                                                                                                                                                                                                                                                           |
| `AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY`     | `true`                   | Whether OpenSandbox access goes through the server proxy.                                                                                                                                                                                                                                                                                                                                 |
| `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_URL`   | Empty                    | Required in OpenSandbox mode. Volume Manager service URL.                                                                                                                                                                                                                                                                                                                                 |
| `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` | Empty                    | Required in OpenSandbox mode. Volume Manager authentication token.                                                                                                                                                                                                                                                                                                                        |
| `AGENT_SANDBOX_OPENSANDBOX_VOLUME_NAME_PREFIX`   | `fastgpt-session`        | Prefix used by the FastGPT app when generating persistent OpenSandbox volume `claimName` values. When upgrading, reuse the previous `VM_VOLUME_NAME_PREFIX` value.                                                                                                                                                                                                                        |
| `AGENT_SANDBOX_CPU_OVERCOMMIT_FACTOR`            | `1`                      | OpenSandbox CPU overcommit factor, defaulting to 1; must be at least 1. Applies only when the Agent Sandbox provider is OpenSandbox, the runtime is `kubernetes`, and OpenSandbox Server is at least v0.2.1. Reduces the resource reservation by the factor (limit / factor) while leaving the resource limit unchanged. Changes apply only to sandboxes created or rebuilt afterward.    |
| `AGENT_SANDBOX_MEMORY_OVERCOMMIT_FACTOR`         | `1`                      | OpenSandbox memory overcommit factor, defaulting to 1; must be at least 1. Applies only when the Agent Sandbox provider is OpenSandbox, the runtime is `kubernetes`, and OpenSandbox Server is at least v0.2.1. Reduces the resource reservation by the factor (limit / factor) while leaving the resource limit unchanged. Changes apply only to sandboxes created or rebuilt afterward. |
| `AGENT_SANDBOX_PROXY_SECRET`                     | Empty                    | Shared HMAC secret for the app and agent-sandbox-proxy. Required by `fastgpt-app` when Agent Sandbox is enabled; must be at least 32 characters.                                                                                                                                                                                                                                          |
| `AGENT_SANDBOX_PROXY_URL`                        | Empty                    | Browser-accessible WebSocket URL for agent-sandbox-proxy. Required by `fastgpt-app` when Agent Sandbox is enabled; must start with `ws://` or `wss://`.                                                                                                                                                                                                                                   |
| `AGENT_SANDBOX_PREVIEW_PROXY_URL`                | Empty                    | Browser-accessible HTTP(S) URL for Sandbox file previews. You must add it to both `fastgpt-app` and `fastgpt-pro` when Agent Sandbox is enabled. Use an origin separate from the FastGPT app.                                                                                                                                                                                             |
| `AGENT_SANDBOX_SHOW_FREE_TIP`                    | `false`                  | Whether the frontend shows the Agent Sandbox free-use hint; the application also accepts the `AGENT_SANDBOX_FREE_TIP` alias.                                                                                                                                                                                                                                                              |
| `AGENT_SANDBOX_STORAGE_SIZE_GI`                  | `1`                      | Agent Sandbox storage size in Gi. FastGPT derives the archive, Skill, and single-file limits from this value.                                                                                                                                                                                                                                                                             |
| `AGENT_SANDBOX_CPU_COUNT`                        | `1`                      | CPU core limit for each Agent Sandbox instance.                                                                                                                                                                                                                                                                                                                                           |
| `AGENT_SANDBOX_MEMORY_MIB`                       | `2048`                   | Memory limit for each Agent Sandbox instance, in MiB.                                                                                                                                                                                                                                                                                                                                     |
| `AGENT_SANDBOX_ENTRYPOINT_TIMEOUT_SECONDS`       | `30`                     | Agent Sandbox entrypoint timeout, in seconds. Range: `1` to `600`.                                                                                                                                                                                                                                                                                                                        |
| `AGENT_SANDBOX_WS_MAX_MESSAGE_BYTES`             | `67108864`               | Maximum Agent Sandbox WebSocket message size, in bytes (default 64 MiB). FastGPT app passes it to the proxy and IDE Agent.                                                                                                                                                                                                                                                                |
| `AGENT_SANDBOX_WS_MAX_FRAME_BYTES`               | `16777216`               | Maximum Agent Sandbox WebSocket frame size, in bytes (default 16 MiB). FastGPT app passes it to the proxy and IDE Agent.                                                                                                                                                                                                                                                                  |
| `AGENT_SANDBOX_SUSPEND_MINUTES`                  | `60`                     | Number of inactive minutes before a running Agent Sandbox is automatically suspended.                                                                                                                                                                                                                                                                                                     |
| `AGENT_SANDBOX_ARCHIVE_INACTIVE_DAYS`            | `7`                      | Number of inactive days before a suspended Agent Sandbox is automatically archived.                                                                                                                                                                                                                                                                                                       |
| `AGENT_SANDBOX_MAX`                              | `100`                    | System-wide limit for active Agent Sandbox instances (app chat and skill edit share one pool). Replaces `AGENT_SANDBOX_MAX_EDIT_DEBUG`.                                                                                                                                                                                                                                                   |
| `AGENT_SANDBOX_MAX_PER_TEAM`                     | Empty                    | Per-team quota for active Agent Sandbox instances. Empty means unlimited.                                                                                                                                                                                                                                                                                                                 |
| `AGENT_SANDBOX_NPM_REGISTRY`                     | Empty                    | npm registry used by npm, yarn, pnpm, and bun inside Agent sandboxes.                                                                                                                                                                                                                                                                                                                     |
| `AGENT_SANDBOX_PYPI_INDEX_URL`                   | Empty                    | PyPI index URL used by pip, `python -m pip`, and uv inside Agent sandboxes.                                                                                                                                                                                                                                                                                                               |
| `AGENT_SANDBOX_APT_MIRROR`                       | Empty                    | Optional apt mirror for Ubuntu or Debian Agent sandboxes. Effective only for root Agent sandboxes.                                                                                                                                                                                                                                                                                        |

### Databases, Cache, and Vector Stores

| Variable                                       | Default                                     | Description                                                                                                                                                                                                    |
| ---------------------------------------------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `REDIS_URL`                                    | `redis://default:mypassword@localhost:6379` | Redis connection URL.                                                                                                                                                                                          |
| `STREAM_RESUME_TTL_SECONDS`                    | `300`                                       | TTL for an active stream resume mirror, in seconds.                                                                                                                                                            |
| `STREAM_RESUME_POST_COMPLETE_TTL_SECONDS`      | `30`                                        | Shortened TTL after a stream completes, in seconds.                                                                                                                                                            |
| `STREAM_RESUME_REDIS_MAXMEMORY_RATIO`          | `0.5`                                       | When Redis used memory divided by `maxmemory` reaches this ratio, new stream resume mirrors are skipped.                                                                                                       |
| `STREAM_RESUME_REDIS_MEMORY_CHECK_INTERVAL_MS` | `5000`                                      | Redis memory watermark cache duration, in milliseconds.                                                                                                                                                        |
| `MONGODB_URI`                                  | Local MongoDB example URL                   | Main business MongoDB connection URL.                                                                                                                                                                          |
| `MONGODB_LOG_URI`                              | Empty                                       | MongoDB connection URL for logs. If unset, `MONGODB_URI` is used.                                                                                                                                              |
| `VECTOR_VQ_LEVEL`                              | `32`                                        | Vector quantization level. Supported ranges depend on the vector store.                                                                                                                                        |
| `PG_URL`                                       | Empty                                       | PostgreSQL/pgvector connection URL.                                                                                                                                                                            |
| `OCEANBASE_URL`                                | Empty                                       | OceanBase vector store connection URL.                                                                                                                                                                         |
| `SEEKDB_URL`                                   | Empty                                       | SeekDB vector store connection URL.                                                                                                                                                                            |
| `MILVUS_ADDRESS`                               | Empty                                       | Milvus/Zilliz address.                                                                                                                                                                                         |
| `MILVUS_TOKEN`                                 | Empty                                       | Milvus/Zilliz access token.                                                                                                                                                                                    |
| `MILVUS_LANGUAGE_IDENTIFIER`                   | `lingua`                                    | Language-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_URL`                                | Empty                                       | openGauss vector store connection URL.                                                                                                                                                                         |

### Object Storage

| Variable                                | Default                 | Description                                                                                                                                                                                     |
| --------------------------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `STORAGE_VENDOR`                        | `minio`                 | Object storage vendor. Supported values are `minio`, `aws-s3`, `r2`, `cos`, and `oss`.                                                                                                          |
| `STORAGE_PUBLIC_BUCKET`                 | `fastgpt-public`        | Public file bucket.                                                                                                                                                                             |
| `STORAGE_PRIVATE_BUCKET`                | `fastgpt-private`       | Private file bucket.                                                                                                                                                                            |
| `STORAGE_REGION`                        | `us-east-1`             | Object storage region.                                                                                                                                                                          |
| `STORAGE_EXTERNAL_ENDPOINT`             | Empty                   | Externally reachable object storage endpoint for browsers or external services. Required when `STORAGE_VENDOR=minio` and `STORAGE_DOWNLOAD_URL_MODE=short-redirect` (startup fails if missing). |
| `STORAGE_R2_PUBLIC_ENDPOINT`            | Empty                   | Public HTTPS domain for a Cloudflare R2 bucket; required when `STORAGE_VENDOR=r2`.                                                                                                              |
| `STORAGE_S3_CDN_ENDPOINT`               | Empty                   | CDN endpoint used for temporary `short-redirect` download URLs. Requires `STORAGE_EXTERNAL_ENDPOINT`.                                                                                           |
| `STORAGE_DOWNLOAD_URL_MODE`             | `short-proxy`           | Download mode: `short-proxy` or `short-redirect`. External URLs are always FastGPT short links.                                                                                                 |
| `STORAGE_DOWNLOAD_REDIRECT_TTL_SECONDS` | `300`                   | Lifetime of the temporary object storage or CDN URL used by `short-redirect`, in seconds.                                                                                                       |
| `STORAGE_S3_ENDPOINT`                   | `http://localhost:9000` | S3/MinIO-compatible API endpoint.                                                                                                                                                               |
| `STORAGE_PUBLIC_ACCESS_EXTRA_SUB_PATH`  | Empty                   | Extra sub-path for public file access URLs.                                                                                                                                                     |
| `STORAGE_ACCESS_KEY_ID`                 | `minioadmin`            | Object storage access key.                                                                                                                                                                      |
| `STORAGE_SECRET_ACCESS_KEY`             | `minioadmin`            | Object storage secret key.                                                                                                                                                                      |
| `STORAGE_S3_FORCE_PATH_STYLE`           | `false`                 | Whether S3 path-style access is forced. MinIO usually requires this.                                                                                                                            |
| `STORAGE_S3_MAX_RETRIES`                | `3`                     | Maximum S3 client retry count.                                                                                                                                                                  |
| `STORAGE_COS_PROTOCOL`                  | `https:`                | Tencent Cloud COS protocol, either `https:` or `http:`.                                                                                                                                         |
| `STORAGE_COS_USE_ACCELERATE`            | `false`                 | Whether Tencent Cloud COS acceleration domain is used.                                                                                                                                          |
| `STORAGE_COS_CNAME_DOMAIN`              | Empty                   | Tencent Cloud COS custom CNAME domain.                                                                                                                                                          |
| `STORAGE_COS_PROXY`                     | Empty                   | Tencent Cloud COS proxy URL.                                                                                                                                                                    |
| `STORAGE_OSS_ENDPOINT`                  | Empty                   | Alibaba Cloud OSS endpoint.                                                                                                                                                                     |
| `STORAGE_OSS_CNAME`                     | `false`                 | Whether Alibaba Cloud OSS uses CNAME.                                                                                                                                                           |
| `STORAGE_OSS_INTERNAL`                  | `false`                 | Whether Alibaba Cloud OSS uses an internal endpoint.                                                                                                                                            |
| `STORAGE_OSS_SECURE`                    | `false`                 | Whether Alibaba Cloud OSS uses HTTPS.                                                                                                                                                           |
| `STORAGE_OSS_ENABLE_PROXY`              | `true`                  | Whether Alibaba Cloud OSS proxy access is enabled.                                                                                                                                              |

### Logging, Metrics, and Tracing

| Variable                    | Default          | Description                                                                                                                       |
| --------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `LOG_ENABLE_CONSOLE`        | `true`           | Whether console logging is enabled.                                                                                               |
| `LOG_CONSOLE_LEVEL`         | `debug`          | Console log level. Supported values are `trace`, `debug`, `info`, `warning`, `error`, and `fatal`.                                |
| `LOG_DEPTH`                 | `3`              | Legacy template variable; ignored in the current version.                                                                         |
| `LOG_ENABLE_OTEL`           | `false`          | Whether OpenTelemetry log export is enabled.                                                                                      |
| `LOG_OTEL_LEVEL`            | `info`           | OTEL log level.                                                                                                                   |
| `LOG_OTEL_SERVICE_NAME`     | `fastgpt-client` | OTEL log service name.                                                                                                            |
| `LOG_OTEL_URL`              | Empty            | OTEL log export URL.                                                                                                              |
| `METRICS_ENABLE_OTEL`       | `false`          | Whether OpenTelemetry metrics export is enabled.                                                                                  |
| `METRICS_EXPORT_INTERVAL`   | `30000`          | Metrics export interval, in milliseconds.                                                                                         |
| `METRICS_OTEL_SERVICE_NAME` | `fastgpt-client` | OTEL metrics service name.                                                                                                        |
| `METRICS_OTEL_URL`          | Empty            | OTEL metrics export URL.                                                                                                          |
| `TRACING_ENABLE_OTEL`       | `false`          | Whether OpenTelemetry tracing is enabled.                                                                                         |
| `TRACING_OTEL_SERVICE_NAME` | `fastgpt-client` | OTEL tracing service name.                                                                                                        |
| `TRACING_OTEL_URL`          | Empty            | OTEL tracing export URL.                                                                                                          |
| `TRACING_OTEL_SAMPLE_RATIO` | Empty            | Trace sampling ratio from `0` to `1`; defaults to `0.01` in production when unset.                                                |
| `CHAT_LOG_URL`              | Empty            | Chat log push service URL. Empty disables pushing.                                                                                |
| `CHAT_LOG_INTERVAL`         | Empty            | Chat log batch push interval, in milliseconds.                                                                                    |
| `CHAT_LOG_SOURCE_ID_PREFIX` | `fastgpt-`       | Prefix for chat log source IDs.                                                                                                   |
| `TRACK_BATCH_UPDATE_TIME`   | `10000`          | Event counter batch write interval, in milliseconds.                                                                              |
| `LANGFUSE_SECRET_KEY`       | Empty            | Langfuse secret key. Langfuse tracing is enabled when this and `LANGFUSE_PUBLIC_KEY` are both set and `TRACING_ENABLE_OTEL=true`. |
| `LANGFUSE_PUBLIC_KEY`       | Empty            | Langfuse public key.                                                                                                              |
| `LANGFUSE_BASE_URL`         | Empty            | Langfuse service URL. Empty uses the Langfuse SDK default.                                                                        |

### Domains, Frontend, and Runtime

| Variable                          | Default                     | Description                                                                                                                                                                                             |
| --------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `FE_DOMAIN`                       | Required                    | The 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`.                           |
| `FILE_DOMAIN`                     | Empty                       | File access domain. It usually points to FastGPT, but a separate domain can isolate file risk.                                                                                                          |
| `FILE_URL_EXPIRED_DAYS`           | `90`                        | Lifetime in days of file access short links persisted in chat records. Fractions are allowed.                                                                                                           |
| `FILE_DOWNLOAD_PUBLIC_URL_PREFIX` | Empty                       | Public URL prefix for download short links. When set, download links become `{prefix}/{signedAlias}`, usually rewritten by Nginx to FastGPT `/api/system/file/d/{signedAlias}`. Affects downloads only. |
| `NEXT_PUBLIC_BASE_URL`            | Empty                       | Next.js sub-path deployment prefix, such as `/fastgpt`. It must be fixed when building the image.                                                                                                       |
| `HOSTNAME`                        | `localhost`                 | Service host used for internal URLs and SSRF local-address detection. Containers commonly set it to `0.0.0.0`.                                                                                          |
| `PORT`                            | `3000`                      | Next.js listening port. Also used for local-address detection.                                                                                                                                          |
| `NODE_ENV`                        | Empty                       | Standard Node/Next.js runtime environment. Production images set it to `production`.                                                                                                                    |
| `NEXT_TELEMETRY_DISABLED`         | `1`                         | Disables Next.js Telemetry in production images.                                                                                                                                                        |
| `NODE_OPTIONS`                    | `--max-old-space-size=4096` | Node options used during production image builds to increase the build memory limit.                                                                                                                    |

### Security

| Variable                            | Default | Description                                                                                                                                                                                                                                                                                                                                                              |
| ----------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `USE_IP_LIMIT`                      | `false` | Whether IP rate limiting is enabled for selected APIs.                                                                                                                                                                                                                                                                                                                   |
| `CHECK_INTERNAL_IP`                 | `false` | Whether internal IP checks are enabled to reduce SSRF risk. Applies only to outbound URLs controlled by users or workflows; operator-configured service addresses (SSO/external user system, model addresses, Feishu/DingTalk/Yuque base URLs, custom PDF parse, custom censor, fast login, chat log, SMS proxy, invoice webhook, enterprise auth, etc.) are unaffected. |
| `AUTH_COOKIE_SECURE`                | `false` | Whether login cookies use the `Secure` attribute. Enable only when the site is HTTPS-only.                                                                                                                                                                                                                                                                               |
| `TRUSTED_PROXY_ENABLE`              | `false` | Whether trusted reverse proxy client IP validation is enabled. Disabled keeps legacy behavior.                                                                                                                                                                                                                                                                           |
| `TRUSTED_PROXY_IPS`                 | Empty   | Trusted reverse proxy IP/CIDR list, separated by commas or whitespace.                                                                                                                                                                                                                                                                                                   |
| `PASSWORD_LOGIN_MINUTE_LIMIT_COUNT` | `10`    | Maximum password login requests per account per minute.                                                                                                                                                                                                                                                                                                                  |
| `MAX_LOGIN_SESSION`                 | `10`    | Maximum login clients per account.                                                                                                                                                                                                                                                                                                                                       |
| `ALLOWED_ORIGINS`                   | Empty   | Allowed CORS origins. Use commas to separate multiple origins. Empty allows all origins by default.                                                                                                                                                                                                                                                                      |
| `MULTIPLE_DATA_TO_BASE64`           | `false` | Whether images, audio, and video are forced into base64 before being sent to models.                                                                                                                                                                                                                                                                                     |
| `DISABLE_CACHE`                     | `false` | Whether system cache hits are disabled, mainly for debugging.                                                                                                                                                                                                                                                                                                            |
| `HTTP_PROXY`                        | Empty   | Outbound HTTP proxy for Node and workers.                                                                                                                                                                                                                                                                                                                                |
| `HTTPS_PROXY`                       | Empty   | Outbound HTTPS proxy for Node and workers.                                                                                                                                                                                                                                                                                                                               |
| `NO_PROXY`                          | Empty   | Address list that bypasses proxies.                                                                                                                                                                                                                                                                                                                                      |
| `ALL_PROXY`                         | Empty   | General outbound proxy.                                                                                                                                                                                                                                                                                                                                                  |
| `CSRF_ENABLED`                      | `true`  | Whether CSRF web request marker validation is enabled.                                                                                                                                                                                                                                                                                                                   |

### Feature Flags and Limits

| Variable                                  | Default     | Description                                                                                                                                                                                         |
| ----------------------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AGENT_ENGINE`                            | `fastAgent` | Agent engine. Supported values are `fastAgent` and `piAgent`.                                                                                                                                       |
| `DEFAULT_TEAM_BASIC_PERMISSIONS_ENABLED`  | `false`     | Whether newly created teams grant their default all-members group permission to create Apps, Skills, Datasets, and API Keys. Does not change existing teams. Keep FastGPT and Pro Admin consistent. |
| `SKIP_FILE_TYPE_CHECK`                    | `false`     | Whether upload file type checks are skipped.                                                                                                                                                        |
| `WECHAT_CHANNEL_CONCURRENCY`              | `1000`      | WeChat channel poll worker concurrency. Minimum value is `10`.                                                                                                                                      |
| `SYSTEM_MIGRATION_BATCH_SIZE`             | `100`       | Number of records processed per system migration batch. Valid range: `50`–`1000`.                                                                                                                   |
| `SYSTEM_MIGRATION_DELAY_SECONDS`          | `0`         | Delay before executing system migration tasks configured with delay, in seconds. Default is `0` (no delay).                                                                                         |
| `XLSX_PARSE_MAX_ROWS`                     | `100000`    | Maximum absolute row number allowed in one XLSX worksheet. Range: `1`–`1048576`.                                                                                                                    |
| `XLSX_PARSE_MAX_COLUMNS`                  | `1000`      | Maximum absolute column number allowed in one XLSX worksheet. Range: `1`–`16384`.                                                                                                                   |
| `XLSX_PARSE_MAX_CELLS`                    | `1000000`   | Maximum cumulative worksheet-range cells allowed in one XLSX workbook. Minimum value is `1`.                                                                                                        |
| `XLSX_PARSE_MAX_MERGED_CELLS`             | `1000000`   | Maximum cumulative merged-cell fills allowed in one XLSX workbook. Minimum value is `1`.                                                                                                            |
| `PARSE_FILE_TIMEOUT_SECONDS`              | `600`       | Timeout for one file parsing task, in seconds.                                                                                                                                                      |
| `WORKFLOW_MAX_RUN_TIMES`                  | `500`       | Maximum workflow run count to avoid extreme infinite loops.                                                                                                                                         |
| `WORKFLOW_MAX_LOOP_TIMES`                 | `100`       | Maximum input array length for loop and parallel nodes.                                                                                                                                             |
| `WORKFLOW_PARALLEL_MAX_CONCURRENCY`       | `10`        | Parallel node concurrency limit, capped at `WORKFLOW_MAX_LOOP_TIMES`.                                                                                                                               |
| `SYSTEM_MAX_STRING_LENGTH_M`              | `100`       | Maximum character length for synchronous system string operations such as variable replacement, in M characters. `1` means `1,000,000` characters. Valid range: `1` to `100`.                       |
| `CHAT_MAX_QPM`                            | `5000`      | Chat QPM limit. User plan limits take precedence when configured.                                                                                                                                   |
| `SERVICE_REQUEST_MAX_CONTENT_LENGTH`      | `10`        | Maximum request body size accepted by the service, in MB.                                                                                                                                           |
| `SERVICE_AXIOS_MAX_CONTENT_LENGTH`        | `20`        | Maximum decompressed response body size for buffered responses of the shared server-side HTTP client, in MB. Streamed downloads are bounded by caller or business quotas.                           |
| `MAX_FOLDER_DEPTH`                        | `4`         | Maximum folder depth. The default allows up to 4 folder levels under the root. Valid range: `2` to `20`.                                                                                            |
| `APP_FOLDER_MAX_AMOUNT`                   | `1000`      | Maximum number of App folders.                                                                                                                                                                      |
| `DATASET_FOLDER_MAX_AMOUNT`               | `1000`      | Maximum number of Collection folders.                                                                                                                                                               |
| `DATASET_SYNONYM_ENABLED`                 | `false`     | Whether to enable dataset synonym expansion and retrieval capabilities, defaulting to off. When disabled, search and write workflows leave synonym configuration unread.                            |
| `UPLOAD_FILE_MAX_SIZE`                    | `1000`      | Maximum upload file size, in MB.                                                                                                                                                                    |
| `UPLOAD_FILE_MAX_AMOUNT`                  | `1000`      | Maximum upload file count.                                                                                                                                                                          |
| `LLM_REQUEST_TRACKING_RETENTION_HOURS`    | `6`         | LLM request tracking retention, in hours.                                                                                                                                                           |
| `MAX_HTML_TRANSFORM_CHARS`                | `1000000`   | Maximum number of characters for HTML-to-Markdown conversion. Larger content is not converted.                                                                                                      |
| `AUXILIARY_GENERATION_SHOW_RUN_DETAIL`    | `false`     | Whether to show the run-detail entry for Skill, Agent, and workflow auxiliary generation.                                                                                                           |
| `RETRIEVAL_RESULTS_LIMIT`                 | `0`         | Maximum recalled candidates recorded in Dataset Search node log details. `0` records none.                                                                                                          |
| `EVAL_CONCURRENCY`                        | `3`         | Evaluation task worker concurrency.                                                                                                                                                                 |
| `DATASET_ARCHIVE_MAX_FILES`               | `2000`      | Maximum source files in one Dataset batch-download ZIP.                                                                                                                                             |
| `DATASET_ARCHIVE_MAX_SOURCE_SIZE_MB`      | `2048`      | Maximum logical total size of source files before archiving a Dataset batch download, in MiB.                                                                                                       |
| `DATASET_ARCHIVE_MAX_CONCURRENCY`         | `4`         | Concurrent Dataset batch-download archives across the Redis cluster.                                                                                                                                |
| `DATASET_ARCHIVE_PREPARE_TIMEOUT_SECONDS` | `300`       | Maximum preparation time before a Dataset batch download sends response headers, in seconds.                                                                                                        |
| `DOCUMENT_PARSE_PROVIDER`                 | Empty       | Document parse provider; supports `sangfor`. With `sangfor`, files with matching extensions go straight to Sangfor (via `CUSTOM_PDF_PARSE_URL`), overriding the enhanced parsing switch.            |
| `SANGFOR_PARSE_EXTENSIONS`                | `pdf`       | Comma-separated extensions handled by Sangfor. Other files continue through the original parse chain.                                                                                               |
| `SANGFOR_PARSE_TIMEOUT_SECONDS`           | `600`       | Sangfor document parse request timeout, in seconds. Maximum `7200`.                                                                                                                                 |
| `SANGFOR_CHUNK_URL`                       | Empty       | Sangfor intelligent chunking service URL. Intelligent chunking is unavailable when unset.                                                                                                           |
| `SANGFOR_CHUNK_KEY`                       | Empty       | Sangfor intelligent chunking service key (Bearer token).                                                                                                                                            |
| `SANGFOR_CHUNK_TIMEOUT_MINUTES`           | `60`        | Sangfor intelligent chunking service timeout, in minutes.                                                                                                                                           |

## Additional App Variables

These variables are mainly read by `projects/app`. Some are currently defined in `packages/service/env.ts` for shared validation, but their actual consumers are still App-side code.

| Variable                        | Default                             | Description                                                                                                                                                                    |
| ------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `DEFAULT_ROOT_PSW`              | `123456`                            | Default `root` password in `v4.17.2` and earlier; in `v4.17.3+`, new instances initialize with `123456` and require changing the password in the first-login activation modal. |
| `SYSTEM_NAME`                   | `AI`                                | Default system name for the page title.                                                                                                                                        |
| `SYSTEM_DESCRIPTION`            | Empty                               | Page meta description. If unset, the default i18n text is used.                                                                                                                |
| `SYSTEM_FAVICON`                | Empty                               | Page favicon URL. If unset, the favicon from system config is used.                                                                                                            |
| `CHINESE_IP_REDIRECT_URL`       | Empty                               | China IP redirect URL in frontend config.                                                                                                                                      |
| `PAY_FORM_URL`                  | Empty                               | Payment form URL in frontend config.                                                                                                                                           |
| `MARKETPLACE_URL`               | `https://v3.marketplace.fastgpt.cn` | Plugin marketplace API URL.                                                                                                                                                    |
| `DISABLE_MARKETPLACE`           | `false`                             | Hides the plugin marketplace installation entry when `true`; local file installation remains available.                                                                        |
| `SHOW_COUPON`                   | `false`                             | Whether redemption codes are shown.                                                                                                                                            |
| `SHOW_DISCOUNT_COUPON`          | `false`                             | Whether discount coupons are shown.                                                                                                                                            |
| `HIDE_CHAT_COPYRIGHT_SETTING`   | `false`                             | Whether copyright settings are hidden.                                                                                                                                         |
| `WECOM_LOGIN_AUTO_REDIRECT`     | `false`                             | Whether WeCom terminals automatically redirect to login.                                                                                                                       |
| `APP_REGISTRATION_URL`          | Empty                               | Legacy template variable (app registration URL); ignored in the current version.                                                                                               |
| `PASSWORD_EXPIRED_MONTH`        | Empty                               | Password expiration period in months. Empty means passwords do not expire.                                                                                                     |
| `OPENAPI_KEY_MAX_COUNT`         | `100`                               | Maximum number of system API Keys one team member can create. Minimum is 1.                                                                                                    |
| `SSE_MCP_SERVER_PROXY_ENDPOINT` | Empty                               | MCP SSE server proxy URL. Do not include a trailing slash. Required when publishing an SSE MCP App.                                                                            |

### Open-Source Only

Starting with v4.15.0, the open-source edition no longer reads `config.json`. When upgrading from an earlier version, remove the file's volume mount and migrate the old settings to environment variables using the table below. If you did not use these optional settings, you do not need to add them.

| Former `config.json` field                  | Current environment variable | Default | Deprecated | Description                                                                                                                                                                                                        |
| ------------------------------------------- | ---------------------------- | ------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `systemEnv.customPdfParse.url`              | `CUSTOM_PDF_PARSE_URL`       | Empty   | -          | Custom PDF parsing service URL.                                                                                                                                                                                    |
| `systemEnv.customPdfParse.key`              | `CUSTOM_PDF_PARSE_KEY`       | Empty   | -          | Custom PDF parsing service key.                                                                                                                                                                                    |
| —                                           | `SOMARK_API_KEY`             | Empty   | -          | SoMark PDF parsing service API key.                                                                                                                                                                                |
| `systemEnv.customPdfParse.doc2xKey`         | `DOC2X_KEY`                  | Empty   | -          | Doc2x PDF parsing service key.                                                                                                                                                                                     |
| `systemEnv.customPdfParse.textinAppId`      | `TEXTIN_APP_ID`              | Empty   | -          | TextIn service App ID.                                                                                                                                                                                             |
| `systemEnv.customPdfParse.textinSecretCode` | `TEXTIN_SECRET_CODE`         | Empty   | -          | TextIn service Secret Code.                                                                                                                                                                                        |
| `systemEnv.hnswEfSearch`                    | `HNSW_EF_SEARCH`             | `200`   | -          | HNSW vector search width for PG, Milvus, OceanBase, SeekDB, and openGauss.                                                                                                                                         |
| `systemEnv.hnswMaxScanTuples`               | `HNSW_MAX_SCAN_TUPLES`       | Unused  | Yes        | Ignored since 4.18.0. PG automatically sets `hnsw.max_scan_tuples` to the largest vector row count among the indexed Dataset groups in the current query, capped at `2147483647` as an iterative scanning ceiling. |
| `systemEnv.datasetParseMaxProcess`          | `DATASET_PARSE_MAX_PROCESS`  | `10`    | -          | Maximum concurrency for the Dataset file parsing queue.                                                                                                                                                            |
| `systemEnv.vectorMaxProcess`                | `VECTOR_MAX_PROCESS`         | `10`    | -          | Maximum concurrency for the vector indexing queue.                                                                                                                                                                 |
| `systemEnv.qaMaxProcess`                    | `QA_MAX_PROCESS`             | `10`    | -          | Maximum concurrency for the Q\&A splitting queue.                                                                                                                                                                  |
| `systemEnv.vlmMaxProcess`                   | `VLM_MAX_PROCESS`            | `10`    | -          | Maximum concurrency for the image understanding model queue.                                                                                                                                                       |

#### Enhanced PDF Parsing

The open-source edition supports custom PDF parsing services, SoMark, TextIn, and Doc2x. Configure only one service. If you configure more than one, FastGPT uses this priority order: custom PDF parsing service, SoMark, TextIn, then Doc2x.

##### Use the Sealos PDF Parsing Service

1. Open [Sealos AI Proxy](https://hzh.sealos.run/?uid=fnWRt09fZP\&openapp=system-aiproxy) and create an API key.
2. Add the API key to FastGPT:

```dotenv
CUSTOM_PDF_PARSE_URL=https://aiproxy.hzh.sealos.run/v1/parse/pdf?model=parse-pdf
CUSTOM_PDF_PARSE_KEY=your-sealos-api-key
```

##### Use SoMark

1. Open [SoMark Studio](https://somark.ai/Studio/apikey) and create an API key.
2. Add the API key to FastGPT:

```dotenv
SOMARK_API_KEY=sk-your-api-key
```

The SoMark synchronous parsing endpoint accepts files up to 200 MB and 300 pages. See the [SoMark API documentation](https://docs.somark.ai/en/api-reference) for the complete limits and error codes.

##### Use Another Custom PDF Parsing Service

```dotenv
CUSTOM_PDF_PARSE_URL=https://your-pdf-parser.example.com/v2/parse/file
CUSTOM_PDF_PARSE_KEY=your-service-key
```

`CUSTOM_PDF_PARSE_KEY` is optional. When set, FastGPT sends it to the parsing service as `Authorization: Bearer <CUSTOM_PDF_PARSE_KEY>`. The service must accept a `multipart/form-data` POST request with a `file` field and return JSON in this format:

```json
{
  "pages": 10,
  "markdown": "Parsed Markdown content"
}
```

##### Use TextIn

```dotenv
TEXTIN_APP_ID=your-app-id
TEXTIN_SECRET_CODE=your-secret-code
```

##### Use Doc2x

```dotenv
DOC2X_KEY=your-api-key
```

Restart FastGPT after changing the environment variables. Then enable **Enhanced PDF Parsing** when importing files into a Dataset or configuring App file uploads. PDFs use the configured enhanced parsing service only when this option is enabled; otherwise, FastGPT uses its built-in parser.

## Admin-Specific Variables

These variables are mainly read by `pro/admin`. Admin also uses the shared App/Admin variables above.

| Variable                              | Default            | Description                                                                                                              |
| ------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| `PRO_TOKEN`                           | None, **required** | Service-to-service token for FastGPT app calls to pro/admin internal APIs. Must be at least 32 characters and match App. |
| `EVAL_LINE_LIMIT`                     | `1000`             | Maximum number of rows allowed when creating one evaluation task. Also sent to frontend config.                          |
| `BATCH_UPDATE_TIME`                   | `3000`             | Wallet balance batch update interval, in milliseconds.                                                                   |
| `INVOICE_FEISHU_WEBHOOK_URL`          | Empty              | Lark webhook URL for invoice request notifications.                                                                      |
| `INVOICE_FEISHU_WEBHOOK_CALLBACK_URL` | Empty              | Callback URL for buttons in invoice notifications.                                                                       |
| `SMS_PROXY`                           | Empty              | SMS sending proxy service URL.                                                                                           |
| `MAX_CRAWL_PAGE`                      | `2000`             | Maximum number of pages to crawl during website sync.                                                                    |
| `CRAWL_MAX_HTML_SIZE`                 | `10`               | Estimated maximum HTML size for one static crawled page, in MB.                                                          |
| `CRAWL_EXCLUDE_LIST`                  | Empty              | Crawler exclusion rules for domains or paths. Use commas to separate values.                                             |
| `SHOW_GIT`                            | `false`            | Whether Git information is shown in Admin.                                                                               |
| `CLEAR_FREE_ACCOUNT`                  | `false`            | Whether free account resource cleanup is enabled.                                                                        |
| `SYNC_MEMBER_CRON`                    | Empty              | Cron expression for automatic member sync. Empty disables the sync task.                                                 |
| `WORKORDER_BASE_URL`                  | Empty              | Work order system URL. When set, the frontend shows work order entry points.                                             |
| `WORKORDER_JWT_SECRET`                | Empty              | Secret used to sign JWTs when creating work orders.                                                                      |
| `EXTERNAL_USER_SYSTEM_BASE_URL`       | Empty              | External user system URL.                                                                                                |
| `EXTERNAL_USER_SYSTEM_AUTH_TOKEN`     | Empty              | Authentication token for the external user system.                                                                       |
| `BAIDU_CONVERSION_TOKEN`              | Empty              | Baidu conversion tracking token.                                                                                         |
| `BAIDU_CONVERSION_BASE_URL`           | Empty              | Baidu conversion tracking API URL.                                                                                       |
| `BING_ADS_DEVELOPER_TOKEN`            | Empty              | Bing Ads developer token.                                                                                                |
| `BING_ADS_CUSTOMER_ID`                | Empty              | Bing Ads customer ID.                                                                                                    |
| `BING_ADS_CUSTOMER_ACCOUNT_ID`        | Empty              | Bing Ads customer account ID.                                                                                            |
| `BING_ADS_CONVERSION_NAME`            | `fastgptcn`        | Bing Ads conversion goal name.                                                                                           |
| `BING_OAUTH_CLIENT_ID`                | Empty              | Bing OAuth client ID.                                                                                                    |
| `BING_OAUTH_CLIENT_SECRET`            | Empty              | Bing OAuth client secret.                                                                                                |
| `BING_OAUTH_REFRESH_TOKEN`            | Empty              | Bing OAuth refresh token.                                                                                                |
| `SHOW_WECOM_CONFIG`                   | `false`            | Whether WeCom configuration is shown.                                                                                    |
| `WECOM_DEV`                           | `false`            | Development mode switch for WeCom Pay.                                                                                   |

## Code Sandbox Variables

These variables are loaded and validated by `projects/code-sandbox/src/env.ts`. When App calls the sandbox, `CODE_SANDBOX_TOKEN` must match `SANDBOX_TOKEN`.

| Variable                          | Default                                                  | Description                                                                                                                                    |
| --------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `SANDBOX_PORT`                    | `3000`                                                   | Code Sandbox listening port.                                                                                                                   |
| `SANDBOX_TOKEN`                   | Empty                                                    | Bearer token for the `/sandbox` endpoint. Empty disables API authentication. Requires printable ASCII characters without spaces.               |
| `SANDBOX_POOL_SIZE`               | `5`                                                      | Number of pre-warmed JS/Python workers, from `1` to `100`.                                                                                     |
| `SANDBOX_QUEUE_ID_CONCURRENCY`    | Empty                                                    | Number of requests with the same `queueId` that may enter execution concurrently. Empty disables `queueId` queueing. Range: `1` to `100`.      |
| `SANDBOX_API_MAX_BODY_MB`         | `8`                                                      | Maximum `/sandbox` API JSON body size, including `variables`, in MB. Range: `1` to `100`.                                                      |
| `SANDBOX_MAX_TIMEOUT`             | `60000`                                                  | Timeout for one code execution, in milliseconds. Range: `1000` to `600000`.                                                                    |
| `SANDBOX_MAX_MEMORY_MB`           | `256`                                                    | Maximum memory for one sandbox, in MB. Range: `32` to `4096`. The runtime reserves an extra `50` MB for overhead.                              |
| `SANDBOX_MAX_OUTPUT_MB`           | `10`                                                     | Maximum output JSON size for one code execution, including return values and logs, in MB. Range: `1` to `100`.                                 |
| `SANDBOX_MAX_TMP_MB`              | `16`                                                     | Maximum temporary directory size for one Python code execution task, in MB. Range: `1` to `1024`.                                              |
| `SANDBOX_DISABLE_SECCOMP`         | `false`                                                  | Whether to disable in-app seccomp. Use only on kernels that do not support in-app seccomp; chroot and UID/GID privilege dropping stay enabled. |
| `CHECK_INTERNAL_IP`               | `true`                                                   | Whether internal IP checks are enabled for sandbox network requests.                                                                           |
| `SANDBOX_REQUEST_MAX_COUNT`       | `30`                                                     | Maximum number of network requests allowed during one code execution. Range: `1` to `1000`.                                                    |
| `SANDBOX_REQUEST_TIMEOUT`         | `60000`                                                  | Timeout for one network request from inside the sandbox, in milliseconds. Range: `1000` to `300000`.                                           |
| `SANDBOX_REQUEST_MAX_RESPONSE_MB` | `10`                                                     | Maximum response body size for one sandbox network request, in MB. Range: `1` to `100`.                                                        |
| `SANDBOX_REQUEST_MAX_BODY_MB`     | `5`                                                      | Maximum request body size for one sandbox network request, in MB. Range: `1` to `100`.                                                         |
| `SANDBOX_JS_ALLOWED_MODULES`      | `lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring`  | Module allowlist for JavaScript code. Use commas to separate modules.                                                                          |
| `SANDBOX_PYTHON_ALLOWED_MODULES`  | Common standard libraries plus `numpy,pandas,matplotlib` | Module allowlist for Python code. Use commas to separate modules.                                                                              |
| `NODE_ENV`                        | Empty                                                    | Standard Node environment variable. Internal address checks are relaxed in `development`.                                                      |
| `HOSTNAME`                        | `localhost`                                              | Sandbox service host used for local-address detection.                                                                                         |
| `PORT`                            | `3000`                                                   | Sandbox local service port used for local-address detection. Actual listening uses `SANDBOX_PORT` first.                                       |

## Volume Manager Variables

These variables are loaded and validated by `projects/volume-manager/src/env.ts`. The `AGENT_SANDBOX_OPENSANDBOX_VOLUME_MANAGER_TOKEN` used by FastGPT for persistent OpenSandbox volumes must match `VM_AUTH_TOKEN`.

| Variable                   | Default                | Description                                                                                                                |
| -------------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `PORT`                     | `3000`                 | Volume Manager listening port.                                                                                             |
| `VM_AUTH_TOKEN`            | None, **required**     | API authentication token for Volume Manager.                                                                               |
| `VM_RUNTIME`               | `kubernetes`           | Runtime type, either `docker` or `kubernetes`.                                                                             |
| `VM_DOCKER_SOCKET`         | `/var/run/docker.sock` | Docker socket path. Required only in `docker` mode.                                                                        |
| `VM_DOCKER_API_VERSION`    | `v1.44`                | Docker API version. Required only in `docker` mode.                                                                        |
| `VM_K8S_NAMESPACE`         | `opensandbox`          | Kubernetes namespace. Required only in `kubernetes` mode.                                                                  |
| `VM_K8S_PVC_STORAGE_CLASS` | Empty                  | Kubernetes PVC StorageClass. Required only in `kubernetes` mode. The value is written to the PVC `storageClassName` as is. |
| `VM_LOG_LEVEL`             | `info`                 | Log level. Supported values are `debug`, `info`, and `none`.                                                               |
