Skip to content
Docs

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:

terminal
npx vercel 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.

If you can't use the Vercel CLI, configure GitHub Copilot CLI manually:

  1. Go to the AI Gateway section in the Vercel dashboard sidebar and click API keys to create a new API key.

  2. Copilot CLI activates its BYOK provider as soon as COPILOT_PROVIDER_BASE_URL is set. Export all three variables in your shell:

    Terminal
    export 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.

  3. Open a new terminal so the variables are loaded, then start the agent:

    Terminal
    copilot

    GitHub sign-in is not required in this mode.

  4. Set COPILOT_MODEL to any gateway model ID, or pass it per run:

    Terminal
    copilot --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.

VariableDescription
COPILOT_PROVIDER_BASE_URLThe gateway base URL: https://ai-gateway.vercel.sh/coding-agent/v1. Setting it activates BYOK mode. Required
COPILOT_PROVIDER_API_KEYYour AI Gateway API key. Required
COPILOT_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.

Last updated September 13, 2026

Was this helpful?

supported.