Verbara.Sdk.VoiceAi.OpenAiRealtime
2.2.1
dotnet add package Verbara.Sdk.VoiceAi.OpenAiRealtime --version 2.2.1
NuGet\Install-Package Verbara.Sdk.VoiceAi.OpenAiRealtime -Version 2.2.1
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="Verbara.Sdk.VoiceAi.OpenAiRealtime" Version="2.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Verbara.Sdk.VoiceAi.OpenAiRealtime" Version="2.2.1" />
<PackageReference Include="Verbara.Sdk.VoiceAi.OpenAiRealtime" />
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 Verbara.Sdk.VoiceAi.OpenAiRealtime --version 2.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Verbara.Sdk.VoiceAi.OpenAiRealtime, 2.2.1"
#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 Verbara.Sdk.VoiceAi.OpenAiRealtime@2.2.1
#: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=Verbara.Sdk.VoiceAi.OpenAiRealtime&version=2.2.1
#tool nuget:?package=Verbara.Sdk.VoiceAi.OpenAiRealtime&version=2.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Verbara.Sdk.VoiceAi.OpenAiRealtime
OpenAI Realtime API bridge for Verbara.Sdk.VoiceAi — persistent WebSocket session with function calling, transcript events, and dual-loop audio streaming.
Installation
dotnet add package Verbara.Sdk.VoiceAi.OpenAiRealtime
Quick Start
// Prerequisite: register AudioSocket transport
services.AddAudioSocketServer(opts => opts.Port = 9092);
// Register the bridge (replaces the STT→LLM→TTS chain)
services.AddOpenAiRealtimeBridge(opts =>
{
opts.ApiKey = configuration["OpenAI:ApiKey"]!;
opts.Model = "gpt-4o-realtime-preview";
opts.Voice = "alloy";
opts.Instructions = "You are a helpful call center assistant.";
opts.VadMode = VadMode.ServerSide;
})
.AddFunction<GetAccountBalanceFunction>(); // optional tool functions
// Subscribe to bridge events
var bridge = app.Services.GetRequiredService<OpenAiRealtimeBridge>();
bridge.Events.Subscribe(evt =>
{
if (evt is RealtimeTranscriptEvent t && t.IsFinal)
Console.WriteLine($"[{t.ChannelId}] {t.Text}");
});
Features
OpenAiRealtimeBridge—ISessionHandlerthat opens a WebSocket to OpenAI Realtime API per call- Dual audio loops: inbound PCM16 → base64 → OpenAI, OpenAI audio delta → PCM16 → Asterisk
- Automatic resampling between Asterisk 8 kHz and OpenAI 24 kHz via
ResamplerFactory - Function calling: register
IRealtimeFunctionHandlerimplementations withAddFunction<T>() - Observable
Eventsstream (RealtimeTranscriptEvent,RealtimeFunctionCalledEvent,RealtimeResponseStartedEvent, etc.) AddOpenAiRealtimeBridge()andAddFunction<T>()DI extension methods- Native AOT compatible (AOT-safe JSON via
System.Text.Jsonsource generation)
Documentation
See the main README for full documentation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Options (>= 10.0.8)
- System.Reactive (>= 6.1.0)
- Verbara.Sdk.Audio (>= 2.2.1)
- Verbara.Sdk.VoiceAi (>= 2.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.