Shared interfaces and base types for JD Semantic Kernel connectors. Defines ISessionProvider, IModelDiscoveryProvider, SessionCredentials, and SessionOptionsBase for multi-provider AI authentication.
$ dotnet add package JD.SemanticKernel.Connectors.AbstractionsUse 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.
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();
┌──────────────────────┐ ┌─────────────────┐ ┌──────────────────────┐
│ 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
%LOCALAPPDATA%/github-copilot/apps.json (Windows) or ~/.config/github-copilot/hosts.json (Linux/macOS)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:
| 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 |
var discovery = new CopilotModelDiscovery(provider, httpClient, logger);
var models = await discovery.DiscoverModelsAsync();
// Returns all 41+ models including embedding and legacy variants
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();
services.AddCopilotAuthentication(configuration);
// or
services.AddCopilotAuthentication(o => o.OAuthToken = "ghu_...");
| Variable | Description |
|---|---|
GITHUB_COPILOT_TOKEN | Override OAuth token (skips file lookup) |
| 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 |
jdcpltdotnet 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
Full documentation is available at GitHub Pages
or in the docs/ directory:
Both connectors implement the shared JD.SemanticKernel.Connectors.Abstractions interfaces,
enabling MCP server bridging across subscriptions.
git clone https://github.com/JerrettDavis/JD.SemanticKernel.Connectors.GitHubCopilot.git
cd JD.SemanticKernel.Connectors.GitHubCopilot
dotnet build
dotnet test
See CONTRIBUTING.md for guidelines.