GitHub Copilot CLI with AI Gateway
GitHub Copilot CLI is GitHub's terminal coding agent. Its bring-your-own-key mode uses environment variables, so this mode needs no config file or GitHub sign-in.
Run the Vercel CLI setup command for GitHub Copilot CLI:
npx vercel ai-gateway setup --agent copilotThe command exports COPILOT_PROVIDER_BASE_URL, COPILOT_PROVIDER_API_KEY, and COPILOT_MODEL from a managed block in your shell startup file. It doesn't write a config file.
If you can't use the Vercel CLI, configure GitHub Copilot CLI manually:
Go to the AI Gateway section in the Vercel dashboard sidebar and click API keys to create a new API key.
Copilot CLI activates its BYOK provider as soon as
COPILOT_PROVIDER_BASE_URLis set. Export all three variables in your shell:Terminalexport COPILOT_PROVIDER_BASE_URL="https://ai-gateway.vercel.sh/coding-agent/v1" export COPILOT_PROVIDER_API_KEY="your-ai-gateway-api-key" export COPILOT_MODEL="openai/gpt-6-astra"To persist them, add the same lines to your shell's startup file.
COPILOT_PROVIDER_API_KEYcarries the key, andCOPILOT_MODELselects the default gateway model.Open a new terminal so the variables are loaded, then start the agent:
TerminalcopilotGitHub sign-in is not required in this mode.
Set
COPILOT_MODELto any gateway model ID, or pass it per run:Terminalcopilot --model anthropic/claude-sonnet-5
View your usage, spend, and request activity in the AI Gateway section in the Vercel dashboard sidebar. See the observability documentation for more details.
| Variable | Description |
|---|---|
COPILOT_PROVIDER_BASE_URL | The gateway base URL: https://ai-gateway.vercel.sh/coding-agent/v1. Setting it activates BYOK mode. Required |
COPILOT_PROVIDER_API_KEY | Your AI Gateway API key. Required |
COPILOT_MODEL | Default gateway model ID, for example openai/gpt-6-astra. Optional |
- Browse the models catalog for available models
- Configure spend limits on your API key
Was this helpful?