Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

RealtimeAdapter.md

61 lines1.5 KB

1---
2id: RealtimeAdapter
3title: RealtimeAdapter
4---
5​
6# Interface: RealtimeAdapter
7​
8Defined in: [packages/ai/src/realtime/types.ts:319](https://github.com/TanStack/ai/blob/main/packages/ai/src/realtime/types.ts#L319)
9​
10Adapter interface for connecting to realtime providers.
11Each provider (OpenAI, ElevenLabs, etc.) implements this interface.
12​
13Defined here in `@tanstack/ai` — the shared layer that both provider adapter
14packages and the client runtime (`@tanstack/ai-client`) already depend on —
15so a provider package can describe its realtime adapter without taking a
16dependency on the client-only `@tanstack/ai-client`. `@tanstack/ai-client`
17re-exports this type for backwards compatibility.
18​
19## Properties
20​
21### connect()
22​
23```ts
24connect: (token, clientTools?) => Promise<RealtimeConnection>;
25```
26​
27Defined in: [packages/ai/src/realtime/types.ts:329](https://github.com/TanStack/ai/blob/main/packages/ai/src/realtime/types.ts#L329)
28​
29Create a connection using the provided token
30​
31#### Parameters
32​
33##### token
34​
35[`RealtimeToken`](RealtimeToken.md)
36​
37The ephemeral token from the server
38​
39##### clientTools?
40​
41readonly [`AnyClientTool`](../type-aliases/AnyClientTool.md)[]
42​
43Optional client-side tools to register with the provider
44​
45#### Returns
46​
47`Promise`\<[`RealtimeConnection`](RealtimeConnection.md)\>
48​
49A connection instance
50​
51***
52​
53### provider
54​
55```ts
56provider: string;
57```
58​
59Defined in: [packages/ai/src/realtime/types.ts:321](https://github.com/TanStack/ai/blob/main/packages/ai/src/realtime/types.ts#L321)
60​
61Provider identifier