Universal.OpenAI.Live.Client 1.1.0

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

Universal.OpenAI.Live.Client

A .NET Standard 2.0 client for GPT-Live primary, sideband, and stored-session fork WebSockets. Includes typed audio, transcript, session, Responses delegation, Decisions, SIP progress, and error events. Uses shared session configuration and REST models from Universal.OpenAI.Client.V1.Live.

using Universal.OpenAI.Client.V1.Live;
using Universal.OpenAI.Live.Client;
using LiveSocket = Universal.OpenAI.Live.Client.LiveClient;

using var timeout = new CancellationTokenSource(TimeSpan.FromMinutes(2));
using var live = await LiveSocket.ConnectAsync(apiKey, new LiveSessionConfiguration
{
    Instructions = "Help the caller. Delegate tasks that require tools.",
    Audio = new LiveAudioConfiguration
    {
        Format = new LiveAudioFormat { Type = "audio/pcm", Rate = 24000 },
        Output = new LiveAudioOutputConfiguration { Voice = "marin" }
    },
    Delegation = new LiveDelegationConfiguration { Type = "client" }
}, timeout.Token);

// ConnectAsync waits for session.started; Session contains the resolved configuration.
// Run the microphone producer concurrently with this single receive loop:
// await live.AppendAudioAsync(pcm16MonoChunk, timeout.Token);
await foreach (var entry in live.ReceiveEventsAsync(timeout.Token))
{
    switch (entry)
    {
        case OutputAudioDeltaEvent audio:
            await PlayAudioAsync(audio.GetAudioBytes()); // application audio playback
            break;
        case InputTranscriptDeltaEvent transcript:
            Console.Write(transcript.Delta); // collect context; fragments are not full turns
            break;
        case DelegationCreatedEvent work when work.Delegation.Target == "client":
            // Authorize and execute backend work in your application using saved transcript/task state.
            var result = await RunBackendAsync(work.Delegation.Id);
            await live.AppendCommentaryAsync(result, work.Delegation.Id, timeout.Token);
            break;
        case ErrorEvent error:
            throw new LiveProtocolException(error.Error);
        case SessionClosedEvent closed:
            Console.WriteLine($"Closed: {closed.Reason}; seconds: {closed.Usage.Seconds}");
            break;
    }
}

PlayAudioAsync and RunBackendAsync above are application handlers. The library transports raw audio; it does not capture a microphone or drive speakers. PCM is mono signed 16-bit little endian at 16 or 24 kHz; G.711 PCMU/PCMA uses 8 kHz. Audio payloads contain no WAV header. Live performs turn handling continuously, without Realtime buffer-commit events. Primary output audio has no guaranteed timestamps or audio-done event.

Supply a continuous microphone stream paced at its sample rate, including silence while the microphone is quiet. Stopping input audio stops advancement of the Live audio timeline and can leave context appends pending. Stop producers between sends; cancelling an in-flight ClientWebSocket send or receive can abort its transport. PlayAudioFixtureAsync accepts a complete PCM16LE 24 kHz fixture of up to 30 seconds, regardless of the session format; microphone input during fixture playback is dropped.

To finish, call RequestCloseAsync while the receive loop runs and observe SessionClosedEvent. Its usage is cumulative. A transport disconnect is not confirmation of finalization. CloseAsync closes only the WebSocket; Dispose releases an owned socket. Unexpected remote close before session.closed throws. Cancellation propagates to the caller.

For Responses delegation, set Delegation.Type = "responses" and configure Responses.Model, instructions, and tools. ResponseEvent.Event uses the existing typed Responses streaming events, with an outer DelegationId. After your application executes a function, SubmitToolOutputAsync(callId, output) sends the result and resumes the backend. Client delegation is supported through thinking, commentary, and instruction appends; their delegation ID is serialized even when null. Decisions delegation, transcript triggers, item operations, and nested decision events are also supported. The library never executes tools automatically.

AttachAsync(apiKey, sessionId) attaches a trusted sideband without restarting or replaying a session. Sidebands receive reflected audio but cannot append input audio. Closing a sideband transport does not request session shutdown. ForkAsync(apiKey, storedSessionId, overrides) starts a new WebSocket session from a stored session without supplying a new model or voice.

OpenAIClient.V1.Live exposes WebRTC creation/SDP exchange, outbound SIP creation, inbound SIP accept/reject, transfer, hangup, recording download, and WebRTC forks. Pass LiveWebRtcTransport or LiveSipTransport to session creation. Outbound SIP requires your provider's trunk credentials and E.164 numbers; requests are not automatically retried. WebRTC media is handled by your application's peer connection, and SIP media by the provider.

One receive iterator may be active per connection; concurrent sends are serialized. LiveClientOptions controls the endpoint, startup timeout, message size limit, and WebSocket options. An open WebSocket can also be injected for testing or custom transport configuration. Unknown event types and additional fields are preserved.

Protocol references: primary WebSocket, sideband, fork, delegation, REST session creation.

Run offline tests with:

dotnet run --project CSharp/Universal.OpenAI.Live.Client.Tests -- --filter "TestCategory!=LiveInference"

Live validation reuses the existing API test credential through a linked source file. Set UNIVERSAL_OPENAI_LIVE_TESTS=1, then run with --filter "TestCategory=LiveInference". These tests create billable sessions and verify final session closure. They do not place telephone calls.

On November 9, 2026, sideband attachment to a primary WebSocket session returned HTTP 503; WebRTC sideband attachment succeeded. The optional primary-sideband compatibility probe requires UNIVERSAL_OPENAI_LIVE_PRIMARY_SIDEBAND_PROBE=1 in addition to the live-test flag. This service behavior does not affect primary audio, WebRTC sidebands, or stored-session forks.

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 was computed.  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
1.1.0 94 11/11/2026
1.0.0 108 11/9/2026

Updates Universal.OpenAI.Client to 4.6.0 for Universal.Common.Json 2.0.1 compatibility.