Vercel AI SDK's Google Vertex template using Next
This example shows how to use the AI SDK with Next.js and Google Vertex AI to validate that the AI SDK's Google Vertex provider can run successfully in the Edge runtime.
Deploy the example using Vercel:
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-google-vertex-edge next-vertex-edge-app
To run the example locally you need to:
Set up a Google Cloud Project
Enable the Vertex AI API
Choose one of the following authentication methods:
Option A: API Key (Express Mode - Recommended for getting started)
GOOGLE_VERTEX_API_KEY in your environmentOption B: Service Account (OAuth)
GOOGLE_CLIENT_EMAIL, GOOGLE_PRIVATE_KEY, and optionally GOOGLE_PRIVATE_KEY_IDGOOGLE_VERTEX_PROJECT and GOOGLE_VERTEX_LOCATIONpnpm install to install the required dependencies
pnpm dev to launch the development server
To learn more about Google Vertex AI, Next.js, and the AI SDK take a look at the following resources: