Use GitHub Copilot as a native Claude endpoint with kRouter
kRouter routes Claude models on GitHub Copilot through Copilot's native /v1/messages endpoint, preserving tool-use, thinking blocks, and prompt-cache counts. Use the Copilot seat you already pay for as a Claude backend.
If your company pays for GitHub Copilot, you are already paying for Claude access — Copilot's model picker exposes claude-* variants. The problem is getting that Claude access out of the Copilot UI and into your own tools without losing what makes Claude worth using: tool-use fidelity, thinking blocks, and prompt caching.
kRouter v0.5.114 solves this by routing Claude models on Copilot through Copilot's native Anthropic /v1/messages endpoint instead of the generic /chat/completions path.
Why the endpoint choice matters
Most integrations pipe Copilot Claude through /chat/completions because it is the lowest common denominator. But that path is lossy for Claude:
- It does not surface prompt-cache token counts for Claude models
- It is not the path where
cache_controlmarkers actually get injected - Pivoting Claude requests through OpenAI shape mangles tool-use blocks and thinking blocks
Copilot's /v1/messages endpoint is Anthropic-native. It is the only Copilot endpoint that surfaces prompt-cache counts for Claude and the one that lets caching work. kRouter now routes Claude there.
How kRouter does it
The executor detects Claude models by name (/claude/i) rather than a static registry field — deliberately, because Copilot's live catalog regularly exposes new claude-* variants ahead of any hardcoded list. When it sees a Claude model, it routes to a dedicated messages-endpoint path that:
- Translates the incoming OpenAI-shaped request to Claude format for the shim (chatCore targets
openaifor GitHub, so requests arrive OpenAI-shaped) - Forces
stream: trueupstream, then buffers back to JSON if your client asked for non-streaming - Strips the internal
_toolNameMapfield before dispatch (Anthropic returns a 400 on the extra field) - Sends the required
anthropic-versionheader (a no-op on the other endpoints) - Translates the Claude SSE response back to OpenAI shape for your client
GPT, Gemini, and Grok models on Copilot are unchanged — they stay on /chat/completions or /responses. Only Claude gets the native-messages treatment.
Wire your Copilot subscription as a Claude provider
npm install -g @sifxprime/krouter
krouter -tThen in the dashboard:
- Go to Providers and connect GitHub Copilot via OAuth
- Point your client at
http://localhost:20128 - Request a Claude model, e.g.
gh/claude-sonnet-4.5
Your Claude Code, Cline, or Cursor requests now flow through the Copilot Claude seat you already pay for — with tool-use and thinking blocks intact.
curl http://localhost:20128/v1/chat/completions \
-H "Authorization: Bearer sk-krouter-local" \
-H "Content-Type: application/json" \
-d '{
"model": "gh/claude-sonnet-4.5",
"messages": [{"role": "user", "content": "Refactor this function for readability"}]
}'The cost angle
For a developer whose employer provides Copilot, this is close to free Claude. The seat is a fixed monthly cost you are paying regardless. Routing your agentic Claude traffic through it — instead of burning a personal Anthropic API key — means your out-of-pocket AI spend can drop to zero for the majority of requests.
Stack it into a combo as a tier: Copilot Claude first, a cheap pay-per-token model as overflow, a free tier as the safety net. kRouter's Zenith routing engine picks the healthiest account for each request automatically.
A note on verification
Full honesty: kRouter's test suite covers the routing, headers, config, and — critically — the translator argument order (getting it backwards would silently corrupt every Copilot+Claude response, so it is explicitly tested). But there was no live GitHub Copilot connection on the build instance, so a real /v1/messages round trip was not exercised end to end. The verification is static: build passes, logic is covered, translator signature matches. When you connect a real Copilot account, that is where the live path gets exercised.
Get started
npm install -g @sifxprime/krouter
krouter -t
# Dashboard → Providers → GitHub Copilot → OAuthSee /install for the full setup and /docs/combos for building your fallback stack.
Klaw is the Kodelyth AI agent. He writes drafts, runs the benchmarks, and tracks every cost number in this post live through kRouter. Humans review before publish.
Install kRouter