Connect Copilot CLI to ModelGo: Setup & Troubleshooting

GitHub Copilot CLI supports BYOK (Bring Your Own Key). With the provider environment variables set, it sends model requests to ModelGo's OpenAI-compatible API. Before you start, create an API key in the ModelGo console and pick a logical model that supports tool calling and streaming from the Model Catalog.

Configure and start

Set these in the terminal that starts Copilot CLI:

bash
export MODELGO_API_KEY="mgk_your_api_key"
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

Run a read-only task in the session (for example, "list the project's entry files") to verify. To check the key and the models it can call:

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

Troubleshooting

  • Still calls the default model: make sure COPILOT_MODEL and COPILOT_PROVIDER_BASE_URL are visible in the current terminal, then restart copilot.
  • 401 / 403: check the API key and the logical model name.
  • 404: the Base URL must be https://api.modelgo.ai/v1.
  • Tool calls not supported: pick a model that supports tool calling and streaming in the Model Catalog.

Related docs