Most people don't know Copilot can do this yet: as of 2026, GitHub Copilot has GA'd Bring Your Own Key (BYOK). You can point Copilot Chat (in VS Code), the Copilot CLI, the Copilot app, and the Copilot SDK at any OpenAI-compatible endpoint, Anthropic, or Azure — including local runtimes and third-party gateways.
That's a big deal if you already pay for Copilot but want to run its chat and agent features on a model or a gateway of your choice. This guide covers all four surfaces, with the exact steps and one honest caveat that trips people up.
Disclosure: I work on daoxe, an OpenAI-compatible gateway that also speaks the Anthropic Messages protocol. It happens to line up neatly with Copilot's three wire protocols, so I use it as the example — but everything here works with any compatible endpoint. Substitute your own base URL.
The caveat, first (so nobody's misled)
BYOK affects Copilot Chat and agent sessions. It does not change inline completions. Those gray "Tab to accept" suggestions still run on Copilot's own infrastructure and are unaffected by your base URL. If your goal is to change what powers chat/agent, BYOK is for you. If you wanted to swap the model behind inline completions, BYOK won't do it. That's the honest scope.
Why a gateway fits Copilot's three protocols
Copilot's BYOK supports three provider "types", and a good multi-protocol gateway hits all three:
-
openai→ the gateway's/v1/chat/completions(default). -
openaiwithwireApi: "responses"→ the gateway's/v1/responses. -
anthropic→ the gateway's/v1/messages(Claude's native protocol).
So one key can serve GPT-shaped, Responses-shaped, and Claude-native requests, depending on which model you pick. Now the four ways to wire it.
1. Copilot CLI (easiest — just env vars)
export COPILOT_PROVIDER_BASE_URL=https://daoxe.com/v1
export COPILOT_PROVIDER_API_KEY=$DAOXE_API_KEY # your gateway key, from an env var
export COPILOT_MODEL=gpt-5.5 # any exact id from GET /v1/models
# optional: COPILOT_PROVIDER_TYPE=openai (default) | anthropic | azure
copilot
For Claude's native protocol, set COPILOT_PROVIDER_TYPE=anthropic and use the gateway's Anthropic entry point. Confirm the exact path with curl first — many gateways take the host root (https://daoxe.com) and let the client append /v1/messages; some want /v1. Don't assume; check your account.
2. Copilot Chat (VS Code)
- Command Palette →
Chat: Manage Language Models. - Choose OpenAI Compatible / Custom Endpoint.
-
Base URL:
https://daoxe.com/v1(it must serve/chat/completions). VS Code probesGET /modelsto fill the model dropdown — if your gateway supports it, models auto-populate; otherwise type the Model ID by hand. - Paste your API Key, pick a Model ID (e.g.
claude-sonnet-4-6) → Add Model.
The model now shows up in the Copilot Chat model picker alongside the built-ins.
3. Copilot App (desktop)
Settings → Model Providers → Add provider. Fill in the endpoint https://daoxe.com/v1 and your API key (or choose the anthropic type for Claude-native). Your models then appear in the model picker next to Copilot's hosted ones; the key is stored in your OS keychain.
4. Copilot SDK (for integrators)
provider: {
type: "openai", // or "anthropic"
baseUrl: "https://daoxe.com/v1", // full path; for anthropic, use your account's path
apiKey: process.env.DAOXE_API_KEY,
wireApi: "completions", // use "responses" when you need Responses-API behavior
}
Getting the model ids right
Copilot only calls what you tell it to, so use the exact ids your endpoint exposes:
curl https://daoxe.com/v1/models -H "Authorization: Bearer $DAOXE_API_KEY"
Guessed names fail silently or fall back. A gateway with an account-scoped /v1/models is ideal here, because the list you see is exactly the list you can call.
Troubleshooting
-
Model dropdown empty in VS Code? Your endpoint may not expose
GET /models, or the key lacks access. Type the id manually and confirm the key with thecurlabove. -
401 / auth errors? Check whether the provider expects
Authorization: Bearer(OpenAI type) vsx-api-key(some Anthropic setups). Match the provider type to the protocol. -
Anthropic type 404s? It's almost always the base URL shape — root vs
/v1. Verify against your gateway's docs. - Chat works but inline completions "didn't change"? Expected — see the caveat. Inline stays on Copilot's models.
What to look for in a BYOK target
Since you're choosing the backend now, pick one that is:
- Multi-protocol. OpenAI Chat Completions and Responses and Anthropic Messages, so all of Copilot's provider types work and Claude runs on its native protocol.
-
One key, many models, with an account-scoped
/v1/models. - Verifiable. Fine with you benchmarking it and checking it isn't silently downgrading you (there are open-source tools for exactly this).
- Reachable where official billing isn't. If your card keeps getting declined at an official checkout, a gateway that accepts other payment paths is the difference between shipping and not.
daoxe checks those boxes — OpenAI-compatible base URL (https://daoxe.com/v1), native Anthropic Messages, one key across many models — and it's not available in mainland China. But BYOK is the point: you're not locked in, so point Copilot at whatever endpoint you trust and can verify.
TL;DR
- Copilot BYOK works in Chat, CLI, App, and SDK — set a base URL + key.
- A multi-protocol gateway covers all three Copilot provider types (openai / responses / anthropic).
- Use exact model ids from
/v1/models. - Inline completions don't change — BYOK is for chat/agent only.

Top comments (0)