JD.SemanticKernel.Connectors.GitHubCopilot
0.1.14
dotnet add package JD.SemanticKernel.Connectors.GitHubCopilot --version 0.1.14
NuGet\Install-Package JD.SemanticKernel.Connectors.GitHubCopilot -Version 0.1.14
<PackageReference Include="JD.SemanticKernel.Connectors.GitHubCopilot" Version="0.1.14" />
<PackageVersion Include="JD.SemanticKernel.Connectors.GitHubCopilot" Version="0.1.14" />
<PackageReference Include="JD.SemanticKernel.Connectors.GitHubCopilot" />
paket add JD.SemanticKernel.Connectors.GitHubCopilot --version 0.1.14
#r "nuget: JD.SemanticKernel.Connectors.GitHubCopilot, 0.1.14"
#:package JD.SemanticKernel.Connectors.GitHubCopilot@0.1.14
#addin nuget:?package=JD.SemanticKernel.Connectors.GitHubCopilot&version=0.1.14
#tool nuget:?package=JD.SemanticKernel.Connectors.GitHubCopilot&version=0.1.14
JD.SemanticKernel.Connectors.GitHubCopilot
Use your GitHub Copilot subscription as an AI backend for Microsoft Semantic Kernel applications.
This connector reads your local Copilot OAuth credentials, exchanges them for short-lived API tokens, and injects authentication into SK's OpenAI-compatible chat completion — giving you access to GPT-4o, Claude, Gemini, and more through a single Copilot subscription.
Quick Start
dotnet add package JD.SemanticKernel.Connectors.GitHubCopilot
using JD.SemanticKernel.Connectors.GitHubCopilot;
using Microsoft.SemanticKernel;
// One-liner: reads credentials from your local Copilot installation
var kernel = Kernel.CreateBuilder()
.UseCopilotChatCompletion()
.Build();
// Use any model available through Copilot
var kernel = Kernel.CreateBuilder()
.UseCopilotChatCompletion(CopilotModels.ClaudeSonnet4)
.Build();
How It Works
┌──────────────────────┐ ┌─────────────────┐ ┌──────────────────────┐
│ Local Copilot Auth │ │ Token Exchange │ │ Copilot API │
│ apps.json/hosts.json│────▶│ api.github.com │────▶│ chat/completions │
│ (ghu_* OAuth token) │ │ /copilot_internal│ │ (OpenAI-compatible) │
└──────────────────────┘ │ /v2/token │ └──────────────────────┘
└─────────────────┘
▲ Short-lived token
│ (~30 min TTL)
│ Auto-refreshed
- Reads your local Copilot OAuth token from
%LOCALAPPDATA%/github-copilot/apps.json(Windows) or~/.config/github-copilot/hosts.json(Linux/macOS) - Exchanges it for a short-lived API token via GitHub's internal token endpoint
- Caches the API token with TTL-aware refresh (thread-safe, SemaphoreSlim double-check locking)
- Injects auth headers into every SK request via a DelegatingHandler
Available Models
Copilot provides access to 41+ models from multiple AI providers through a single subscription.
Use CopilotModelDiscovery to discover all available models at runtime, or reference well-known constants:
Key Models (Constants)
| Constant | Model ID | Provider | Best For |
|---|---|---|---|
| Anthropic | |||
CopilotModels.ClaudeOpus46 |
claude-opus-4.6 |
Anthropic | Deep reasoning, complex analysis |
CopilotModels.ClaudeOpus46Fast |
claude-opus-4.6-fast |
Anthropic | Faster Opus variant |
CopilotModels.ClaudeSonnet46 |
claude-sonnet-4.6 |
Anthropic | Balanced quality/speed (default) |
CopilotModels.ClaudeSonnet4 |
claude-sonnet-4 |
Anthropic | Reliable completions |
CopilotModels.ClaudeHaiku45 |
claude-haiku-4.5 |
Anthropic | Fast, lightweight tasks |
| OpenAI | |||
CopilotModels.Gpt53Codex |
gpt-5.3-codex |
OpenAI | Latest code-specialized model |
CopilotModels.Gpt52 |
gpt-5.2 |
OpenAI | Complex reasoning |
CopilotModels.Gpt51Codex |
gpt-5.1-codex |
OpenAI | Code generation |
CopilotModels.Gpt5Mini |
gpt-5-mini |
Azure OpenAI | Fast general-purpose |
CopilotModels.Gpt4o |
gpt-4o |
Azure OpenAI | Multimodal |
CopilotModels.Gemini31Pro |
gemini-3.1-pro-preview |
Latest Gemini model | |
CopilotModels.Gemini3Pro |
gemini-3-pro-preview |
Long-context reasoning | |
CopilotModels.Gemini3Flash |
gemini-3-flash-preview |
Fast responses | |
| xAI | |||
CopilotModels.GrokCodeFast1 |
grok-code-fast-1 |
xAI | Code generation |
Runtime Discovery
var discovery = new CopilotModelDiscovery(provider, httpClient, logger);
var models = await discovery.DiscoverModelsAsync();
// Returns all 41+ models including embedding and legacy variants
Configuration
Options
var kernel = Kernel.CreateBuilder()
.UseCopilotChatCompletion(CopilotModels.ClaudeSonnet46, options =>
{
// Override token file location
options.TokenFilePath = "/custom/path/apps.json";
// GitHub Enterprise Server
options.GitHubHost = "github.enterprise.com";
// Enterprise SSL bypass
options.DangerouslyDisableSslValidation = true;
// Custom endpoint
options.CustomEndpoint = "https://proxy.internal/copilot";
})
.Build();
Dependency Injection
services.AddCopilotAuthentication(configuration);
// or
services.AddCopilotAuthentication(o => o.OAuthToken = "ghu_...");
Environment Variables
| Variable | Description |
|---|---|
GITHUB_COPILOT_TOKEN |
Override OAuth token (skips file lookup) |
Packages
| Package | Description |
|---|---|
JD.SemanticKernel.Connectors.Abstractions |
Shared interfaces for multi-provider connectors |
JD.SemanticKernel.Connectors.GitHubCopilot |
GitHub Copilot authentication connector |
JD.Tools.CopilotChat |
jdcplt — Interactive chat CLI demo |
Sample CLI: jdcplt
dotnet tool install -g JD.Tools.CopilotChat
# Interactive chat
jdcplt
# Single prompt
jdcplt --prompt "Explain async/await in C#"
# Choose a model
jdcplt --model claude-sonnet-4 --prompt "Write a haiku about code"
# List available models
jdcplt --list-models
# Enterprise SSL bypass
jdcplt --insecure
Documentation
Full documentation is available at GitHub Pages
or in the docs/ directory:
Related Projects
- JD.SemanticKernel.Connectors.ClaudeCode — Same pattern for Claude Code subscriptions
- JD.SemanticKernel.Extensions — SK extensions for skills, hooks, plugins, compaction, and semantic memory
Both connectors implement the shared JD.SemanticKernel.Connectors.Abstractions interfaces,
enabling MCP server bridging across subscriptions.
Building
git clone https://github.com/JerrettDavis/JD.SemanticKernel.Connectors.GitHubCopilot.git
cd JD.SemanticKernel.Connectors.GitHubCopilot
dotnet build
dotnet test
Contributing
See CONTRIBUTING.md for guidelines.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- JD.SemanticKernel.Connectors.Abstractions (>= 0.1.14)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.3)
- System.Text.Json (>= 10.0.3)
-
net10.0
- JD.SemanticKernel.Connectors.Abstractions (>= 0.1.14)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.3)
- Microsoft.SemanticKernel (>= 1.72.0)
-
net8.0
- JD.SemanticKernel.Connectors.Abstractions (>= 0.1.14)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.3)
- Microsoft.SemanticKernel (>= 1.72.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on JD.SemanticKernel.Connectors.GitHubCopilot:
| Package | Downloads |
|---|---|
|
JD.AI.Core
Core library for JD.AI — agents, providers, sessions, tools, orchestration, and event bus. Shared by the TUI, Gateway, and channel adapters. |
GitHub repositories
This package is not used by any popular GitHub repositories.