Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
An open-source AI semantic image search app template built with Next.js, Vercel AI SDK, OpenAI, Vercel Postgres, Vercel Blob and Vercel KV.
Semantic Image Search is an open-source boilerplate from Vercel for building an AI-powered semantic image search app. It combines Next.js 14 with the Vercel AI SDK, OpenAI's GPT-4o, and Vercel's Postgres, Blob, and KV storage to index local images and let users find them by natural-language queries.
Semantic Image Search is a complete application template that turns a folder of JPEG images into a searchable web app. It takes local images as input and produces a chat-style interface where users can type a description and receive matching photos streamed from the server. The template is built on Next.js App Router and is maintained by members of the Vercel and Next.js teams, with contributors including Jared Palmer, Shu Ding, shadcn, Lars Grammel, and Nico Albanese.
The repository includes a three-stage indexing pipeline. First, place .jpg images in the images-to-index directory and run pnpm run upload to store them in Vercel Blob. Then run pnpm run generate-metadata to have GPT-4o write a title and description for each image. Finally, run pnpm run embed-and-save to convert those descriptions into vector embeddings and store them in Vercel Postgres using pgvector.
After indexing, the app receives a user's natural-language query, embeds it, finds the closest vectors in Postgres, and streams the matching images back to the browser through the Vercel AI SDK.
Yes, the default configuration uses OpenAI GPT-4o, so you must add your OpenAI API key to your environment variables. The template also lets you switch to Gemini, Anthropic, Cohere, or other AI SDK providers if you change a few lines of code.
The source code is open source and free to clone, but you will pay for Vercel storage and database services and for API calls to your chosen LLM provider based on their usage pricing.
The upload script expects images in .jpg format inside the images-to-index folder at the root of the application.
Yes, the repository includes a "Deploy with Vercel" button that clones the repo and prompts you to set the required environment variables, including your OpenAI API key and the connection strings for KV, Postgres, and Blob.
The template is specifically wired for Vercel Postgres with pgvector and uses Drizzle ORM for schema management; it does not include adapters for other vector stores.
