Skip to content

OpenAIRealtimeModel

Namespace: Vercel.AI.OpenAI

public sealed class OpenAIRealtimeModel : IRealtimeModel

OpenAI Realtime session URI builder and WebSocket client.

Inheritance: object

Implements: IRealtimeModel

View source

OpenAIRealtimeModel(OpenAIProvider, string)

Section titled “OpenAIRealtimeModel(OpenAIProvider, string)”
public OpenAIRealtimeModel(OpenAIProvider provider, string modelId)

Creates a realtime model.

Parameters

Name Type Description
provider OpenAIProvider
modelId string

View source

public string ModelId { get; }

Model id.

Value: string

View source

public string Provider { get; }

Provider id.

Value: string

View source

public Uri BuildUri()

WebSocket URI for this model.

Returns: Uri

View source

public Task<IRealtimeSession> ConnectAsync(CancellationToken cancellationToken)

Opens a realtime session.

Parameters

Name Type Description
cancellationToken CancellationToken

Returns: Task<IRealtimeSession>

View source

CreateClientSecretAsync(int?, CancellationToken)

Section titled “CreateClientSecretAsync(int?, CancellationToken)”
public Task<OpenAIRealtimeClientSecret> CreateClientSecretAsync(int? expiresAfterSeconds, CancellationToken cancellationToken)

Requests a realtime client secret. <code class=“paramref”>expiresAfterSeconds</code> is omitted when null.

Parameters

Name Type Description
expiresAfterSeconds int?
cancellationToken CancellationToken

Returns: Task<OpenAIRealtimeClientSecret>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product