Skip to main content
Environment variables let you configure Copilot API without editing files, which is useful for Docker containers, scripted setups, and any environment where interactive prompts are not available. Variables are read at startup; changing them requires a server restart.

Variable reference

Usage examples

Providing a GitHub token directly

Useful in Docker or CI environments where interactive device-code authentication is not possible:

Setting a custom data directory

Using opencode OAuth

Connecting to GitHub Enterprise

Enabling remote admin access

Once set, include the token in admin requests as x-admin-token: <token> or Authorization: Bearer <token>.

Enabling Claude token counting

Using a proxy

Proxy variables (HTTP_PROXY, HTTPS_PROXY) are only read when you pass the --proxy-env flag to the start command. Without that flag, proxy settings are ignored even if the variables are set.

Variable precedence for API keys

When determining which API keys to enforce, the server checks in this order:
  1. auth.apiKeys in config.json (preferred)
  2. COPILOT_API_KEY environment variable (deprecated fallback)
  3. apiKey field in config.json (deprecated fallback)
If none of these are set, authentication is disabled and all requests are accepted.

Docker compose example

Never commit files containing GH_TOKEN, ADMIN_TOKEN, or ANTHROPIC_API_KEY to source control. Use secrets management or environment injection provided by your deployment platform.