Skip to main content
net8.0

GitHub Models resource types for Aspire.

Published
Aug 18, 2026
2mo ago
Total Downloads
32.3K
32,256

Install

dotnet add package Aspire.Hosting.GitHub.Models --version 13.5.0
ProductVersions
.NET
net8.0

README

GitHub Models hosting integration

This integration is deprecated and no longer supported. GitHub Models is no longer available to new customers, so the Aspire.Hosting.GitHub.Models integration has been sunset. It will not receive further updates (including model-list refreshes) and will be removed in a future release. Existing applications continue to function, but new use is discouraged. See microsoft/aspire#18402 for details.

Use this integration to model, configure, and orchestrate GitHub Models in an Aspire solution.

Getting started

Prerequisites

  • GitHub account with access to GitHub Models
  • GitHub personal access token with appropriate permissions (models: read)

Add the integration

From your AppHost directory, add the Aspire.Hosting.GitHub.Models integration with the Aspire CLI:

aspire add Aspire.Hosting.GitHub.Models

Usage example

In the AppHost, add a GitHub Model resource and reference it from another resource with either C# or TypeScript:

C#

var builder = DistributedApplication.CreateBuilder(args);

var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini");

var myService = builder.AddProject<Projects.MyService>()
                       .WithReference(chat);

TypeScript

import { createBuilder } from "./.aspire/modules/aspire.mjs";

const builder = await createBuilder();

const chat = await builder.addGitHubModelById("chat", "openai/gpt-4o-mini");

const myService = await builder.addNodeApp("myService", "../my-service", "server.js")
                       .withReference(chat);

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.

From your AppHost directory, set the parameter value with aspire secret set:

aspire secret set 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);

From your AppHost directory, set the custom parameter value with aspire secret set:

aspire secret set 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

Changes from Previous Version

v13.4.6v13.5.0

Adoption Assessment

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

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.The published metadata declares 32 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.