Aspire.Hosting.GitHub.Models
9.4.0-preview.1.25378.8
Prefix Reserved
dotnet add package Aspire.Hosting.GitHub.Models --version 9.4.0-preview.1.25378.8
NuGet\Install-Package Aspire.Hosting.GitHub.Models -Version 9.4.0-preview.1.25378.8
<PackageReference Include="Aspire.Hosting.GitHub.Models" Version="9.4.0-preview.1.25378.8" />
<PackageVersion Include="Aspire.Hosting.GitHub.Models" Version="9.4.0-preview.1.25378.8" />
<PackageReference Include="Aspire.Hosting.GitHub.Models" />
paket add Aspire.Hosting.GitHub.Models --version 9.4.0-preview.1.25378.8
#r "nuget: Aspire.Hosting.GitHub.Models, 9.4.0-preview.1.25378.8"
#:package Aspire.Hosting.GitHub.Models@9.4.0-preview.1.25378.8
#addin nuget:?package=Aspire.Hosting.GitHub.Models&version=9.4.0-preview.1.25378.8&prerelease
#tool nuget:?package=Aspire.Hosting.GitHub.Models&version=9.4.0-preview.1.25378.8&prerelease
Aspire.Hosting.GitHub.Models library
Provides extension methods and resource definitions for a .NET Aspire AppHost to configure GitHub Models.
Getting started
Prerequisites
- GitHub account with access to GitHub Models
- GitHub personal access token with appropriate permissions (
models: read
)
Install the package
In your AppHost project, install the .NET Aspire GitHub Models Hosting library with NuGet:
dotnet add package Aspire.Hosting.GitHub.Models
Usage example
Then, in the AppHost.cs file of AppHost
, add a GitHub Model resource and consume the connection using the following methods:
var builder = DistributedApplication.CreateBuilder(args);
var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini");
var myService = builder.AddProject<Projects.MyService>()
.WithReference(chat);
The WithReference
method passes that connection information into a connection string named chat
in the MyService
project.
In the Program.cs file of MyService
, the connection can be consumed using a client library like Aspire.Azure.AI.Inference:
Inference client usage
builder.AddAzureChatCompletionsClient("chat")
.AddChatClient();
Configuration
The GitHub Model resource can be configured with the following options:
API Key
The API key can be set as a configuration value using the default name {resource_name}-gh-apikey
or the GITHUB_TOKEN
environment variable.
Then in user secrets:
{
"Parameters":
{
"chat-gh-apikey": "YOUR_GITHUB_TOKEN_HERE"
}
}
Furthermore, the API key can be configured using a custom parameter:
var apiKey = builder.AddParameter("my-api-key", secret: true);
var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini")
.WithApiKey(apiKey);
Then in user secrets:
{
"Parameters":
{
"my-api-key": "YOUR_GITHUB_TOKEN_HERE"
}
}
Available Models
GitHub Models supports various AI models. Some popular options include:
openai/gpt-4o-mini
openai/gpt-4o
deepseek/DeepSeek-V3-0324
microsoft/Phi-4-mini-instruct
Check the GitHub Models documentation for the most up-to-date list of available models.
Additional documentation
- https://docs.github.com/en/github-models
- https://github.com/dotnet/aspire/tree/main/src/Components/README.md
Feedback & contributing
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. |
-
net8.0
- Aspire.Hosting (>= 9.4.0)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Google.Protobuf (>= 3.31.1)
- Grpc.AspNetCore (>= 2.71.0)
- Grpc.Net.ClientFactory (>= 2.71.0)
- Grpc.Tools (>= 2.72.0)
- Humanizer.Core (>= 2.14.1)
- JsonPatch.Net (>= 3.3.0)
- KubernetesClient (>= 17.0.4)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.18)
- Microsoft.Extensions.Hosting (>= 8.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Primitives (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
- Polly.Core (>= 8.6.2)
- Semver (>= 3.0.0)
- StreamJsonRpc (>= 2.22.11)
- System.IO.Hashing (>= 9.0.7)
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 |
---|---|---|
9.4.0-preview.1.25378.8 | 93 | 7/29/2025 |