API reference
Reference for every public API surface in the @ably/ai-transport package. The SDK is organised into four entry points so you only import what you need.
This reference covers every public API surface in the @ably/ai-transport package. The SDK is organised into four entry points so you only import what you need.
Quick example
A minimal client transport setup:
JavaScript
1
2
3
4
5
6
7
import * as Ably from 'ably';
import { createClientTransport } from '@ably/ai-transport/vercel';
const ably = new Ably.Realtime({ authUrl: '/auth' });
const channel = ably.channels.get('conversation-42');
const transport = createClientTransport({ channel });See the individual reference pages for the full API.
API surfaces
| Surface | Description | Reference |
|---|---|---|
| ClientTransport | Subscribe to turns, build conversation views, cancel and control from the client. | ClientTransport |
| ServerTransport | Manage turn lifecycle, stream responses, handle cancellation on the server. | ServerTransport |
| Vercel AI SDK integration | Pre-built codec and factories for the Vercel AI SDK. | Vercel AI SDK integration |
| Codec | Interface for bridging any AI framework to Ably messages. | Codec |
| Errors | The ErrorInfo type and numeric error codes with recovery guidance. | Errors |
| React | Providers and hooks for building chat UIs. | Providers and the per-hook pages under react/. |
Entry points
| Entry point | Import path | Contents |
|---|---|---|
| Core | @ably/ai-transport | createClientTransport, createServerTransport, codec interfaces |
| React | @ably/ai-transport/react | Generic React hooks (useClientTransport, useView, and so on) |
| Vercel | @ably/ai-transport/vercel | UIMessageCodec, Vercel-specific transport factories |
| Vercel React | @ably/ai-transport/vercel/react | useChatTransport, useMessageSync |