Aspire.Hosting.GitHub.Models
13.4.2
Prefix Reserved
dotnet add package Aspire.Hosting.GitHub.Models --version 13.4.2
NuGet\Install-Package Aspire.Hosting.GitHub.Models -Version 13.4.2
<PackageReference Include="Aspire.Hosting.GitHub.Models" Version="13.4.2" />
<PackageVersion Include="Aspire.Hosting.GitHub.Models" Version="13.4.2" />
<PackageReference Include="Aspire.Hosting.GitHub.Models" />
paket add Aspire.Hosting.GitHub.Models --version 13.4.2
#r "nuget: Aspire.Hosting.GitHub.Models, 13.4.2"
#:package Aspire.Hosting.GitHub.Models@13.4.2
#addin nuget:?package=Aspire.Hosting.GitHub.Models&version=13.4.2
#tool nuget:?package=Aspire.Hosting.GitHub.Models&version=13.4.2
Aspire.Hosting.GitHub.Models library
Provides extension methods and resource definitions for an 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 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"
}
}
Connection Properties
When you reference a GitHub Model resource using WithReference, the following connection properties are made available to the consuming project:
GitHub Model
The GitHub Model resource exposes the following connection properties:
| Property Name | Description |
|---|---|
Uri |
The GitHub Models inference endpoint URI, with the format https://models.github.ai/inference |
Key |
The API key (PAT or GitHub App token) for authentication |
ModelName |
The model identifier for inference requests, for instance openai/gpt-4o-mini |
Organization |
The organization attributed to the request (available when configured) |
Aspire exposes each property as an environment variable named [RESOURCE]_[PROPERTY]. For instance, the Uri property of a resource called chat becomes CHAT_URI.
Available Models
GitHub Models supports various AI models. Some popular options include:
openai/gpt-4o-miniopenai/gpt-4odeepseek/DeepSeek-V3-0324microsoft/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/microsoft/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 (>= 13.4.2)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Google.Protobuf (>= 3.34.1)
- Grpc.AspNetCore (>= 2.80.0)
- Grpc.Net.ClientFactory (>= 2.80.0)
- Grpc.Tools (>= 2.80.0)
- Humanizer.Core (>= 3.0.10)
- JsonPatch.Net (>= 3.3.0)
- KubernetesClient (>= 19.0.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.27)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.8)
- Microsoft.Extensions.Hosting (>= 10.0.8)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Http (>= 10.0.8)
- Microsoft.Extensions.Logging (>= 10.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Options (>= 10.0.8)
- Microsoft.Extensions.Primitives (>= 10.0.8)
- ModelContextProtocol (>= 1.3.0)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.15.3)
- OpenTelemetry.Extensions.Hosting (>= 1.15.3)
- Polly.Core (>= 8.6.6)
- Semver (>= 3.0.0)
- StreamJsonRpc (>= 2.22.23)
- System.IO.Hashing (>= 10.0.8)
- System.Text.Json (>= 10.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Aspire.Hosting.GitHub.Models:
| Repository | Stars |
|---|---|
|
dotnet-presentations/dotnet-aspire-workshop
This .NET Aspire workshop will get you started building apps with .NET Aspire!
|
|
|
Azure-Samples/interview-coach-agent-framework
Interview coach application using Microsoft Agent Framework | https://aka.ms/agentframework/interviewcoach
|
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 13.4.2 | 65 | 6/3/2026 | |
| 13.4.1 | 44 | 6/3/2026 | |
| 13.4.0 | 168 | 6/1/2026 | |
| 13.3.5 | 255 | 5/21/2026 | |
| 13.3.4 | 124 | 5/19/2026 | |
| 13.3.3 | 477 | 5/15/2026 | |
| 13.3.2 | 137 | 5/14/2026 | |
| 13.3.1 | 152 | 5/12/2026 | |
| 13.3.0 | 223 | 5/7/2026 | |
| 13.2.4 | 407 | 4/24/2026 | |
| 13.2.3 | 220 | 4/21/2026 | |
| 13.2.2 | 790 | 4/8/2026 | |
| 13.2.1 | 390 | 3/31/2026 | |
| 13.2.0 | 3,254 | 3/23/2026 | |
| 13.1.3 | 577 | 3/19/2026 | |
| 13.1.2 | 1,427 | 2/26/2026 | |
| 13.1.1 | 647 | 2/11/2026 | |
| 13.1.0 | 4,646 | 12/17/2025 | |
| 13.0.2 | 1,133 | 12/4/2025 | |
| 13.0.1 | 550 | 11/26/2025 |