📁 ai-sdk/cookbook

File: cookbook.md | Updated: 11/15/2025

Source: https://ai-sdk.dev/cookbook

AI SDK

Cookbook

An open-source collection of recipes, guides, and templates for building with the AI SDK.

Guides

View all

Build a RAG Agent Build a SQL Agent Build a Computer Use Agent Build a Slackbot Agent

Show More

Recipes

Next.js

Next.jsNode.jsReact Server ComponentsAPI Servers

streaming

10

chat

4

tool use

4

agent

3

chatbot

2

multi-modal

2

pdf

2

agents

2

tools

2

multimodal

2

structured data

2

rag

1

embeddings

1

database

1

retrieval

1

memory

1

images

1

vision

1

image generation

1

caching

1

middleware

1

markdown

1

mcp

1

useChat

1

context

1

generative user interface

1

RAG Agent

ragchatbot
Multi-Modal Agent

multi-modalagent
Natural Language Postgres

agentstools
Generate Text Generate Text with Chat Prompt

streamingchat
Generate Image with Chat Prompt

streamingchat
Stream Text

streaming
Stream Text with Chat Prompt

streamingchat
Stream Text with Image Prompt

streamingmultimodal
Chat with PDFs

pdfmultimodal
streamText Multi-Step Cookbook

streaming
Markdown Chatbot with Memoization

streamingchatbot
Generate Object

structured data
Generate Object with File Prompt through Form Submission

multi-modal
Stream Object

streamingstructured data
Call Tools

tool use
Call Tools in Multiple Steps

streamingtool use
Model Context Protocol (MCP) Tools

tool useagent
Share useChat State Across Components

useChatcontext
Human-in-the-Loop Agent with Next.js

agentstool use
Send Custom Body from useChat

chat
Render Visual Interface in Chat

generative user interface
Caching Middleware

streamingcaching

Templates

We've built some templates that include AI SDK integrations for different use cases, providers, and frameworks. You can use these templates to get started with your AI-powered application.

Starter Kits

Chatbot Starter Template

Uses the AI SDK and Next.js. Features persistence, multi-modal chat, and more.
Internal Knowledge Base (RAG)

Uses AI SDK Language Model Middleware for RAG and enforcing guardrails.
Multi-Modal Chat

Uses Next.js and AI SDK useChat hook for multi-modal message chat interface.
Semantic Image Search

An AI semantic image search app template built with Next.js, AI SDK, and Postgres.
Natural Language PostgreSQL

Query PostgreSQL using natural language with AI SDK and GPT-4o.

Feature Exploration

Feature Flags Example

AI SDK with Next.js, Feature Flags, and Edge Config for dynamic model switching.
Chatbot with Telemetry

AI SDK chatbot with OpenTelemetry support.
Structured Object Streaming

Uses AI SDK useObject hook to stream structured object generation.
Multi-Step Tools

Uses AI SDK streamText function to handle multiple tool steps automatically.

Frameworks

Next.js OpenAI Starter

Uses OpenAI GPT-4, AI SDK, and Next.js.
Nuxt OpenAI Starter

Uses OpenAI GPT-4, AI SDK, and Nuxt.js.
SvelteKit OpenAI Starter

Uses OpenAI GPT-4, AI SDK, and SvelteKit.
Solid OpenAI Starter

Uses OpenAI GPT-4, AI SDK, and Solid.

Generative UI

Gemini Chatbot

Uses Google Gemini, AI SDK, and Next.js.
Generative UI with RSC (experimental)

Uses Next.js, AI SDK, and streamUI to create generative UIs with React Server Components.

Security

Bot Protection

Uses Kasada, OpenAI GPT-4, AI SDK, and Next.js.
Rate Limiting

Uses Vercel KV, OpenAI GPT-4, AI SDK, and Next.js.

📁 Children

Directory listing - 5 item(s) total