Vercel.AI 0.2.0

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

Vercel AI SDK for .NET

Unofficial community port of the Vercel AI SDK for .NET. It is an independent reimplementation of the public AI SDK behavior and provider HTTP APIs. It is not a copy of Vercel’s TypeScript, not an official Vercel product, and not endorsed by Vercel.

The parity target is AI SDK 7 / Language Model specification V4. See COMPATIBILITY.md for the upstream commit and the packages that are intentionally not ported.

License: Apache License 2.0. Copyright 2023 Vercel, Inc.

NuGet Docs: https://hardkoded.github.io/vercel-ai-sdk-dotnet/

Install

dotnet add package Vercel.AI

String model ids such as openai/gpt-4.1-mini are resolved by the Gateway, which ships inside this package.

What you can call

Vercel.AI is a server library:

  • GenerateTextAsync and StreamTextAsync (tools, structured JSON output, stop conditions, middleware)
  • EmbedAsync, EmbedManyAsync, RerankAsync, CosineSimilarity
  • GenerateImageAsync, GenerateSpeechAsync, TranscribeAsync, TranslateAsync, GenerateVideoAsync
  • Agent, ProviderRegistry, and provider middleware
  • Model providers, including the Vercel AI Gateway, in the same package

ToUIMessageStreamResult writes the AI SDK UI message stream (text/event-stream) that a JavaScript useChat client already consumes. That helper is available on net10.0. There is no React, Vue, Svelte, Angular, or RSC package in this repo.

String model ids such as openai/gpt-4.1-mini are resolved by the Gateway provider.

Run the samples

dotnet run --project samples/Vercel.AI.Sample
dotnet run --project samples/Vercel.AI.AspNetCore.Sample

The console sample uses a scripted model unless AI_GATEWAY_API_KEY is set. The ASP.NET sample listens on http://127.0.0.1:43123 and does the same for POST /chat.

curl -N -X POST http://127.0.0.1:43123/chat \
  -H 'content-type: application/json' \
  -d '{"prompt":"Hello"}'

Tests

dotnet test Vercel.AI.slnx -c Release

Unit tests mock HTTP and do not need keys. Integration tests call a live provider only when AI_GATEWAY_API_KEY or OPENAI_API_KEY is set.

Packages

The library targets net10.0 and netstandard2.0. The ASP.NET UI stream helper and the samples are net10.0 only. Versions come from MinVer. Pushing a vMAJOR.MINOR.PATCH tag packs Vercel.AI, publishes that package to nuget.org with Trusted Publishing, and the docs workflow publishes the DocFX site.

var model = OpenAIProvider.Create().LanguageModel("gpt-4.1-mini");
var result = await new AiClient(Vercel.AI.Gateway.GatewayProvider.Create(new() { ApiKey = "unused" }))
    .GenerateTextAsync(new GenerateTextOptions
    {
        Model = model,
        Prompt = "Write a one-sentence release note.",
    });
Console.WriteLine(result.Text);

Dependency injection:

services.AddAiSdk(options => options.GatewayApiKey = configuration["AI_GATEWAY_API_KEY"]);
services.AddOpenAI();

Provider keys use the same environment variables as the JavaScript providers (OPENAI_API_KEY, ANTHROPIC_API_KEY, AI_GATEWAY_API_KEY, and the rest listed in COMPATIBILITY.md).

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 39 9/24/2026
0.1.0 54 9/24/2026