# Providers
The React integration is context-based. A provider higher in the tree creates the underlying `ClientTransport` (and, for the Vercel layer, the `ChatTransport` adapter) and exposes them through React context. Every hook in this section reads from the nearest provider.
There are two providers. Use `TransportProvider` from the generic entry point when you build a UI directly against AI Transport's hooks. Use `ChatTransportProvider` from the Vercel entry point when you wire AI Transport into Vercel's `useChat`. `ChatTransportProvider` internally wraps its children with a `TransportProvider`, so both layers' hooks resolve from a single provider.
#### React
```
import { TransportProvider } from '@ably/ai-transport/react';
import { ChatTransportProvider } from '@ably/ai-transport/vercel/react';
```
## TransportProvider
Creates a `ClientTransport` and makes it available to descendant components. Wraps children with Ably's `ChannelProvider` using the supplied `channelName`. Descendants read the transport with [`useClientTransport`](https://ably.com/docs/ai-transport/api/react/use-client-transport.md).
### React
```
import { TransportProvider } from '@ably/ai-transport/react';
import { UIMessageCodec } from '@ably/ai-transport/vercel';
### Parameters
The provider accepts every `ClientTransportOptions` field except `channel` (managed internally), plus a `channelName`.
### React
```
import { ChatTransportProvider } from '@ably/ai-transport/vercel/react';
```
### Parameters
The provider accepts every `VercelClientTransportOptions` field (defaulting `api` to `/api/chat`), plus a `channelName`.
### React
```
'use client';
import { useEffect, useState } from 'react';
import * as Ably from 'ably';
import { AblyProvider } from 'ably/react';
import { ChatTransportProvider } from '@ably/ai-transport/vercel/react';
import { Chat } from './chat';
function Providers({ children }) {
const [client, setClient] = useState(null);
useEffect(() => {
const ably = new Ably.Realtime({ authUrl: '/auth' });
setClient(ably);
return () => ably.close();
}, []);
if (!client) return null;
return {children} ;
}
export default function Page() {
const chatId = 'conversation-42';
return (
);
}
```
## Related Topics
- [useClientTransport](https://ably.com/docs/ai-transport/api/react/use-client-transport.md): Read a ClientTransport from the nearest TransportProvider in the AI Transport React integration.
- [useView](https://ably.com/docs/ai-transport/api/react/use-view.md): Subscribe to a paginated, branch-aware view of the AI Transport conversation tree from React.
- [useCreateView](https://ably.com/docs/ai-transport/api/react/use-create-view.md): Create an independent View over the AI Transport conversation tree from React, with its own branch selections and pagination.
- [useTree](https://ably.com/docs/ai-transport/api/react/use-tree.md): Stable structural query callbacks for the AI Transport conversation tree from React.
- [useActiveTurns](https://ably.com/docs/ai-transport/api/react/use-active-turns.md): Subscribe to active turns on the AI Transport channel from React.
- [useAblyMessages](https://ably.com/docs/ai-transport/api/react/use-ably-messages.md): Subscribe to raw Ably InboundMessages on the AI Transport channel from React.
- [useChatTransport](https://ably.com/docs/ai-transport/api/react/use-chat-transport.md): Read a ChatTransport and its underlying ClientTransport from the nearest ChatTransportProvider in AI Transport.
- [useMessageSync](https://ably.com/docs/ai-transport/api/react/use-message-sync.md): Wire AI Transport message updates into Vercel useChat's message state from React.
## Documentation Index
To discover additional Ably documentation:
1. Fetch [llms.txt](https://ably.com/llms.txt) for the canonical list of available pages.
2. Identify relevant URLs from that index.
3. Fetch target pages as needed.
Avoid using assumed or outdated documentation paths.