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
                    
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="Aspire.Hosting.GitHub.Models" Version="13.4.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aspire.Hosting.GitHub.Models" Version="13.4.2" />
                    
Directory.Packages.props
<PackageReference Include="Aspire.Hosting.GitHub.Models" />
                    
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 Aspire.Hosting.GitHub.Models --version 13.4.2
                    
#r "nuget: Aspire.Hosting.GitHub.Models, 13.4.2"
                    
#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 Aspire.Hosting.GitHub.Models@13.4.2
                    
#: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=Aspire.Hosting.GitHub.Models&version=13.4.2
                    
Install as a Cake Addin
#tool nuget:?package=Aspire.Hosting.GitHub.Models&version=13.4.2
                    
Install as a Cake Tool

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-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

Feedback & contributing

https://github.com/microsoft/aspire

Product 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. 
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 (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 13.0.1 is deprecated because it is no longer maintained.
Loading failed