Authenticate with GitHub
Default device flow
Run theauth command to start a GitHub OAuth device flow:
github.com/login/device in your browser, enter the code, and approve the login. Once approved, the proxy saves your GitHub token locally under ~/.local/share/copilot-api/ (Linux/macOS) or %USERPROFILE%\.local\share\copilot-api\ (Windows).
You only need to authenticate once. The proxy refreshes the Copilot token automatically at runtime.
OpenCode OAuth app
If you use OpenCode, authenticate with the OpenCode OAuth app. This behaves identically to OpenCode’s built-in GitHub Copilot provider and carries no additional Terms of Service implications:Provide a token directly
If you already have a GitHub token (generated by runningauth previously), you can pass it directly to the start command instead of going through the device flow again:
GitHub Enterprise
To connect to a GitHub Enterprise instance, pass the enterprise hostname:Manage multiple accounts
You can register more than one GitHub account and the proxy will route requests across them automatically. Premium model requests use accounts in order and fall back when quota is exhausted. Free model requests are distributed round-robin by default.Add an account
List accounts
Remove an account
The index used in
auth rm is 1-based, matching the list shown by auth ls. The /usage/:accountIndex API endpoint uses a 0-based index.Require API keys from clients
By default the proxy accepts requests from any client. To require authentication, add one or more API keys toconfig.json:
Location: ~/.local/share/copilot-api/config.json (Linux/macOS) or %USERPROFILE%\.local\share\copilot-api\config.json (Windows)
config.json. Clients must then send one of the configured keys with every request using either header:
When no keys are configured, authentication is disabled and the proxy accepts all requests. The
auth.apiKeys field takes precedence over the legacy COPILOT_API_KEY environment variable, which is still accepted for backward compatibility.Admin UI access control
The Admin UI (/admin) and Admin API (/api/admin/*) use separate access control from the client API keys above:
- Loopback access (
localhost,127.0.0.1,::1) is always allowed without a token. - Remote access requires setting the
ADMIN_TOKENenvironment variable on the server and sending it viax-admin-token: <token>orAuthorization: Bearer <token>.