Copilot CLI

Install

GitHub Copilot CLI supports macOS, Linux, and Windows. For all other methods, defer to the official install docs.

npm (all platforms) (requires Node.js 22+)

npm install -g @github/copilot

Homebrew (macOS / Linux)

brew install copilot-cli

WinGet (Windows)

winget install GitHub.Copilot

Install script (macOS / Linux)

curl -fsSL https://gh.io/copilot-install | bash

After installing, confirm with copilot --version.

Connect TokenPulse

How it works

Copilot CLI uses GitHub-hosted models by default. The official docs provide a BYOK (Bring Your Own Key) capability that lets you use your own model provider — you switch by setting a group of COPILOT_PROVIDER_* environment variables before launch. TokenPulse uses the OpenAI-compatible type (the default value of COPILOT_PROVIDER_TYPE is openai).

Key points:

  • COPILOT_PROVIDER_BASE_URL takes TokenPulse’s OpenAI-compatible endpoint root https://api.tokenpulse.com/v1;
  • COPILOT_PROVIDER_API_KEY takes your TokenPulse API key;
  • COPILOT_MODEL specifies the model ID to use (you can also use the --model command-line flag).

Model capability requirements: The chosen model must support both tool calling (function calling) and streaming, otherwise Copilot CLI returns an error. The official docs recommend a model with a context window of at least 128k.

1. Get an API key

Sign in to the TokenPulse consoleAPI KeysCreate Key. Copy the full string starting with sk-. The plaintext is shown only once and cannot be viewed again after you leave the page.

2. Configure environment variables

Copilot CLI reads the following environment variables before launch:

VariableRequiredValue
COPILOT_PROVIDER_BASE_URLYeshttps://api.tokenpulse.com/v1
COPILOT_PROVIDER_API_KEYYesYour TokenPulse API key (sk-...)
COPILOT_MODELYesThe model ID to use (e.g. gpt-5.3-codex)
COPILOT_PROVIDER_TYPENoProvider type; defaults to openai, keep the default for TokenPulse

macOS / Linux (zsh or bash)

Append the following lines to ~/.zshrc or ~/.bashrc, then run source ~/.zshrc to apply them:

export COPILOT_PROVIDER_BASE_URL="https://api.tokenpulse.com/v1"
export COPILOT_PROVIDER_API_KEY="sk-XXXXXXX"
export COPILOT_MODEL="gpt-5.3-codex"

Windows (PowerShell, writes to the user-level environment)

[Environment]::SetEnvironmentVariable('COPILOT_PROVIDER_BASE_URL','https://api.tokenpulse.com/v1','User')
[Environment]::SetEnvironmentVariable('COPILOT_PROVIDER_API_KEY','sk-XXXXXXX','User')
[Environment]::SetEnvironmentVariable('COPILOT_MODEL','gpt-5.3-codex','User')

Windows (CMD)

setx COPILOT_PROVIDER_BASE_URL "https://api.tokenpulse.com/v1"
setx COPILOT_PROVIDER_API_KEY "sk-XXXXXXX"
setx COPILOT_MODEL "gpt-5.3-codex"

Both the PowerShell and CMD forms persist the user-level environment variable, and you need to open a new terminal window for it to be picked up. Once set, launch copilot to take effect.

Use caseModel ID
Primary codinggpt-5.3-codex
General-purpose flagship / complex reasoninggpt-5.5
Best valuegpt-5.4-mini

Model name format: In model names, version numbers are only accepted in dotted form (e.g. gpt-5.4); do not write them with hyphens (gpt-5-4).

The chosen model must support tool calling and streaming. The table above is just an example. Refer to the Models list for the exact Model IDs and endpoints; before connecting, verify them and confirm your group is authorized for the model.

4. Verify the connection

After setting the environment variables, launch Copilot CLI:

copilot

Send a message to confirm a normal reply; you can also specify a model at launch with --model:

copilot --model gpt-5.5

If you get an auth failure or a model-unavailable error, first check:

  • whether COPILOT_PROVIDER_BASE_URL includes /v1;
  • whether the environment variables are set and you’ve opened a new terminal;
  • whether the chosen model supports tool calling and streaming, and the Model ID matches the TokenPulse upstream.