Use Xantly with GitHub Copilot CLI
Skip the $10/mo Copilot subscription. Four env vars and Copilot CLI routes through Xantly for smart model selection, semantic cache, and cost control, no GitHub auth required.
Skip the $10/mo Copilot subscription. Keep the agent. Own your tokens.
On April 7, 2026, GitHub shipped BYOK support for the Copilot CLI, four environment variables and no GitHub auth required. Point them at Xantly and you get Copilot's coding agent with Xantly's routing, semantic cache, and memory underneath. Your tokens, your margins, no subscription on top.
This is the cleanest "escape hatch" integration in the ecosystem right now. 2-minute setup.
Prerequisites
- GitHub Copilot CLI installed:
gh extension install github/gh-copilot(requires theghCLI) - A Xantly API key, create one if you don't have one yet
Setup
Export four environment variables and the Copilot CLI will route every request through Xantly instead of GitHub's proxy:
export COPILOT_PROVIDER_BASE_URL="https://api.xantly.com/v1"
export COPILOT_PROVIDER_API_KEY="sk-..." # your Xantly key
export COPILOT_MODEL="xantly/auto-quality" # or a specific model
export COPILOT_PROVIDER_TYPE="openai" # Xantly speaks OpenAI-compatible
Drop those in your ~/.zshrc or ~/.bashrc to make them persistent.
Model choice
COPILOT_MODEL accepts any model ID from Xantly's catalog. Recommended:
| Setting | Behavior |
|---|---|
xantly/auto-quality | BaRP routes from the most capable models (Claude Sonnet, GPT-5.x, etc.). Best for complex refactors. |
xantly/auto-value | balanced models, balanced cost/quality. Best default for daily use. |
xantly/auto-speed | Lowest measured latency that still clears the quality bar. Best for git commit messages, quick edits. |
bedrock/claude-sonnet-4-6/us-east-1 | Pin to a specific Anthropic model. Xantly honors it exactly, no re-routing. |
bedrock/gpt-oss-120b-1/us-east-1 | Pin to OpenAI. Xantly passes through. |
Run curl https://api.xantly.com/v1/models -H "Authorization: Bearer $COPILOT_PROVIDER_API_KEY" to see the full live catalog.
Verify
gh copilot suggest "a command that finds all files larger than 1MB"
The CLI will call Xantly, which routes to a cost-optimal model, returns the answer, and logs the request in your Xantly dashboard. Open the dashboard, you'll see the request, the model it landed on, the cache status, and the cost in USD.
What you get that stock Copilot CLI doesn't
- Semantic cache. Repeated prompts (you often re-run
gh copilot suggestwith slight variations) hit L1/L2 cache and return instantly at near-zero cost. - Waterfall fallback. If OpenAI 500s, Xantly silently falls back to Anthropic or Groq. Copilot CLI just keeps working.
- Per-request cost visibility. Every call is tracked. See which commands cost you what.
- Memory. Ask Copilot the same question in two weeks, Xantly's memory layer can surface the prior answer if you opt in via
X-Xantly-Memory-Mode: recall. - Budget caps. Set a monthly USD budget per API key. When you hit it, Xantly returns 402 instead of running up a bill.
Cost comparison
A developer running ~200 Copilot CLI requests/day on Copilot Pro at $10/mo pays flat regardless of usage. The same pattern through Xantly at smart routing:
- 70% of requests hit
xantly/auto-speed(cents/day) - 25% hit
xantly/auto-value - 5% hit
xantly/auto-quality - Typical monthly cost: $3-6, plus semantic-cache savings on repeats.
You break even vs Copilot Pro around 30-50 requests/day. Power users routinely save 40-60%.
Troubleshooting
COPILOT_PROVIDER_BASE_URL is ignored. Make sure you're on gh copilot version 1.4.0+ (released April 7, 2026). Run gh copilot --version to check.
Rate-limit errors from Xantly. Set COPILOT_MODEL=xantly/auto-speed to prefer the lowest-latency models, or upgrade your Xantly plan.
Model not found. Make sure the model ID is in GET /v1/models. The CLI doesn't pre-validate; Xantly returns 400 with the list of valid IDs if you typo a slug.
Next steps
- Cline in VS Code, same "BYOK every agent call" pattern but with full IDE integration.
- Bring Your Own Key, if you already have provider credits and want Xantly to use them instead of its catalog credentials.
- Intelligence Modes, fine-tune the pipeline (memory on/off, cache aggressiveness) per request via
X-Xantly-Intelligence-Modeheader.