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.

Open in

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

SurfaceDescriptionReference
ClientTransportSubscribe to turns, build conversation views, cancel and control from the client.ClientTransport
ServerTransportManage turn lifecycle, stream responses, handle cancellation on the server.ServerTransport
Vercel AI SDK integrationPre-built codec and factories for the Vercel AI SDK.Vercel AI SDK integration
CodecInterface for bridging any AI framework to Ably messages.Codec
ErrorsThe ErrorInfo type and numeric error codes with recovery guidance.Errors
ReactProviders and hooks for building chat UIs.Providers and the per-hook pages under react/.

Entry points

Entry pointImport pathContents
Core@ably/ai-transportcreateClientTransport, createServerTransport, codec interfaces
React@ably/ai-transport/reactGeneric React hooks (useClientTransport, useView, and so on)
Vercel@ably/ai-transport/vercelUIMessageCodec, Vercel-specific transport factories
Vercel React@ably/ai-transport/vercel/reactuseChatTransport, useMessageSync