In the root of your project, create a .env
file and add your OpenAI API key:
OPENAI_API_KEY=sk-...
npm install @beak/next --save
# or
yarn add @beak/next
Create a new wildcard API route in pages/api/beak/[...path].ts
:
import { beakHandler } from "@beakjs/next";
const handler = beakHandler();
export default handler;
const App = () => {
return <Beak baseUrl="/api/beak">... your app code goes here</Beak>;
};