Copilot CLI

GitHub Copilot CLI supports BYOK. Provider environment variables can route model requests to ModelGo's OpenAI-compatible endpoint.

Prerequisites

  • Copilot CLI is installed and copilot --help works.
  • GitHub/Copilot authentication is complete.
  • A ModelGo API key is available from ModelGo Console.
  • You know a logical model ID that supports tool calling and streaming.

1. Configure ModelGo BYOK

Set these variables in the shell that starts Copilot CLI:

bash
export COPILOT_PROVIDER_TYPE=openai
export COPILOT_PROVIDER_BASE_URL="https://api.modelgo.ai/v1"
export COPILOT_PROVIDER_API_KEY="$MODELGO_API_KEY"
export COPILOT_MODEL="your-model-id"
copilot

If needed, define the key first:

bash
export MODELGO_API_KEY="sk-your-token"

The openai provider type targets OpenAI Chat Completions-compatible services.

2. Verify the model

bash
curl https://api.modelgo.ai/v1/models -H "Authorization: Bearer $MODELGO_API_KEY"
copilot

Ask Copilot CLI to perform a small read-only task, such as listing project entry points.

Troubleshooting

Copilot still uses its default model

Confirm COPILOT_MODEL and COPILOT_PROVIDER_BASE_URL are visible in the current shell, then restart copilot.

401, 404, or tool-call errors

Check the key, Base URL, and logical model ID. Choose a model with the required streaming and tool-calling capabilities.

Related docs