Skip to content

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.

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.

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.

  1. Run the login command:

    Terminal window
    openclaw models auth login-github-copilot

    You will be prompted to visit a URL and enter a one-time code. Keep the terminal open until it completes.

  2. Set a default model:

    Terminal window
    openclaw models set github-copilot/claude-opus-4.6

    Or in config:

    {
    agents: {
    defaults: { model: { primary: "github-copilot/claude-opus-4.6" } },
    },
    }

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.

You can use specific flags to make the authentication process even faster. These options let you skip manual steps or set preferred models automatically.

FlagDescription
--yesSkip the confirmation prompt
--set-defaultAlso apply the provider’s recommended default model
Terminal window
# Skip confirmation
openclaw models auth login-github-copilot --yes
# Login and set the default model in one step
openclaw models auth login --provider github-copilot --method device --set-default

Interactive 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:

PriorityVariableNotes
1COPILOT_GITHUB_TOKENHighest priority, Copilot-specific
2GH_TOKENGitHub CLI token (fallback)
3GITHUB_TOKENStandard 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.

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.

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.

{
agents: {
defaults: {
memorySearch: {
provider: "github-copilot",
// Optional: override the auto-discovered model
model: "text-embedding-3-small",
},
},
},
}
  1. OpenClaw resolves your GitHub token (from env vars or auth profile).
  2. It exchanges the token for a short-lived Copilot API token.
  3. It queries the Copilot /models endpoint to discover available embedding models.
  4. It picks the best model (prefers text-embedding-3-small).
  5. It sends embedding requests to the Copilot /embeddings endpoint.

Model availability depends on your GitHub plan. If no embedding models are available, OpenClaw skips Copilot and tries the next provider.

OpenClaw

OpenClaw Expert

Still stuck?

If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.