Recipes
Build specific AI features faster.
Focused, production-ready recipes with runnable examples — from structured extraction to durable agents. Each recipe ships complete client and server code.
RAG Agent
Learn how to build a RAG Agent with the AI TOOLKIT and Next.js
Multi-Modal Agent
Learn how to build a multi-modal agent that can process images and PDFs with the AI TOOLKIT.
Slackbot Agent Guide
Learn how to use the AI TOOLKIT to build an AI Agent in Slack.
Natural Language Postgres
Learn how to build a Next.js app that lets you talk to a PostgreSQL database in natural language.
Get started with Computer Use
Get started with Claude's Computer Use capabilities with the AI TOOLKIT
Get started with Gemini 3
Get started with Gemini 3 using the AI TOOLKIT.
Get started with Claude 4
Get started with Claude 4 using the AI TOOLKIT.
OpenAI Responses API
Get started with the OpenAI Responses API using the AI TOOLKIT.
Google Gemini Image Generation
Generate and edit images with Google Gemini 2.5 Flash Image using the AI TOOLKIT.
Get started with Claude 3.7 Sonnet
Get started with Claude 3.7 Sonnet using the AI TOOLKIT.
Get started with Llama 3.1
Get started with Llama 3.1 using the AI TOOLKIT.
Get started with GPT-5
Get started with GPT-5 using the AI TOOLKIT.
Get started with OpenAI o1
Get started with OpenAI o1 using the AI TOOLKIT.
Get started with OpenAI o3-mini
Get started with OpenAI o3-mini using the AI TOOLKIT.
Get started with DeepSeek R1
Get started with DeepSeek R1 using the AI TOOLKIT.
Get started with DeepSeek V3.2
Get started with DeepSeek V3.2 using the AI TOOLKIT.
Generate Text
Learn how to generate text using the AI TOOLKIT and Next.js.
Generate Text with Chat Prompt
Learn how to generate text with chat prompt using the AI TOOLKIT and Next.js
Generate Image with Chat Prompt
Learn how to generate an image with a chat prompt using the AI TOOLKIT and Next.js
Caching Middleware
Learn how to create a caching middleware with Next.js and KV.
Stream Text
Learn how to stream text using the AI TOOLKIT and Next.js
Stream Text with Chat Prompt
Learn how to generate text using the AI TOOLKIT and Next.js
Stream Text with Image Prompt
Learn how to stream text with an image prompt using the AI TOOLKIT and Next.js
Chat with PDFs
Learn how to build a chatbot that can understand PDFs using the AI TOOLKIT and Next.js
streamText Multi-Step Cookbook
Learn how to create several streamText steps with different settings
Markdown Chatbot with Memoization
Build a chatbot that renders and memoizes Markdown responses with Next.js and the AI TOOLKIT.
Generate Object
Learn how to generate object using the AI TOOLKIT and Next.js
Generate Object with File Prompt through Form Submission
Learn how to generate object with file prompt through form submission using the AI TOOLKIT and Next.js
Stream Object
Learn how to stream object using the AI TOOLKIT and Next.js
Call Tools
Learn how to call tools using the AI TOOLKIT and Next.js
Call Tools in Multiple Steps
Learn how to call tools in multiple steps using the AI TOOLKIT and Next.js
Model Context Protocol (MCP) Tools
Learn how to use MCP tools with the AI TOOLKIT and Next.js
Share useChat State Across Components
Learn how to share a chat instance across multiple components with useChat and easily reset the chat.
Human-in-the-Loop Agent with Next.js
Add a human approval step to your agentic system with Next.js and the AI TOOLKIT
Track Agent Token Usage
Learn how to track the active context window with ToolLoopAgent.
Send Custom Body from useChat
Learn how to send a custom body from the useChat hook using the AI TOOLKIT and Next.js
Streaming with Custom Format
Build a custom format to stream LLM responses
Render Visual Interface in Chat
Learn how to render visual interfaces in chat using the AI TOOLKIT and Next.js
Generate Text
Learn how to generate text using the AI TOOLKIT and Node
Retrieval Augmented Generation
Learn how to use retrieval augmented generation using the AI TOOLKIT and Node
Knowledge Base Agent
Build an AI agent that can read from and write to a knowledge base using Upstash Search and the AI TOOLKIT
Generate Text with Chat Prompt
Learn how to generate text with chat prompt using the AI TOOLKIT and Node
Generate Text with Image Prompt
Learn how to generate text with image prompt using the AI TOOLKIT and Node
Stream Text
Learn how to stream text using the AI TOOLKIT and Node
Stream Text with Chat Prompt
Learn how to stream text with chat prompt using the AI TOOLKIT and Node
Stream Text with Image Prompt
Learn how to stream text with image prompt using the AI TOOLKIT and Node
Stream Text with File Prompt
Learn how to stream text with file prompt using the AI TOOLKIT and Node
Generate Object with a Reasoning Model
Learn how to generate structured data with a reasoning model using the AI TOOLKIT and Node
Generate Object
Learn how to generate structured data using the AI TOOLKIT and Node
Stream Object
Learn how to stream structured data using the AI TOOLKIT and Node
Stream Object with Image Prompt
Learn how to stream structured data with an image prompt using the AI TOOLKIT and Node
Record Token Usage After Streaming Object
Learn how to record token usage when streaming structured data using the AI TOOLKIT and Node
Record Final Object after Streaming Object
Learn how to record the final object after streaming an object using the AI TOOLKIT and Node
Call Tools
Learn how to call tools using the AI TOOLKIT and Node
Call Tools in Parallel
Learn how to call tools in parallel using the AI TOOLKIT in Node.js
Call Tools with Image Prompt
Learn how to call tools with image prompt using the AI TOOLKIT and Node
Call Tools in Multiple Steps
Learn how to call tools with multiple steps using the AI TOOLKIT and Node
Model Context Protocol (MCP) Tools
Learn how to use MCP tools with the AI TOOLKIT and Node
Manual Agent Loop
Learn how to create your own agentic loop with full control over tool execution
Web Search Agent
Learn how to build an agent that has access to web with the AI TOOLKIT and Node
Model Context Protocol (MCP) Elicitation
Learn how to handle elicitation requests from MCP servers with the AI TOOLKIT
Embed Text
Learn how to embed text using the AI TOOLKIT and Node
Embed Text in Batch
Learn how to embed multiple text using the AI TOOLKIT and Node
Intercepting Fetch Requests
Learn how to intercept fetch requests using the AI TOOLKIT and Node
Local Caching Middleware
Learn how to create a caching middleware for local development.
Repair Malformed JSON with jsonrepair
Learn how to use the jsonrepair library to automatically fix truncated or malformed JSON output from language models.
Dynamic Prompt Caching
Learn how to reduce API costs by implementing dynamic prompt caching for Anthropic models using cache control directives.
Node.js HTTP Server
Learn how to use the AI TOOLKIT in a Node.js HTTP server
Express
Learn how to use the AI TOOLKIT in an Express server
Hono
Example of using the AI TOOLKIT in a Hono server.
Fastify
Learn how to use the AI TOOLKIT in a Fastify server
Nest.js
Learn how to use the AI TOOLKIT in a Nest.js server
Generate Text
Learn how to generate text using the AI TOOLKIT and React Server Components.
Generate Text with Chat Prompt
Learn how to generate text with chat prompt using the AI TOOLKIT and React Server Components.
Stream Text
Learn how to stream text using the AI TOOLKIT and React Server Components.
Stream Text with Chat Prompt
Learn how to stream text with chat prompt using the AI TOOLKIT and React Server Components.
Generate Object
Learn how to generate object using the AI TOOLKIT and React Server Components.
Stream Object
Learn how to stream object using the AI TOOLKIT and React Server Components.
Call Tools
Learn how to call tools using the AI TOOLKIT and React Server Components.
Call Tools in Parallel
Learn how to tools in parallel text using the AI TOOLKIT and React Server Components.
Save Messages To Database
Learn how to save messages to an external database using the AI TOOLKIT and React Server Components
Restore Messages From Database
Learn how to restore messages from an external database using the AI TOOLKIT and React Server Components
Render Visual Interface in Chat
Learn how to generate text using the AI TOOLKIT and React Server Components.
Stream Updates to Visual Interfaces
Learn how to generate text using the AI TOOLKIT and React Server Components.
Record Token Usage after Streaming User Interfaces
Learn how to record token usage after streaming user interfaces using the AI TOOLKIT and React Server Components