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

RealtimeAdapter.md

59 lines1.5 KB

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