JD.SemanticKernel.Connectors.GitHubCopilot
0.1.7
See the version list below for details.
dotnet add package JD.SemanticKernel.Connectors.GitHubCopilot --version 0.1.7
NuGet\Install-Package JD.SemanticKernel.Connectors.GitHubCopilot -Version 0.1.7
<PackageReference Include="JD.SemanticKernel.Connectors.GitHubCopilot" Version="0.1.7" />
<PackageVersion Include="JD.SemanticKernel.Connectors.GitHubCopilot" Version="0.1.7" />
<PackageReference Include="JD.SemanticKernel.Connectors.GitHubCopilot" />
paket add JD.SemanticKernel.Connectors.GitHubCopilot --version 0.1.7
#r "nuget: JD.SemanticKernel.Connectors.GitHubCopilot, 0.1.7"
#:package JD.SemanticKernel.Connectors.GitHubCopilot@0.1.7
#addin nuget:?package=JD.SemanticKernel.Connectors.GitHubCopilot&version=0.1.7
#tool nuget:?package=JD.SemanticKernel.Connectors.GitHubCopilot&version=0.1.7
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 multiple AI providers through a single subscription:
| Constant | Model ID | Provider |
|---|---|---|
CopilotModels.Gpt4o |
gpt-4o |
OpenAI |
CopilotModels.Gpt41 |
gpt-4.1 |
OpenAI |
CopilotModels.O4Mini |
o4-mini |
OpenAI |
CopilotModels.ClaudeSonnet4 |
claude-sonnet-4 |
Anthropic |
CopilotModels.ClaudeSonnet35 |
claude-3.5-sonnet |
Anthropic |
CopilotModels.Gemini20Flash |
gemini-2.0-flash |
|
CopilotModels.Gemini25Pro |
gemini-2.5-pro |
Discover models at runtime:
var discovery = new CopilotModelDiscovery(provider, httpClient, logger);
var models = await discovery.DiscoverModelsAsync();
Configuration
Options
var kernel = Kernel.CreateBuilder()
.UseCopilotChatCompletion(CopilotModels.Gpt4o, 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
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.7)
- 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.7)
- 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.7)
- 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.