Project Setup - Get Your Hands Dirty!
You've grasped some of the core LLM concepts. Now for the exciting part: setting up your local development environment and getting hands-on with the Vercel AI SDK. This is where you really get your hands dirty and prepare to build the cool AI features we've been talking about, like automatic summarization and building intelligent chatbots.
You will get the starter project running locally, securely configure the Vercel AI Gateway, and confirm everything works so you're ready to start coding AI in the next lesson.
Let's go!
Step 1: Getting the Code
First, grab the starter project code. This repository contains all the files and setup needed for the course. Open your terminal (or command prompt) and run this command to clone it:
git clone https://github.com/vercel/ai-sdk-fundamentals-starter.gitThis copies the project files to your computer.
Step 2: Navigating Into the Project
Now, move into the project directory you just cloned. Use the cd (change directory) command:
cd ai-sdk-fundamentals-starterYour terminal prompt should now show you're inside the ai-sdk-fundamentals-starter folder.
Step 3: Installing Dependencies
Next, install the necessary libraries (AI SDK, Next.js, etc.). This project uses pnpm for fast and efficient package management. Run:
pnpm installThis might take a minute or two.
Step 4: Setting Up the Vercel AI Gateway
AI models are accessed through API endpoints and typically this means you need to setup individual accounts and secure API keys for each provider. The Vercel AI Gateway simplifies this and allows you to access models from multiple providers through a single endpoint.
You have two options for authentication with the AI Gateway:
Step 5: Making Sure It Works!
Let's verify your setup. The project has a simple script (env-check.ts) to confirm your authentication is configured correctly. Run it:
pnpm tsx env-check.tsYou should see this in your terminal:
If using OIDC (Option A):
🔍 Checking environment configuration...
✅ VERCEL_OIDC_TOKEN found - Vercel AI Gateway with OIDC auth
Token preview: xxxxxxxxxxxxxxxxxxxxxxxx...
❌ AI_GATEWAY_API_KEY not found
📋 Summary:
✅ Environment is configured correctly!
Using: Vercel AI Gateway (OIDC authentication)
Note: OIDC tokens expire after 12 hours. Use 'vercel dev' for auto-refresh.If using API Key (Option B):
🔍 Checking environment configuration...
❌ VERCEL_OIDC_TOKEN not found
✅ AI_GATEWAY_API_KEY found - Vercel AI Gateway with API key auth
Key preview: xxxxxxxxxxxxxxxxxxxxxxxx...
📋 Summary:
✅ Environment is configured correctly!
Using: Vercel AI Gateway (API key authentication)Setup Checklist
Common Setup Issues & Troubleshooting
Next Up: Your First AI Script
Congratulations! Your development environment is set up and ready.
Now you'll write and run code that uses the AI SDK to interact with an LLM and perform a practical task: extracting structured data from text. Time to start building.
Was this helpful?