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 --helpworks. - 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"
copilotIf 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"
copilotAsk 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
- First API Call: Create a key, list models, and verify ModelGo.
- GitHub Copilot CLI BYOK: Review provider variables and model requirements.
- Authentication: Learn safe API key handling.