Vercel AI SDK's FastAPI template using Next
These examples show you how to use the AI SDK with Next.js and FastAPI.
Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example https://github.com/vercel/ai/tree/main/examples/next-fastapi next-fastapi-app
yarn create next-app --example https://github.com/vercel/ai/tree/main/examples/next-fastapi next-fastapi-app
pnpm create next-app --example https://github.com/vercel/ai/tree/main/examples/next-fastapi next-fastapi-app
You will also need Python 3.6+ and virtualenv installed to run the FastAPI server.
To run the example locally you need to:
.env.local.virtualenv venv to create a python virtual environment.source venv/bin/activate to activate the python virtual environment.pip install -r requirements.txt to install the required python dependencies.pnpm install to install the required dependencies.pnpm dev to launch the development server.To learn more about the AI SDK, Next.js, and FastAPI take a look at the following resources: