Skip to main content
Environment variables are read by different surfaces. Prefer explicit SDK options or CLI config when you need per-call behavior; use environment variables for process-level configuration and secrets.

Core client variables

VariableUsed byDescription
WEBCOMPUTE_API_KEYSDK, CLI, MCPWebcompute API key. Overrides stored CLI config for CLI/MCP. Required by the SDK unless passed as new Web({ apiKey }).
WEBCOMPUTE_SERVER_URLSDK, CLI, MCPGateway URL. Defaults to https://api.webcompute.dev. http is accepted only for localhost or loopback.
WEBCOMPUTE_TIMEOUTTypeScript SDKDefault SDK request timeout in milliseconds. Defaults to 120000. Non-integer values fall back to the default.
WEBCOMPUTE_DEBUGSDK, CLI, MCPSet to true for debug logging and more verbose diagnostics.

MCP variables

VariableDescription
WEBCOMPUTE_MCP_SURFACEMCP surface: runtime, agent, or all. Defaults to runtime.
WEBCOMPUTE_MCP_DEFAULT_BROWSER_POLICYJSON object used as the default browser policy for MCP-created browsers. Must parse to an object.
MCP_TRANSPORTMCP transport: stdio or http. Defaults to stdio.
MCP_HOSTHTTP bind host. HTTP transport must bind to a loopback host.
MCP_PORTHTTP port.
PORTFallback HTTP port when MCP_PORT is not set. Defaults to 8932.

Agent model variables

These variables configure MCP run_web_agent when it is enabled on the agent or all surface. SDK web.agent() still requires explicit model config.
VariableDescription
WEBCOMPUTE_MODEL_PROFILESaved model profile name for MCP run_web_agent model selection.
WEBCOMPUTE_AGENT_MODELDirect model ID for MCP run_web_agent.
WEBCOMPUTE_AGENT_MODEL_ROUTEModel route: openai, openrouter, openai-compatible, anthropic, or google.
WEBCOMPUTE_AGENT_MODEL_API_KEY_ENVName of the environment variable containing the model-provider API key.
WEBCOMPUTE_AGENT_MODEL_BASE_URLBase URL for openai-compatible or compatible gateway routes.
WEBCOMPUTE_AGENT_MODEL_APIProvider API family: chat-completions or responses.
Common provider credential variables:
VariableTypical use
OPENAI_API_KEYOpenAI route.
OPENROUTER_API_KEYOpenRouter route.
ANTHROPIC_API_KEYAnthropic route.
GEMINI_API_KEYGoogle Gemini route.
GOOGLE_API_KEYGoogle credential alternative.
Model profiles store these provider credential variable names, not the raw provider key values. The key values are read from the environment at run time.

CLI local-runtime variables

VariableDescription
XDG_CONFIG_HOMEOverrides config-file base directory.
XDG_DATA_HOMEOverrides data-file base directory.
XDG_STATE_HOMEOverrides state-file base directory.
XDG_CACHE_HOMEOverrides cache-file base directory.
OPENCODE_CONFIGOpenCode config path used by local plugin detection/configuration.
OPENCODE_CONFIG_DIROpenCode config directory used by local plugin detection/configuration.
SHELLUsed by install/setup flows that reason about shell profile updates.
PATHUsed by install/setup flows and local runtime detection.
WC_NO_UNICODEDisable Unicode UI symbols when set by the environment.
WEBCOMPUTE_NO_UPDATE_NOTIFIERSet to 1 or true to suppress CLI update hints and the background update-manifest check.
WEBCOMPUTE_PACKAGES_BASE_URLOverride package download base URL for managed local installs.
WEBCOMPUTE_INSTALL_BASE_URLOverride installer base URL for managed local installs.

Local browser-development variables

These are for repo-local browser-server development, not public SDK usage.
VariableDescription
DISPLAYX display for local browser server development. In containerized dev, use DISPLAY=:1.
LIBGL_ALWAYS_SOFTWAREForce software GL rendering in containers. Use LIBGL_ALWAYS_SOFTWARE=1 when Chrome crashes due to GL.

Release/runtime variables

VariableDescription
WEBCOMPUTE_BROWSER_RUNTIME_MATRIX_IDMatrix ID for a promoted browser runtime snapshot. Preserve it with deployment records so rollbacks restore the matching snapshot/runtime tuple.

Secret handling

Use environment-backed secrets for agent runs:
export VENDOR_PASSWORD="..."
web agent --secret password=VENDOR_PASSWORD "Sign in and collect the current invoice total."
Do not place raw API keys, passwords, cookies, proxy URLs, or signed Debug/CDP URLs in prompts.