Skip to main content

Models

Explore our complete list of models and API references here.

Prerequisites

Before you begin, make sure you have:

Installation

Add the JigsawStack SDK to your Next.js project:

Configuration

Setting up environment variables

  1. Create or modify your .env.local file in the root of your Next.js project:
.env.local
  1. For production, make sure to add the environment variable to your deployment platform (Vercel, Netlify, etc.)

API Route Implementation

JigsawStack can be easily integrated into Next.js API routes. Here’s an example of a web-search API endpoint:
pages/api/web-search.ts

Client-Side Implementation

For client components that need to use JigsawStack, you should make requests through your API routes rather than directly from the client to protect your API key.
components/WebSearchButton.jsx

App Router Support

If you’re using Next.js App Router, you can create a route handler:
app/api/web-search/route.ts
JigsawStack seamlessly integrates with Next.js to provide powerful AI capabilities while maintaining best practices for security and performance.