logo

Quick Start

Getting started with Prexo AI

We currently support all major React.js frameworks, including Next.js, Remix, and Vite. If you’re using a different setup or not using a React.js framework at all, feel free to open a support request in our Discord Community.

This documentation is based on the Next.js framework. All examples and code snippets provided will use a Next.js application for demonstration.

Installation

No other dependencies required.

npm install @prexo/ai-chat-sdk

Prerequisites

  • A Prexo account. You can sign up for free at Prexo.
  • An API key. You can find your API key in the Prexo dashboard after signing up. Copy it.
  • A Next.js, Remix, or Vite application set up. If you don't have one, you can create a new one.

Create a .env.local or .env file in the root of your project and add your Prexo API key to it.

.env.local
PREXO_API_KEY="prexo_f0nk*********"

Setup

You need to initialize the Prexo AI Chat SDK in your application's root layout or main component.

This is how your project structure should look like:

layout.tsx
page.tsx
global.css
package.json
.env.local

And this is how you should initialize the SDK inside the app/layout.tsx file:

app/layout.tsx
import type { Metadata } from "next";
import React from "react";
import "./globals.css";
import { PrexoAiChatBot } from "@prexo/ai-chat-sdk";

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en" suppressHydrationWarning>
      <body>
      {children}
      </body>
        <PrexoAiChatBot
          apiKey={process.env.PREXO_API_KEY!} // your Prexo API key goes here
          position="bottom-right"
          sessionId="1234" // you can use a unique session ID for each user or conversation
        />
    </html>
  );

Usage

You will now be able to use the Prexo AI Chat SDK in your application. The chat widget will appear in the bottom right corner of your application.

In order to use all of the Prexo AI Chat SDK features, please follow the Ai Chat SDK documentation to learn how to configure the SDK and use it effectively.

How is this guide?

Last updated on 7/24/2025

Edit on GitHub