Chat

This example shows how to build a chat using Superinterface and Next.js.
Next Example Assistant
AI Provider
OpenAI Assistants API logo
OpenAI Assistants API
gpt-4o-mini
Instructions
You are a helpful assistant.
Functions
No functions used.
'use client' import { useState } from 'react' import { SuperinterfaceProvider, Thread, AssistantNameContext, } from '@superinterface/react' import { Theme, Flex } from '@radix-ui/themes' import '@radix-ui/themes/styles.css' import { QueryClient, QueryClientProvider, } from '@tanstack/react-query' export default function Page() { const [queryClient] = useState(() => ( new QueryClient({ defaultOptions: { queries: { // With SSR, we usually want to set some default staleTime // above 0 to avoid refetching immediately on the client staleTime: 10000, }, }, }) )) return ( <QueryClientProvider client={queryClient}> <Theme accentColor="blue" grayColor="gray" appearance="light" radius="medium" scaling="100%" > <SuperinterfaceProvider variables={{ publicApiKey: '37245be8-902a-440e-aaae-c56151fe8acc', assistantId: '26518c2b-07e4-44a7-bc62-36b0b3922bc7', }} > <AssistantNameContext.Provider value="Next Example Assistant"> <Flex flexGrow="1" height="100dvh" > <Thread.Root> <Thread.Messages style={{ padding: 'var(--space-5)', }} /> <Flex direction="column" pl="5" pr="5" pb="5" flexShrink="0" > <Thread.MessageForm /> </Flex> </Thread.Root> </Flex> </AssistantNameContext.Provider> </SuperinterfaceProvider> </Theme> </QueryClientProvider> ) }
Examples are hosted here: https://examples-next.superinterface.ai (see code here)
Otherwise, this is a Next.js project bootstrapped with create-next-app.

Getting Started

Install the dependencies:
npm install
First, run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Inter, a custom Google Font.

Learn More

To learn more about Next.js, take a look at the following resources:
Next.js Documentation - learn about Next.js features and API.
Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.