# Discover the power of the Node.js SDK

The [Clarifai Node.js SDK](https://github.com/Clarifai/clarifai-nodejs) is your gateway for effortlessly integrating AI capabilities into your JavaScript and Node.js applications. Built using TypeScript, this SDK empowers you to easily interact with the Clarifai API using an intuitive and object-oriented approach.

With TypeScript's strong typing and modern features, you can automate your AI workflows with minimal code. It’s the ideal tool to bring AI-powered features to your Node.js projects.

## Installation

You can install the latest stable version of the Clarifai Node.js SDK by running:

```sh
npm install clarifai-nodejs
```

## Authentication

Clarifai uses [Personal Access Tokens](https://docs.clarifai.com/control/authentication/pat) (PATs) to authenticate API requests. You can obtain one from your personal settings page by navigating to the **Security** section.

You can export your PAT as an environment variable. Then, import and initialize the API client.

Here is how to set your PAT as an environment variable through the terminal:

```cmd
export CLARIFAI_PAT=YOUR_PAT_HERE
```

Alternatively, use [dotenv](https://www.npmjs.com/package/dotenv) to load environment variables from a `.env` file. This is useful for managing secrets in Node.js applications.

## How to Use Node.js SDK in Next.js Server Components

To integrate the Clarifai Node.js SDK in a Next.js App Directory project with server components, you need to explicitly add the [clarifai-nodejs-grpc](https://github.com/Clarifai/clarifai-nodejs-grpc) package to the [serverComponentsExternalPackages](https://nextjs.org/docs/app/api-reference/next-config-js/serverComponentsExternalPackages) configuration in your `next.config.js` file.

This ensures that Next.js properly handles the gRPC dependencies required by the Clarifai SDK, allowing you to use AI-powered inference in your server-side components.

```js
/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    serverComponentsExternalPackages: ['clarifai-nodejs-grpc'],
  },
}

module.exports = nextConfig
```

## Minimum System Requirements

The Clarifai Node.js package is lightweight and designed to run on any modern system.

You’ll need Node.js version 18 or higher to run it.

> **Note**: The package supports all major operating systems (Windows, macOS — including Intel and Apple Silicon — and Linux) as long as Node.js 18+ is installed.

- [Installation](https://docs.clarifai.com/resources/api-overview/nodejs-sdk/#installation)
- [Authentication](https://docs.clarifai.com/resources/api-overview/nodejs-sdk/#authentication)
- [How to Use Node.js SDK in Next.js Server Components](https://docs.clarifai.com/resources/api-overview/nodejs-sdk/#how-to-use-nodejs-sdk-in-nextjs-server-components)
- [Minimum System Requirements](https://docs.clarifai.com/resources/api-overview/nodejs-sdk/#minimum-system-requirements)

Build your next AI app, test and tune popular LLMs models, and much more.

[Get started for free](/content/explore/index.html)
