# TransportProvider
`TransportProvider` creates a [transport](https://ably.com/docs/ai-transport/api/javascript/transport/transport.md) for one channel and makes it available to the components inside it. It reads the Ably client from the surrounding `AblyProvider`, so the hooks in `@ably/ai-transport/react` work in any component it wraps.
#### OpenAI Javascript
```
import * as Ably from 'ably';
import { AblyProvider } from 'ably/react';
import { TransportProvider } from '@ably/ai-transport/react';
import { openai } from '@ably/ai-transport/openai';
const ably = new Ably.Realtime({ authUrl: '/auth' });
export function App() {
return (
`TransportProvider` must be used within an [`AblyProvider`](https://ably.com/docs/getting-started/react.md).
The provider creates the transport after the first render, so `useTransport` returns `transport` as `undefined` on the first render. The provider closes the transport when it unmounts. When the client, the channel name, the codec's `adapterTag` or the channel modes change, it closes the transport and creates a new one.
The provider also wraps its children in an ably-js `ChannelProvider` for the same channel, with the options the transport set. So `usePresence`, `useChannel` and `useChannelStateListener` from `ably/react` work inside it.
To hold more than one conversation, nest providers with different channel names, and pass `channelName` to a hook to read a specific one.
## Properties
### OpenAI Javascript
```
import { TransportProvider, useTransport } from '@ably/ai-transport/react';
import { openai } from '@ably/ai-transport/openai';
function Panels() {
return (
);
}
function Chat() {
const { transport } = useTransport();
const { transport: support } = useTransport({ channelName: 'conversations:support' });
// ...
}
```
### Vercel AI SDK Javascript
```
import { TransportProvider, useTransport } from '@ably/ai-transport/react';
import { vercel } from '@ably/ai-transport/vercel';
function Panels() {
return (
);
}
function Chat() {
const { transport } = useTransport();
const { transport: support } = useTransport({ channelName: 'conversations:support' });
// ...
}
```
## Related Topics
- [useTransport](https://ably.com/docs/ai-transport/api/react/use-transport.md): API reference for the AI Transport useTransport hook: read the transport from the nearest or a named TransportProvider.
- [useDeliveries](https://ably.com/docs/ai-transport/api/react/use-deliveries.md): API reference for the AI Transport useDeliveries hook: receive every delivery on the transport's channel while a component is mounted.
- [useHistory](https://ably.com/docs/ai-transport/api/react/use-history.md): API reference for the AI Transport useHistory hook: read the channel's history one page at a time, oldest first.
- [useTransportStatus](https://ably.com/docs/ai-transport/api/react/use-transport-status.md): API reference for the AI Transport useTransportStatus hook: observe the transport's discontinuities and errors.
## 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.