The Vercel AI Gateway Embeddings Demo is a Next.js boilerplate chatbot that demonstrates retrieval-augmented generation (RAG) using embedding models routed through the Vercel AI Gateway, with vectors stored in Neon.
What is the Vercel AI Gateway Embeddings Demo?
This is a simple Next.js app that lets you paste facts or documents into a chat interface and receive answers grounded on that content. It takes pasted text as input, chunks it, generates embeddings through the Vercel AI Gateway, and stores those vectors in Neon PostgreSQL. When you ask a question, the app embeds your query, performs a cosine-similarity search over the stored chunks, and sends the retrieved snippets to a model to compose an answer. It is maintained by the Vercel team and community contributors.
Key Features
- RAG pipeline out of the box — The app handles chunking, embedding, vector storage, similarity search, and answer generation without custom glue code.
- Embeddings via Vercel AI Gateway — All embedding model calls go through the Vercel AI Gateway, giving you a single API to switch between embedding providers.
- Vector storage in Neon — Chunk embeddings are stored in Neon, a serverless PostgreSQL database, via a Vercel Storage integration.
- Cosine similarity retrieval — Queries are matched against stored chunks by cosine similarity, returning the most relevant context snippets.
- One-click deploy on Vercel — The repository includes a Deploy with Vercel button that clones the repo, creates a Vercel project, and provisions a Neon storage integration automatically.
- Local development with Vercel CLI — The setup uses
vc devplusvc env pullto manage environment variables and OIDC authentication tokens. - Simple chat interface — A single-page Next.js chat UI at localhost:3000 lets you test the flow immediately.
Who should use this template?
- Next.js developers building AI chat features who want a working reference for RAG with Vercel AI Gateway and Neon.
- AI engineers prototyping semantic search or document Q&A over private knowledge bases without setting up infrastructure from scratch.
- Developers evaluating embedding providers who want to compare how different models perform through the AI Gateway.
- Educators and learners who need a minimal, readable codebase to study the end-to-end RAG pattern.
What can you do with the Vercel AI Gateway Embeddings Demo?
- Build a document Q&A bot: paste policy documents, meeting notes, or product specs into the chat, then ask questions that the model answers strictly from those documents.
- Test embedding model quality: route different embedding models through the Vercel AI Gateway and compare retrieval accuracy on your own corpus.
- Prototype a semantic search feature: use the cosine-similarity retrieval step as a reference for adding vector search to a larger application.
How does the RAG flow work?
The app follows a five-step process. First, pasted text is split into chunks. Second, each chunk is embedded by a model called through the Vercel AI Gateway. Third, the resulting vectors are stored in Neon. Fourth, when you ask a question, your query is embedded and a cosine-similarity search retrieves the most relevant chunks. Finally, a language model generates an answer from only those retrieved snippets.
FAQ
How does AI Gateway billing work?
The README links to the Vercel AI Gateway pricing page for details on how usage is billed. AI Gateway charges per token or per request depending on the provider used, but this template does not include its own pricing tier.
Why should I use vc dev instead of running the Next.js dev server directly?
Using vc dev automatically manages the OIDC authentication token for local development. The token expires every 12 hours, so pulling environment variables with vc env pull is needed periodically when running without vc dev.
Do I need a Neon database to run this app?
Yes, the app stores embeddings in Neon. The one-click deploy option provisions a Neon storage integration for you, while local setup requires you to link a Neon database and pull its credentials via vc env pull.
Can I contribute to this project?
Yes, the repository accepts contributions. The README states that issues and pull requests are welcome from the community to enhance functionality or fix bugs.







