NuSpec.AI.Pro 1.0.4

dotnet add package NuSpec.AI.Pro --version 1.0.4
                    
NuGet\Install-Package NuSpec.AI.Pro -Version 1.0.4
                    
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="NuSpec.AI.Pro" Version="1.0.4">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NuSpec.AI.Pro" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="NuSpec.AI.Pro">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 NuSpec.AI.Pro --version 1.0.4
                    
#r "nuget: NuSpec.AI.Pro, 1.0.4"
                    
#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 NuSpec.AI.Pro@1.0.4
                    
#: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=NuSpec.AI.Pro&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=NuSpec.AI.Pro&version=1.0.4
                    
Install as a Cake Tool

NuSpec.AI.Pro

Token-optimized AI context for your NuGet packages — with offline license validation.

NuSpec.AI.Pro is the paid tier of NuSpec.AI. It generates ai/package-map.json during dotnet pack (same as the free version) plus three additional token-optimized formats: YAML, compact JSON, and ultra-compact text. Pro also supports [AiRole], [AiIgnore], and [AiDescription] attributes for fine-grained control over what gets included and how it's described.

Free version: If you don't need token optimization or attribute support, NuSpec.AI is free and generates standard JSON automatically.

Quick Start

<PackageReference Include="NuSpec.AI.Pro" Version="1.0.2" PrivateAssets="all" />


<PackageReference Include="NuSpec.AI.Attributes" Version="1.0.2" />
<PropertyGroup>
  
  <NuSpecAiFormats>yaml;ultra</NuSpecAiFormats>

  
  <NuSpecAiLicenseKey>$(NUSPEC_AI_LICENSE_KEY)</NuSpecAiLicenseKey>
</PropertyGroup>
dotnet pack

Output Formats

Format File Avg. Token Savings
json ai/package-map.json Baseline (same as free)
yaml ai/package-map.yaml 29% fewer tokens
compact ai/package-map.compact.json 40% fewer tokens
ultra ai/package-map.ultra 71% fewer tokens

Use <NuSpecAiFormats>all</NuSpecAiFormats> to generate all four. Mix and match as needed — json;yaml, ultra only, etc.

Token count comparison

Measured across 42 production projects (3 real codebases). Token counts are approximate (chars ÷ 4).

Project profile Types JSON YAML Compact Ultra
Models library 723 215,221 140,003 (−35%) 110,848 (−48%) 32,154 (−85%)
Large shared library 673 225,503 149,950 (−34%) 122,876 (−46%) 44,468 (−80%)
Worker service 131 45,684 32,490 (−29%) 28,652 (−37%) 13,866 (−70%)
Providers library 116 73,632 53,987 (−27%) 49,229 (−33%) 28,364 (−61%)
DAL / repositories 73 30,746 19,887 (−35%) 16,969 (−45%) 6,795 (−78%)
Common services 44 30,571 23,088 (−24%) 21,122 (−31%) 13,076 (−57%)
Web API surface 50 15,163 10,228 (−33%) 8,447 (−44%) 3,283 (−78%)
Azure Functions 16 6,677 4,926 (−26%) 4,540 (−32%) 2,367 (−65%)
Exception types 8 3,504 2,433 (−31%) 2,009 (−43%) 679 (−81%)
All 42 projects 789,131 536,463 (−32%) 449,049 (−43%) 184,630 (−77%)

What drives savings: ultra encodes the same data in a custom terse text format — no JSON structure overhead, abbreviated type prefixes, member prefixes instead of full keys. The gains compound with project size: larger APIs have more repeated structural tokens to eliminate.

Ultra-compact example

#NuSpec.AI/v1 Acme.Orders 1.0.0
#desc Order management library.
#tfm net8.0
#dep Microsoft.EntityFrameworkCore
@c Order [entity] "Represents a customer order."
 .p Id:int
 .p CustomerId:string
 .p Status:OrderStatus
@e OrderStatus
 .ev Pending=0,Confirmed=1,Shipped=2,Cancelled=3
@i IOrderRepository [repository]
 .m GetByIdAsync:Task<Order?>(int id, CancellationToken ct = default)
 .m AddAsync:Task<Order>(Order order, CancellationToken ct = default)

License Key

Set your license key in one of three ways (highest to lowest priority):

  1. MSBuild property (recommended for CI/CD):

    <NuSpecAiLicenseKey>$(NUSPEC_AI_LICENSE_KEY)</NuSpecAiLicenseKey>
    

    Set NUSPEC_AI_LICENSE_KEY as a secret in your CI environment.

  2. Environment variable:

    export NUSPEC_AI_LICENSE_KEY=<your-key>
    
  3. User file: ~/.nuspec-ai/license.key

License validation is entirely offline — no network calls during pack.

Missing or invalid license

If the license is missing, expired, or doesn't cover the current package, NuSpec.AI.Pro falls back to standard JSON output and emits a build warning:

warning NSPECAI001: NuSpec.AI.Pro license is expired/invalid/missing. Falling back to standard JSON output.

The build and pack always succeed — your CI/CD pipeline is never blocked.

Attribute Support

Install NuSpec.AI.Attributes to use [AiRole], [AiIgnore], and [AiDescription] on your types and members. These are honored by Pro and ignored by the free version.

[AiRole("aggregate-root", "audited")]
public class Order { ... }

[AiIgnore]
public string InternalToken { get; set; }

[AiDescription("Use this to initiate a refund. Do not call for subscription orders.")]
public Task RefundAsync(int orderId) { ... }

Coexistence with NuSpec.AI (free)

If both packages are referenced, Pro wins automatically. The free package sits inert. You'll see a low-priority diagnostic message in verbose build output suggesting you remove the redundant reference.

Requirements

  • .NET 8.0 SDK or later
  • A valid NuSpec.AI.Pro license key
  • Project must be packable (<IsPackable>true</IsPackable> or default)
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
1.0.4 34 4/9/2026
1.0.3 36 4/9/2026
1.0.2 35 4/9/2026