Skip to main content
net8.0

GitHub Models resource types for .NET Aspire.

Published
Jul 29, 2025
1y ago
Total Downloads
35.1K
35,098

Deprecated Package Version

Reason: Other, Legacy

This version is out of support and is no longer maintained. Please upgrade to the latest version. See our support policy for details: https://aka.ms/dotnet/aspire/support

Install

dotnet add package Aspire.Hosting.GitHub.Models --version 9.4.0-preview.1.25378.8
ProductVersions
.NET
net8.0

README

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

Feedback & contributing

https://github.com/dotnet/aspire

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.NuGet marks this package as deprecated. Review the publisher's migration guidance before adopting it.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.The published metadata declares 24 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.