Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
An AI chat app on Next.js that integrates Kasada bot protection to block abusive LLM API calls before they occur.

Astro landing page starter with gradient background, responsive hamburger/dropdown menu, and switchable floating/fullscreen headers.
Next.js x AI SDK x Kasada is an open-source boilerplate that integrates Vercel's AI SDK with Kasada's bot protection, intercepting API calls to large language models to block abusive usage before it reaches the provider. This template is built for Next.js, uses the AI SDK from the creators of Next.js, and provides client- and server-side Kasada hook files (kasada-client.ts and kasada-server.ts) along with a catch-all route for handling classification requests.
This template is a reference implementation for adding Kasada's advanced bot protection to an AI chat application built on Next.js and Vercel's AI SDK. It takes a standard AI chat flow — incoming requests from an LLM-powered API route — and runs them through Kasada's classification API, producing a decision that blocks abusive traffic before the LLM API call is made. The setup requires a Kasada dashboard, environment variables in .env.local, and moving a prebuilt route file into your app's app/ directory.
kasada-server.ts and kasada-client.ts that must be updated with your Kasada API URL from the dashboard.app/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/[[...restpath]]/route.ts that you move into your own path and configure with KASADA_ENDPOINT and the X-Forwarded-Host header..env.local for configuration, with an .env.local.example file to copy.pnpm i as the package manager.The README walks through a four-step setup: install dependencies with pnpm i, copy the environment example and fill in values, update the Kasada API URL in both kasada-server.ts and kasada-client.ts using the URL format from your Kasada dashboard, and move the provided catch-all route into your app while filling in KASADA_ENDPOINT and the X-Forwarded-Host header. After configuration, incoming chat requests pass through Kasada classification before the LLM call is made.
Kasada is an advanced bot protection platform that detects and blocks automated traffic. This template integrates its classification API into the AI SDK's API call flow.
Yes — the setup requires a Kasada dashboard and an API URL that is specific to your account, so you must have access to Kasada to configure the template.
The AI SDK is provider-agnostic, and the repository's topics reference OpenAI, Anthropic, Gemini, and other language models. The specific model is configured through the AI SDK in your own code.
The AI SDK is free and open-source, and this README doesn't mention a separate license for the example code. The AI SDK repository on GitHub has over 26,000 stars.
