Skip to content

Environment variables

The environment variables Diffgazer reads and sets in packaged mode.

Diffgazer reads a handful of environment variables, and it sets a few internal values when it runs packaged. Most settings live in configuration rather than the environment, so reach for these only when you need to override where files live, how much it logs, or which port it binds.

Hosted products can also be configured through environment references instead of stored literals. In that case Diffgazer records only that the credential comes from the environment, resolves the product's canonical variable name below on the server, and reads the live value at runtime.

Variables you set

VariableEffectDefault
PORTPort for the API server. Must be an integer from 1 to 65535.3000
DIFFGAZER_HOMEMoves the global directory somewhere other than ~/.diffgazer.~/.diffgazer
DIFFGAZER_PROJECT_ROOTRepository root the server reviews. The packaged CLI sets this automatically.Git root of the current working directory
DIFFGAZER_LOG_LEVELLowest log level: debug, info, warn, or error.warn when packaged
DIFFGAZER_OFFLINESkips every live model-list request — the models.dev catalog and provider model lists — and serves the cached or bundled catalog.Off
DIFFGAZER_FORCE_KILL_DELAY_MSMilliseconds to wait after SIGTERM before SIGKILL.2000
GOOGLE_API_KEYCredential reference for Google Gemini.Unset
ZAI_API_KEYCredential reference for Z.AI general Open Platform PAYG.Unset
OPENROUTER_API_KEYCredential reference for OpenRouter.Unset
DEEPSEEK_API_KEYCredential reference for DeepSeek.Unset
QWEN_API_KEYCredential reference for Qwen International.Unset
MOONSHOT_API_KEYCredential reference for Moonshot Open Platform.Unset
MINIMAX_API_KEYCredential reference for MiniMax International.Unset
OLLAMA_API_KEYCredential reference for Ollama Cloud.Unset
OPENCODE_API_KEYCredential reference for OpenCode Zen, for both Zen credits and an OpenCode Go subscription.Unset

Example hosted reference without storing a literal in Diffgazer files:

bash
export GOOGLE_API_KEY=your-provider-key
diffgazer

Export the variable before you launch, then choose the environment-reference option during setup — Use environment reference in the web wizard, Use environment variable in the TUI (Import from Env in the Configure Provider dialog). You never type the variable name: each product is bound to the canonical name in the table above, and Diffgazer stores only that reference, never the value.

Info:

Note: Google Gemini reads GOOGLE_API_KEY, not GEMINI_API_KEY. The name follows the server-side credential map for the product.

Development-only escape hatch

DIFFGAZER_DEV_UNSAFE_PROJECT_ROOT=1 tells the standalone development server to trust the project-root request header. Packaged mode ignores it. Never enable it outside local development.

Optional split-development security

DIFFGAZER_SHUTDOWN_TOKEN enables the API token gate in every mode. The packaged CLI creates and sets it automatically. When you run the server and web app separately, set the same token on both sides.

bash
# Terminal 1
DIFFGAZER_SHUTDOWN_TOKEN=replace-with-one-random-value pnpm --filter @diffgazer/server dev

# Terminal 2
VITE_DIFFGAZER_SHUTDOWN_TOKEN=replace-with-one-random-value pnpm --filter @diffgazer/web dev

Configure both values together so the client and server use the same token.

Set automatically

The packaged CLI sets these itself. Do not set them by hand.

VariableWhat sets itWhy it exists
DIFFGAZER_CLI_PIDThe CLI at startupLets the embedded server terminate the parent CLI on shutdown.
DIFFGAZER_PACKAGEDThe CLI when serving the embedded appFlags packaged mode defaults such as log level and project-root resolution.