SharpCoder.Providers 0.22.1

dotnet add package SharpCoder.Providers --version 0.22.1
                    
NuGet\Install-Package SharpCoder.Providers -Version 0.22.1
                    
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="SharpCoder.Providers" Version="0.22.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpCoder.Providers" Version="0.22.1" />
                    
Directory.Packages.props
<PackageReference Include="SharpCoder.Providers" />
                    
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 SharpCoder.Providers --version 0.22.1
                    
#r "nuget: SharpCoder.Providers, 0.22.1"
                    
#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 SharpCoder.Providers@0.22.1
                    
#: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=SharpCoder.Providers&version=0.22.1
                    
Install as a Cake Addin
#tool nuget:?package=SharpCoder.Providers&version=0.22.1
                    
Install as a Cake Tool

SharpCoder.Providers

SharpCoder.Providers supplies the IChatClient factory used by SharpCoder. It creates clients for GitHub Copilot, GitHub Models, and Ollama. Keep the SharpCoder and SharpCoder.Providers package versions aligned when using them together.

Install

dotnet add package SharpCoder.Providers

Create a client

Pass a provider-prefixed model string to select a provider explicitly. The factory returns Microsoft.Extensions.AI.IChatClient:

using SharpCoder.Providers;

using var client = ChatClientFactory.Create("copilot/<model>");

Replace <model> with the model identifier you want to use. Without a recognized prefix, LLM_PROVIDER selects the provider (default: copilot), and the remainder, if supplied, is treated as the model identifier.

Providers and configuration

Supported prefixes are copilot, github, ollama-cloud, and ollama-local. A provider prefix is case-insensitive; only these recognized prefixes before / select a provider.

Prefix Credentials and environment variables Default model when none is supplied
copilot A token from SetTokenProvider, GH_TOKEN, or GITHUB_TOKEN COPILOT_MODEL, otherwise claude-sonnet-4.6
github (GitHub Models) GH_TOKEN, then GITHUB_TOKEN GITHUB_MODEL, otherwise openai/gpt-4.1
ollama-cloud Required OLLAMA_API_KEY OLLAMA_MODEL, otherwise gpt-oss:120b
ollama-local OLLAMA_URL (otherwise http://localhost:11434) OLLAMA_MODEL, otherwise llama3

For Copilot, ChatClientFactory.SetTokenProvider(Func<string?>) takes precedence when it returns a non-whitespace token; otherwise the factory checks GH_TOKEN, then GITHUB_TOKEN. Whitespace values are treated as absent. ChatClientFactory.IsTokenAvailable() reports whether a non-whitespace Copilot token is available using that same precedence. The GitHub Models provider uses GH_TOKEN and GITHUB_TOKEN only; it does not use the token provider.

Copilot endpoint discovery

For Copilot requests, the factory can discover the account's advertised API endpoint. Discovered endpoints are accepted only for HTTPS hosts at githubcopilot.com or its subdomains; other values fall back to ChatClientFactory.DefaultCopilotApiEndpoint (https://api.githubcopilot.com). Discovery failures also fall back to that default. The public ChatClientFactory.GetCopilotApiEndpointAsync(string token, CancellationToken) exposes the lookup. GitHub Enterprise (*.ghe.com) is not supported.

Built-in behavior

  • Copilot and both Ollama providers use a resilience pipeline with up to three exponential-backoff retries and a 20-minute pipeline timeout; GitHub Models does not use this pipeline.
  • Reasoning effort is mapped at the provider boundary: extra_high maps to xhigh for Copilot and max for Ollama; GitHub Models clamps it to high.
  • Copilot request/response diagnostics are opt-in. Use ChatClientFactory.SetDiagnosticsDirectory(path) or set SHARPCODER_DIAGNOSTICS_DIR; an explicit method setting takes precedence. These diagnostic files are not produced by GitHub Models or either Ollama provider.

License and source

Licensed under the MIT License.

SharpCoder repository

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

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.22.1 202 10/5/2026
0.22.1-beta.167 37 10/18/2026
0.22.1-beta.165 54 10/4/2026
0.22.1-beta.164 56 10/4/2026
0.22.0 198 9/30/2026
0.22.0-beta.163 53 10/4/2026
0.22.0-beta.161 55 9/30/2026
0.22.0-beta.160 54 9/30/2026
0.21.1 253 9/26/2026
0.21.1-beta.159 51 9/30/2026
0.21.1-beta.158 56 9/30/2026
0.21.1-beta.157 53 9/30/2026
0.21.1-beta.156 54 9/30/2026
0.21.1-beta.155 55 9/30/2026
0.21.1-beta.154 53 9/29/2026
0.21.1-beta.152 61 9/26/2026
0.21.0 169 9/24/2026
0.21.0-beta.150 52 9/24/2026
0.21.0-beta.149 57 9/24/2026
0.21.0-beta.148 55 9/24/2026
Loading failed