SharpCoder.Providers
0.22.1
dotnet add package SharpCoder.Providers --version 0.22.1
NuGet\Install-Package SharpCoder.Providers -Version 0.22.1
<PackageReference Include="SharpCoder.Providers" Version="0.22.1" />
<PackageVersion Include="SharpCoder.Providers" Version="0.22.1" />
<PackageReference Include="SharpCoder.Providers" />
paket add SharpCoder.Providers --version 0.22.1
#r "nuget: SharpCoder.Providers, 0.22.1"
#:package SharpCoder.Providers@0.22.1
#addin nuget:?package=SharpCoder.Providers&version=0.22.1
#tool nuget:?package=SharpCoder.Providers&version=0.22.1
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_highmaps toxhighfor Copilot andmaxfor Ollama; GitHub Models clamps it tohigh. - Copilot request/response diagnostics are opt-in. Use
ChatClientFactory.SetDiagnosticsDirectory(path)or setSHARPCODER_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.
| Product | Versions 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. |
-
net10.0
- Microsoft.Extensions.AI (>= 10.10.0)
- Microsoft.Extensions.AI.OpenAI (>= 10.10.0)
- Microsoft.Extensions.Http.Resilience (>= 10.10.0)
- OllamaSharp (>= 5.5.0)
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 |