Variable reference
| Variable | Description | Default |
|---|---|---|
GH_TOKEN | GitHub personal access token. Skips the interactive OAuth flow. Must be a token generated by the auth subcommand. | None |
COPILOT_API_HOME | Custom data directory for tokens, config.json, and admin.sqlite. Equivalent to --api-home. | ~/.local/share/copilot-api (Linux/macOS) or %USERPROFILE%\.local\share\copilot-api (Windows) |
COPILOT_API_OAUTH_APP | OAuth app identifier. Set to opencode to use the opencode GitHub Copilot OAuth app. Equivalent to --oauth-app. | None (uses the default Copilot app) |
COPILOT_API_ENTERPRISE_URL | GitHub Enterprise hostname (e.g. company.ghe.com). Equivalent to --enterprise-url. | None |
ADMIN_TOKEN | Token required to access the Admin UI and Admin API from non-loopback addresses. When not set, admin routes are only accessible from localhost, 127.0.0.1, or ::1. | None |
ANTHROPIC_API_KEY | Anthropic API key for accurate Claude token counting. Equivalent to anthropicApiKey in config.json. The token counting endpoint is free; a $5 minimum balance is required only to activate API access. | None |
COPILOT_API_KEY | Deprecated. Legacy single API key for request authentication. Prefer auth.apiKeys in config.json. Used only when auth.apiKeys is empty. | None |
HTTP_PROXY | HTTP proxy URL. Applied when you start the server with the --proxy-env flag. | None |
HTTPS_PROXY | HTTPS proxy URL. Applied when you start the server with the --proxy-env flag. | None |
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
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:auth.apiKeysinconfig.json(preferred)COPILOT_API_KEYenvironment variable (deprecated fallback)apiKeyfield inconfig.json(deprecated fallback)