Copilot CLI
Connect GitHub Copilot CLI to Yolo Router using a BYOK model.
- GitHub Copilot CLI is installed and available as
copilot. - A working Yolo Router endpoint, for example
https://api.yolorouter.com. - A Yolo Router API Key generated from the console.
- The model ID you want to use, for example
deepseek-v4-pro. It must exactly match the model ID in the Yolo Router console and support tool calling and streaming.
Why anthropic type is recommended
Some models, especially reasoning models, require
reasoning_contentto be echoed back verbatim in the next turn. Copilot CLI's OpenAI integration does not support that mechanism, which can trigger400errors.Using the Anthropic Messages API compatible endpoint avoids this. If you only use non-reasoning models, such as
gemini-2.5-flash, you can setCOPILOT_PROVIDER_TYPEtoopenaiinstead.
Setup
Check Copilot CLI
Run:
copilot --versionIf it is not installed yet, complete the official GitHub Copilot CLI installation first.
Set provider environment variables
Copilot CLI BYOK mode typically uses environment variables for the provider type, URL, key, and model. Use the anthropic type first.
export COPILOT_PROVIDER_TYPE="anthropic"
export COPILOT_PROVIDER_BASE_URL="https://api.yolorouter.com"
export COPILOT_PROVIDER_API_KEY="sk-yolo-..."
export COPILOT_MODEL="deepseek-v4-pro"$env:COPILOT_PROVIDER_TYPE = "anthropic"
$env:COPILOT_PROVIDER_BASE_URL = "https://api.yolorouter.com"
$env:COPILOT_PROVIDER_API_KEY = "sk-yolo-..."
$env:COPILOT_MODEL = "deepseek-v4-pro"set COPILOT_PROVIDER_TYPE=anthropic
set COPILOT_PROVIDER_BASE_URL=https://api.yolorouter.com
set COPILOT_PROVIDER_API_KEY=sk-yolo-...
set COPILOT_MODEL=deepseek-v4-proVariable reference:
COPILOT_PROVIDER_TYPE: recommended value isanthropicCOPILOT_PROVIDER_BASE_URL: Yolo Router gateway endpoint. Foranthropic, use the root endpointCOPILOT_PROVIDER_API_KEY: your Yolo Router API KeyCOPILOT_MODEL: the model ID to use
Optional: use OpenAI provider
If you only use non-reasoning models, you can use the OpenAI-compatible provider:
export COPILOT_PROVIDER_TYPE="openai"
export COPILOT_PROVIDER_BASE_URL="https://api.yolorouter.com/v1"
export COPILOT_PROVIDER_API_KEY="sk-yolo-..."
export COPILOT_MODEL="gemini-2.5-flash"$env:COPILOT_PROVIDER_TYPE = "openai"
$env:COPILOT_PROVIDER_BASE_URL = "https://api.yolorouter.com/v1"
$env:COPILOT_PROVIDER_API_KEY = "sk-yolo-..."
$env:COPILOT_MODEL = "gemini-2.5-flash"set COPILOT_PROVIDER_TYPE=openai
set COPILOT_PROVIDER_BASE_URL=https://api.yolorouter.com/v1
set COPILOT_PROVIDER_API_KEY=sk-yolo-...
set COPILOT_MODEL=gemini-2.5-flashOptional: persist the variables
If you want the setup to stick, add these variables to your shell profile or system environment variables.
Do not commit real API keys to your repository.
Run Copilot CLI
Start Copilot CLI:
copilotOr run a single command:
copilot "Introduce the model you are using in one sentence"Verify the connection
If Copilot CLI returns a normal response, the integration is working. You can also verify that models are reachable:
curl https://api.yolorouter.com/v1/models \
-H "Authorization: Bearer $COPILOT_PROVIDER_API_KEY"Troubleshooting
401 or auth failure
Check that COPILOT_PROVIDER_API_KEY is your Yolo Router API Key and has no extra spaces.
Model not found
Check that COPILOT_MODEL exactly matches the model ID in the Yolo Router console, and that the model supports tool calling and streaming.
404 or incompatible endpoint
If COPILOT_PROVIDER_TYPE=anthropic, check that COPILOT_PROVIDER_BASE_URL is the root endpoint https://api.yolorouter.com. If COPILOT_PROVIDER_TYPE=openai, use https://api.yolorouter.com/v1.
Reasoning models return 400
Use COPILOT_PROVIDER_TYPE=anthropic first. The OpenAI provider may not handle the reasoning_content echo required by some reasoning models.