User Guide · 11

Environment Variable Configuration

Tip: From v2.x, all API Keys can be configured per-user in Settings → General → API Keys (AES-256-GCM encrypted storage), taking priority over environment variables. Environment variables are mainly for initial deployment or fallback.

11.1 Required (at least one)

VariableDescription
ANTHROPIC_API_KEYAnthropic API key (Claude series)
OPENAI_API_KEYOpenAI API key (GPT + multimedia generation)

11.2 Provider Endpoint Overrides

VariableDescription
ANTHROPIC_BASE_URLCustom Anthropic API endpoint
OPENAI_BASE_URLCustom OpenAI API endpoint

11.3 Per-Capability Overrides

When a capability needs a different API Key or endpoint from the main provider:

CapabilityKey VariableURL Variable
Image generationIMAGE_API_KEYIMAGE_BASE_URL
TTS voiceTTS_API_KEYTTS_BASE_URL
Video generationVIDEO_API_KEYVIDEO_BASE_URL
Realtime voice S2SS2S_API_KEYS2S_BASE_URL
Speech-to-text STTSTT_API_KEYSTT_BASE_URL

11.4 Web Search Tools

VariableDescription
CLOUDSWAY_SEARCH_KEYCloudsWay search API (preferred)
CLOUDSWAY_READ_URLCloudsWay web fetch endpoint (optional override)
CLOUDSWAY_SEARCH_URLCloudsWay search endpoint (optional override)
TAVILY_API_KEYTavily search API (fallback)

11.5 S3 Storage (Optional)

VariableDescription
STORAGE_BACKENDlocal (default) or s3
S3_BUCKETS3 bucket name
S3_REGIONS3 region
S3_ENDPOINT_URLCustom endpoint (MinIO/R2/OSS)
S3_ACCESS_KEY_IDS3 access key
S3_SECRET_ACCESS_KEYS3 secret key
S3_PREFIXS3 key prefix (optional)

Note: JSON config files (users.json, conversations, etc.) currently remain on local disk. S3 mode only hosts the filesystem layer (docs/, scripts/, generated/, soul/).

11.6 Encryption Master Key

VariableDescription
ENCRYPTION_KEYAES-256-GCM master key for per-admin API Keys (if not set, auto-generates data/encryption.key on first startup)

In production, strongly recommend explicitly setting ENCRYPTION_KEY and backing it up properly. If the master key file is lost, all users' API Keys will be unrecoverable.

11.7 Script Sandbox Tuning

VariableDefaultDescription
SCRIPT_CONCURRENCY4Global concurrent script count
SCRIPT_QUEUE_TIMEOUT180Queue timeout (seconds)

11.8 Port Configuration

VariableDefaultDescription
BACKEND_PORT8000FastAPI port (Docker)
FRONTEND_PORT3000Express/Vite port
API_TARGEThttp://localhost:8000Express proxy target

11.9 Observability

VariableDescription
LANGFUSE_SECRET_KEYLangfuse secret key
LANGFUSE_PUBLIC_KEYLangfuse public key
LANGFUSE_HOSTLangfuse server address
LANGCHAIN_TRACING_V2Enable LangSmith
LANGCHAIN_API_KEYLangSmith API Key