JD.SemanticKernel.Connectors.ClaudeCode 0.1.24

There is a newer version of this package available.
See the version list below for details.
dotnet add package JD.SemanticKernel.Connectors.ClaudeCode --version 0.1.24
                    
NuGet\Install-Package JD.SemanticKernel.Connectors.ClaudeCode -Version 0.1.24
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JD.SemanticKernel.Connectors.ClaudeCode" Version="0.1.24" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JD.SemanticKernel.Connectors.ClaudeCode" Version="0.1.24" />
                    
Directory.Packages.props
<PackageReference Include="JD.SemanticKernel.Connectors.ClaudeCode" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add JD.SemanticKernel.Connectors.ClaudeCode --version 0.1.24
                    
#r "nuget: JD.SemanticKernel.Connectors.ClaudeCode, 0.1.24"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package JD.SemanticKernel.Connectors.ClaudeCode@0.1.24
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=JD.SemanticKernel.Connectors.ClaudeCode&version=0.1.24
                    
Install as a Cake Addin
#tool nuget:?package=JD.SemanticKernel.Connectors.ClaudeCode&version=0.1.24
                    
Install as a Cake Tool

JD.SemanticKernel.Connectors.ClaudeCode

NuGet NuGet Downloads CI CodeQL codecov License: MIT

A Semantic Kernel connector for Anthropic models with API-key-first authentication and optional local Claude Code OAuth support.

Features

  • API-key-first authentication — supports sk-ant-api* via options or ANTHROPIC_API_KEY
  • Optional local OAuth supportsk-ant-oat* is opt-in and interactive-only
  • Multi-source credential resolution — options/env API key first, then local OAuth sources
  • Full Semantic Kernel integrationIKernelBuilder.UseClaudeCodeChatCompletion() one-liner
  • DI-friendlyIServiceCollection.AddClaudeCodeAuthentication() for ASP.NET Core / Generic Host
  • Broad TFM supportnetstandard2.0, net8.0, net10.0

Compliance Defaults

  • OAuth token support is disabled by default.
  • OAuth usage requires EnableOAuthTokenSupport = true and an interactive session.
  • Unattended or automated OAuth workflows are intentionally blocked.
  • For service, CI, or unattended usage, use Anthropic API keys (sk-ant-api*).
  • Anthropic Consumer Terms (effective October 8, 2025) apply to consumer-service usage: https://www.anthropic.com/legal/consumer-terms
  • Anthropic API keys are governed by Anthropic Commercial Terms: https://www.anthropic.com/legal/commercial-terms

Quick Start

Install

dotnet add package JD.SemanticKernel.Connectors.ClaudeCode
using JD.SemanticKernel.Connectors.ClaudeCode;

var builder = Kernel.CreateBuilder();
builder.UseClaudeCodeChatCompletion(apiKey: "sk-ant-api..."); // defaults to ClaudeModels.Default (Sonnet)
var kernel = builder.Build();

var result = await kernel.InvokePromptAsync("Hello, Claude!");
Console.WriteLine(result);

Service Collection (ASP.NET Core)

builder.Services.AddClaudeCodeAuthentication(options =>
{
    options.CredentialsPath = "/custom/path/.credentials.json"; // optional
    options.EnableOAuthTokenSupport = true; // only for local interactive OAuth use
});

Configuration Binding

{
  "ClaudeSession": {
    "ApiKey": null,
    "OAuthToken": null,
    "EnableOAuthTokenSupport": false,
    "CredentialsPath": null
  }
}
builder.Services.AddClaudeCodeAuthentication(builder.Configuration);

Credential Resolution Order

Priority Source Description
1 ClaudeSession:ApiKey Explicit API key in options/config
2 ANTHROPIC_API_KEY env var Environment variable
3 ClaudeSession:OAuthToken Explicit OAuth token (requires EnableOAuthTokenSupport = true)
4 ~/.claude/.credentials.json Local Claude Code session (requires EnableOAuthTokenSupport = true)

Sample CLI Tools

CLI tools demo

This repo includes sample projects demonstrating agentic workflows with Semantic Kernel:

Tool Command Description
Gherkin Generator jdgerkinator Converts acceptance criteria into Gherkin/Reqnroll specs
PR Review Agent jdpr Multi-provider PR review (GitHub, Azure DevOps, GitLab)
Codebase Explorer jdxplr Profiles codebases into structured knowledgebases
Todo Extractor (library demo) Extracts structured todos from natural language

Install the CLI tools as global tools:

dotnet tool install -g JD.Tools.GherkinGenerator
dotnet tool install -g JD.Tools.PullRequestReviewer
dotnet tool install -g JD.Tools.CodebaseExplorer

Models

Well-known model constants are available via ClaudeModels:

builder.UseClaudeCodeChatCompletion(ClaudeModels.Opus);   // claude-opus-4-6
builder.UseClaudeCodeChatCompletion(ClaudeModels.Sonnet);  // claude-sonnet-4-6 (default)
builder.UseClaudeCodeChatCompletion(ClaudeModels.Haiku);   // claude-haiku-4-5

Documentation

Full documentation is available at the DocFX site including:

Building

dotnet build
dotnet test

Build Documentation

cd docs
dotnet tool restore
dotnet docfx docfx.json

Shared Abstractions

This connector implements the JD.SemanticKernel.Connectors.Abstractions interfaces, enabling multi-provider bridging:

Interface Implementation
ISessionProvider ClaudeCodeSessionProvider — credential resolution with IsAuthenticatedAsync()
IModelDiscoveryProvider ClaudeModelDiscovery — returns known Claude model catalogue
SessionOptionsBase ClaudeCodeSessionOptions — inherits DangerouslyDisableSslValidation, CustomEndpoint

Use the same abstractions across providers:

ISessionProvider provider = isClaudeCode
    ? claudeCodeProvider
    : copilotProvider;

var creds = await provider.GetCredentialsAsync();

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on JD.SemanticKernel.Connectors.ClaudeCode:

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.

Version Downloads Last Updated
1.0.2 37 3/9/2026
0.1.24 2,401 3/6/2026
0.1.23 5,244 3/5/2026
0.1.22 4,239 3/2/2026
0.1.21 70 3/2/2026
0.1.20 70 3/2/2026
0.1.19 76 3/2/2026
0.1.18 72 3/2/2026
0.1.17 1,869 2/27/2026
0.1.16 74 2/27/2026
0.1.15 73 2/27/2026
0.1.14 72 2/27/2026
0.1.13 78 2/27/2026
0.1.11 71 2/26/2026
0.1.10 82 2/19/2026
0.1.9 75 2/19/2026
0.1.8 70 2/19/2026
0.1.7 70 2/19/2026
0.1.6 80 2/19/2026
0.1.5 79 2/19/2026
Loading failed