Examples for Next.js Pages Router

The Vercel AI SDK is designed to work with Next.js Pages Router. The examples will demonstrate querying the language model and rendering the user interfaces using ai/core and @ai-sdk/react, respectively.

Next.js Compatibility

Frameworkai/rscai/core@ai-sdk/react
Next.js App Router
Next.js Pages Router

Note: The App Router fully supports React Server Components, enhancing your development experience when using ai/rsc. This integration makes it easier to manage building Generative User Interfaces and improves Server-Client State Management, offering a more streamlined development process.