Skip to main content

Environment variables

All variables are read once at startup; restart the server to apply a change.

Core​

VariableDefaultWhat it does
CPTR_DATA_DIR~/.cptrData directory for the database, config, uploads, and logs. The Docker image sets it to /data.
CPTR_LOG_LEVELINFOServer log level.
CPTR_LOG_FORMATtexttext or json (structured output for log collectors).
CPTR_AUDIT_LOG_LEVELNONENONE disables audit logging; METADATA records mutations; REQUEST adds redacted request bodies; REQUEST_RESPONSE adds redacted response bodies.
CPTR_AUDIT_LOG_PATH<data>/logs/audit.jsonlAudit log file location.
CPTR_AUDIT_LOG_ROTATION10 MBAudit log rotation size.
CPTR_AUDIT_MAX_BODY_SIZE2048Max bytes of request/response body captured per audit entry.
CPTR_AUDIT_EXCLUDED_PATHS/api/chats,/v1/chatPaths excluded from audit logging.
CPTR_LOG_UPSTREAM_REQUESTSfalseLog outgoing model API requests, for debugging model calls.
CPTR_UPSTREAM_REQUEST_LOG_PATH<data>/logs/upstream-requests.jsonlUpstream request log location.
CPTR_UPSTREAM_REQUEST_LOG_ROTATION50 MBUpstream request log rotation size.

Chat and agent tuning​

VariableDefaultWhat it does
CHAT_MAX_ITERATIONS2048Max tool-call iterations per turn before the agent is stopped.
ENABLE_CHAT_RECONCILE_ON_STARTUPtrueOn startup, recover chats left stuck by a crash.
CHAT_TOOL_MAX_CHARS50000Max characters of a tool's output kept in context.
CHAT_TOOL_COMMAND_MAX_CHARS8000Max characters of command output kept in context.
CHAT_COMPACT_TOKEN_THRESHOLD80000Token count that triggers context compaction.
CPTR_CLAUDE_CODE_MAX_BUFFER_SIZE134217728Stdout buffer size (bytes) for the Claude SDK subprocess.
CPTR_EXECUTE_TIMEOUTunsetDefault wait in seconds for run_command before it returns while the command keeps running.
CPTR_STREAM_CONNECT_TIMEOUT30Seconds to wait when connecting to a model stream.
CPTR_STREAM_READ_TIMEOUT300Seconds to wait for the next chunk from a model stream.
CPTR_STREAM_WRITE_TIMEOUT600Seconds to wait when writing to a model stream.

Scheduler​

VariableDefaultWhat it does
AUTOMATION_POLL_INTERVAL10How often (seconds) the scheduler checks for due automations.

Network​

VariableDefaultWhat it does
CPTR_CORS_ALLOWED_ORIGINS*Comma-separated list of browser origins allowed to call the API.

Web search providers​

Keys set here take precedence over keys entered in Settings. With no key at all, web search falls back to DuckDuckGo; otherwise the first configured provider in this order wins: Exa → Perplexity → Tavily → Brave → Firecrawl → SearXNG → DuckDuckGo.

VariableDefaultWhat it does
EXA_API_KEYunsetExa search.
PERPLEXITY_API_KEYunsetPerplexity search.
PERPLEXITY_BASE_URLunsetCustom Perplexity endpoint.
TAVILY_API_KEYunsetTavily search.
BRAVE_API_KEYunsetBrave search.
FIRECRAWL_API_KEYunsetFirecrawl search.
FIRECRAWL_BASE_URLunsetCustom Firecrawl endpoint.
SEARXNG_BASE_URLunsetSelf-hosted SearXNG instance.
CHAT_COMPLETIONS_SEARCH_API_KEYunsetSearch via an OpenAI-compatible chat-completions endpoint.
CHAT_COMPLETIONS_SEARCH_BASE_URLunsetBase URL for that endpoint.
CHAT_COMPLETIONS_SEARCH_MODELunsetModel for that endpoint.
XAI_API_KEYunsetUsed for Grok agent detection.
This content is for informational purposes only and does not constitute a warranty, guarantee, or contractual commitment. Open WebUI is provided "as is." See your license for applicable terms.