Connect GitHub Copilot to OpenClaw in 5 Minutes
Managing multiple AI subscriptions can feel like a full-time job when you just want to write code. If you already have a GitHub Copilot subscription, you can use it to power your local agents without any extra fees.
OpenClaw’s GitHub Copilot integration gives you access to high-end models through your existing GitHub account. You can use these models for both chat interactions and complex memory searches within your workspace.
Two ways to use Copilot in OpenClaw
Section titled “Two ways to use Copilot in OpenClaw”You have two primary methods to integrate your GitHub account with your local environment. Whether you prefer a direct login or using a VS Code bridge, the setup is quick.
1. Built-in provider (github-copilot)
Section titled “1. Built-in provider (github-copilot)”This is the default and simplest path because it does not require VS Code. You use the native device-login flow to obtain a GitHub token, which OpenClaw then exchanges for Copilot API tokens when it runs.
-
Run the login command:
Terminal window openclaw models auth login-github-copilotYou will be prompted to visit a URL and enter a one-time code. Keep the terminal open until it completes.
-
Set a default model:
Terminal window openclaw models set github-copilot/claude-opus-4.6Or in config:
{agents: {defaults: { model: { primary: "github-copilot/claude-opus-4.6" } },},}
2. Copilot Proxy plugin (copilot-proxy)
Section titled “2. Copilot Proxy plugin (copilot-proxy)”Use the Copilot Proxy VS Code extension as a local bridge. OpenClaw talks to the proxy’s /v1 endpoint and uses the model list you configure there. Choose this when you already run Copilot Proxy in VS Code or need to route through it. You must enable the plugin and keep the VS Code extension running.
Optional flags for GitHub Copilot
Section titled “Optional flags for GitHub Copilot”You can use specific flags to make the authentication process even faster. These options let you skip manual steps or set preferred models automatically.
| Flag | Description |
|---|---|
--yes | Skip the confirmation prompt |
--set-default | Also apply the provider’s recommended default model |
# Skip confirmationopenclaw models auth login-github-copilot --yes
# Login and set the default model in one stepopenclaw models auth login --provider github-copilot --method device --set-defaultInteractive TTY required. The device-login flow requires an interactive TTY. Run it directly in a terminal, not in a non-interactive script or CI pipeline.
Model availability depends on your plan. If a model is rejected, try another ID (for example github-copilot/gpt-4.1).
Transport selection. Claude model IDs use the Anthropic Messages transport automatically. GPT, o-series, and Gemini models keep the OpenAI Responses transport. OpenClaw selects the correct transport based on the model ref.
Environment variable resolution order. OpenClaw resolves Copilot auth from environment variables in the following priority order:
| Priority | Variable | Notes |
|---|---|---|
| 1 | COPILOT_GITHUB_TOKEN | Highest priority, Copilot-specific |
| 2 | GH_TOKEN | GitHub CLI token (fallback) |
| 3 | GITHUB_TOKEN | Standard GitHub token (lowest) |
When multiple variables are set, OpenClaw uses the highest-priority one. The device-login flow (openclaw models auth login-github-copilot) stores its token in the auth profile store and takes precedence over all environment variables.
Token storage. The login stores a GitHub token in the auth profile store and exchanges it for a Copilot API token when OpenClaw runs. You do not need to manage the token manually.
Memory search embeddings
Section titled “Memory search embeddings”GitHub Copilot can also serve as an embedding provider for memory search. If you have a Copilot subscription and have logged in, OpenClaw can use it for embeddings without a separate API key.
Auto-detection
Section titled “Auto-detection”When memorySearch.provider is "auto" (the default), GitHub Copilot is tried at priority 15 — after local embeddings but before OpenAI and other paid providers. If a GitHub token is available, OpenClaw discovers available embedding models from the Copilot API and picks the best one automatically.
Explicit config
Section titled “Explicit config”{ agents: { defaults: { memorySearch: { provider: "github-copilot", // Optional: override the auto-discovered model model: "text-embedding-3-small", }, }, },}How it works
Section titled “How it works”- OpenClaw resolves your GitHub token (from env vars or auth profile).
- It exchanges the token for a short-lived Copilot API token.
- It queries the Copilot
/modelsendpoint to discover available embedding models. - It picks the best model (prefers
text-embedding-3-small). - It sends embedding requests to the Copilot
/embeddingsendpoint.
Model availability depends on your GitHub plan. If no embedding models are available, OpenClaw skips Copilot and tries the next provider.
Related
Section titled “Related”- Model providers overview — choosing providers, model refs, and failover behavior.
- Gateway authentication — auth details and credential reuse rules.
OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.