> ## Documentation Index
> Fetch the complete documentation index at: https://daily-mb-reorg-api-reference-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Client SDKs

> Client libraries for building real-time AI applications with Pipecat

<Note>
  All Client SDKs have transitioned to v1.0, which uses a new, simpler API
  design. For guidance in transitioning to the new API, please refer to the
  migration guide for each platform. If you have any questions or need
  assistance, please reach out to us on [Discord](https://discord.gg/pipecat).
</Note>

Pipecat provides client SDKs for multiple platforms, all implementing the RTVI (Real-Time Voice and Video Inference) standard. These SDKs make it easy to build real-time AI applications that can handle voice, video, and text interactions.

<CardGroup cols={3}>
  <Card title="Javascript" icon="JS" color="#f7e014" href="/client/js/introduction">
    Pipecat JS SDK
  </Card>

  <Card title="React" icon="react" color="#56c4db" href="/client/react/introduction">
    Pipecat React SDK
  </Card>

  <Card title="React Native" icon="react" color="#56c4db" href="/client/react-native/introduction">
    Pipecat React Native SDK
  </Card>

  <Card title="Swift" icon="swift" color="#F05138" vertical="true" href="/client/ios/introduction">
    Pipecat iOS SDK
  </Card>

  <Card title="Kotlin" icon="android" color="#78C257" href="/client/android/introduction">
    Pipecat Android SDK
  </Card>

  <Card title="C++" icon="C" color="#679cd3" href="/client/c++/introduction">
    Pipecat C++ SDK
  </Card>
</CardGroup>

## Core Functionality

All Pipecat client SDKs provide:

<CardGroup cols={2}>
  <Card title="Media Management" icon="video">
    Handle device inputs and media streams for audio and video
  </Card>

  <Card title="Bot Integration" icon="robot">
    Configure and communicate with your Pipecat bot
  </Card>

  <Card title="Session Management" icon="arrows-rotate">
    Manage connection state and error handling
  </Card>
</CardGroup>

## Core Types

### PipecatClient

The main class for interacting with Pipecat bots. It is the primary type you will interact with.

### Transport

The `PipecatClient` wraps a Transport, which defines and provides the underlying connection mechanism (e.g., WebSocket, WebRTC). Your Pipecat pipeline will contain a corresponding transport.

### RTVIMessage

Represents a message sent to or received from a Pipecat bot.

## Simple Usage Examples

<Tabs>
  <Tab title="Connecting to a Bot">
    Establish ongoing connections via WebSocket or WebRTC for:

    * Live voice conversations
    * Real-time video processing
    * Continuous interactions

    <CodeGroup>
      ```javascript javascript theme={null}
      // Example: Establishing a real-time connection
      import { RTVIEvent, RTVIMessage, PipecatClient } from "@pipecat-ai/client-js";
      import { DailyTransport } from "@pipecat-ai/daily-transport";

      const pcClient = new PipecatClient({
        transport: new DailyTransport(),
        enableMic: true,
        enableCam: false,
        enableScreenShare: false,
        callbacks: {
          onBotConnected: () => {
            console.log("[CALLBACK] Bot connected");
          },
          onBotDisconnected: () => {
            console.log("[CALLBACK] Bot disconnected");
          },
          onBotReady: () => {
            console.log("[CALLBACK] Bot ready to chat!");
          },
        },
      });

      try {
        // Below, we use a REST endpoint to fetch connection credentials for our
        // Daily Transport. Alternatively, you could provide those credentials
        // directly to `connect()`.
        await pcClient.startBotAndConnect({
          endpoint: "https://your-connect-end-point-here/connect",
        });
      } catch (e) {
        console.error(e.message);
      }

      // Events (alternative approach to constructor-provided callbacks)
      pcClient.on(RTVIEvent.Connected, () => {
        console.log("[EVENT] User connected");
      });
      pcClient.on(RTVIEvent.Disconnected, () => {
        console.log("[EVENT] User disconnected");
      });
      ```

      ```jsx react theme={null}
      // Example: Using PipecatClient in a React component
      import { PipecatClient } from "@pipecat-ai/client-js";
      import {
        PipecatClientProvider,
        PipecatClientAudio,
        usePipecatClient,
        useRTVIClientEvent,
      } from "@pipecat-ai/client-react";
      import { DailyTransport } from "@pipecat-ai/daily-transport";

      // Create the client instance
      const client = new PipecatClient({
        transport: new DailyTransport(),
        enableMic: true,
      });

      // Root component wraps the app with the provider
      function App() {
        return (
          <PipecatClientProvider client={client}>
            <VoiceBot />
            <PipecatClientAudio />
          </PipecatClientProvider>
        );
      }

      // Component using the client
      function VoiceBot() {
        const client = usePipecatClient();

        const handleClick = async () => {
          await client.startBotAndConnect({
            endpoint: `${process.env.PIPECAT_API_URL || "/api"}/connect`
          });
        };

        return (
          <button onClick={handleClick}>Start Conversation</button>;
        );
      }

      function EventListener() {
        useRTVIClientEvent(
          RTVIEvent.Connected,
          useCallback(() => {
            console.log("[EVENT] User connected");
          }, [])
        );
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Custom Messaging">
    Send custom messages and handle responses from your bot. This is useful for:

    * Running server-side functionality
    * Triggering specific bot actions
    * Querying the server
    * Responding to server requests

    <CodeGroup>
      ```javascript javascript theme={null}
      import { PipecatClient } from "@pipecat-ai/client-js";

      const pcClient = new PipecatClient({
        transport: new DailyTransport(),
        callbacks: {
          onBotConnected: () => {
            pcClient
              .sendClientRequest("get-language")
              .then((response) => {
                console.log("[CALLBACK] Bot using language:", response);
                if (response !== preferredLanguage) {
                  pcClient.sendClientMessage("set-language", {
                    language: preferredLanguage,
                  });
                }
              })
              .catch((error) => {
                console.error("[CALLBACK] Error getting language:", error);
              });
          },
          onServerMessage: (message) => {
            console.log("[CALLBACK] Received message from server:", message);
          },
        },
      });
      // Here we have obtained the connection details separately and pass them
      // directly to connect().
      // Alternatively, you can use a connection endpoint to fetch these details
      // using `startBotAndConnect()`.
      await pcClient.connect({
        url: "https://your-daily-room-url",
        token: "your-daily-token",
      });
      ```

      ```jsx react theme={null}
      // Example: Messaging in a React application
      import { useCallback } from "react";
      import { RTVIEvent, TransportState } from "@pipecat-ai/client-js";
      import { usePipecatClient, useRTVIClientEvent } from "@pipecat-ai/client-react";

      function EventListener() {
        const pcClient = usePipecatClient();
        useRTVIClientEvent(
          RTVIEvent.BotConnected,
          useCallback(() => {
            pcClient
              .sendClientRequest("get-language")
              .then((response) => {
                console.log("[CALLBACK] Bot using language:", response);
                if (response !== preferredLanguage) {
                  pcClient.sendClientMessage("set-language", {
                    language: preferredLanguage,
                  });
                }
              })
              .catch((error) => {
                console.error("[CALLBACK] Error getting language:", error);
              });
          }, []),
        );
        useRTVIClientEvent(
          RTVIEvent.ServerMessage,
          useCallback((data) => {
            console.log("[CALLBACK] Received message from server:", data);
          }, []),
        );
      }
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## About RTVI

Pipecat's client SDKs implement the RTVI (Real-Time Voice and Video Inference) standard, an open specification for real-time AI inference. This means:

* Your code can work with any RTVI-compatible inference service
* You get battle-tested tooling for real-time multimedia handling
* You can easily set up development and testing environments

## Next Steps

Get started by trying out examples:

<CardGroup cols={2}>
  <Card title="Simple Chatbot Example" icon="robot" href="https://github.com/pipecat-ai/pipecat-examples/tree/main/simple-chatbot">
    Complete client-server example with both bot backend (Python) and frontend
    implementation (JS, React, React Native, iOS, and Android).
  </Card>

  <Card title="More Examples" icon="code" href="https://github.com/pipecat-ai/pipecat-examples">
    Explore our full collection of example applications and implementations
    across different platforms and use cases.
  </Card>
</CardGroup>
