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.
Docs: https://hardkoded.github.io/vercel-ai-sdk-dotnet/
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.
Vercel.AI is a server library:
GenerateTextAsync and StreamTextAsync (tools, structured JSON output, stop conditions, middleware)EmbedAsync, EmbedManyAsync, RerankAsync, CosineSimilarityGenerateImageAsync, GenerateSpeechAsync, TranscribeAsync, TranslateAsync, GenerateVideoAsyncAgent, ProviderRegistry, and provider middlewareToUIMessageStreamResult 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.
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"}'
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.
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).
C#
98.7%
Python
1.3%
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.
Docs: https://hardkoded.github.io/vercel-ai-sdk-dotnet/
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.
Vercel.AI is a server library:
GenerateTextAsync and StreamTextAsync (tools, structured JSON output, stop conditions, middleware)EmbedAsync, EmbedManyAsync, RerankAsync, CosineSimilarityGenerateImageAsync, GenerateSpeechAsync, TranscribeAsync, TranslateAsync, GenerateVideoAsyncAgent, ProviderRegistry, and provider middlewareToUIMessageStreamResult 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.
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"}'
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.
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).
C#
98.7%
Python
1.3%