页面简介
Connect GitHub Copilot CLI to AI Gateway with the Vercel CLI or environment variables for the provider URL, API key, and model.
正文摘录
Copy pageCopy pageGitHub Copilot CLI with AI GatewayCopy pageCopy pageGitHub 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. Set up with the Vercel CLI Run the Vercel CLI setup command for GitHub Copilot CLI: terminalnpx vercel@latest ai-gateway setup --agent copilot The 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. Configuring GitHub Copilot CLI If you can't use the Vercel CLI, configure GitHub Copilot CLI manually: Create an API keyGo to the AI Gateway section in the Vercel dashboard sidebar and click API keys to create a new API key.Export the environment variablesCopilot CLI activates its BYOK provider as soon as COPILOT_PROVIDER_BASE_URL is 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_KEY carries the key, and COPILOT_MODEL selects the default gateway model.Start Copilot CLIOpen a new terminal so the variables are loaded, then start the agent:TerminalcopilotGitHub sign-in is not required in this mode.Switch modelsSet COPILOT_MODEL to any gateway model ID, or pass it per run:Terminalcopilot --model anthropic/claude-sonnet-5 Monitor usage and spend View your usage, spend, and request activity in the AI Gateway section in the Vercel dashboard sidebar. See the observability documentation for more details. Environment variables VariableDescriptionCOPILOT_PROVIDER_BASE_URLThe gateway base URL: https://ai-gateway.vercel.sh/coding-agent/v1. Setting it activates BYOK mode. RequiredCOPILOT_PROVIDER_API_KEYYour AI Gateway API key. RequiredCOPILOT_MODELDefault gateway model ID, for example openai/gpt-6-astra. Optional Copilot CLI calls AI Gateway through the OpenAI-compatible Chat Completions API, so any model that supports Chat Completions works. Next steps Browse the models catalog for available models Configure spend limits on your API key Last updated October 16, 2026PreviousfxNextGooseWas this helpful?