Getting Started


Quick Start

Install Puter.js using NPM or include it directly via CDN.

NPM module
CDN (script tag)

Install

npm install @heyputer/puter.js

Use in the browser

import { puter } from "@heyputer/puter.js";

// Example: Use AI to answer a question
puter.ai.chat(`Why did the chicken cross the road?`).then(console.log);

Use in Node.js

import { init } from "@heyputer/puter.js/src/init.cjs";
const puter = init(process.env.puterAuthToken);

// Example: Use AI to answer a question
puter.ai.chat("What color was Napoleon's white horse?").then(console.log);

Include the script

<script src="https://js.puter.com/v2/"></script>

Use in the browser

<html>
  <body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
      puter.ai.chat(`Why did the chicken cross the road?`).then(puter.print);
    </script>
  </body>
</html>

Starter templates

Additionally, you can use one of the following starter templates to get started:

React Next.js Angular Vue.js Svelte Astro Vanilla JavaScript Node.js + Express


Where to Go From Here

To learn more about the capabilities of Puter.js and how to use them in your web application, check out

  • Tutorials: Step-by-step guides to help you get started with Puter.js and build powerful applications.

  • Playground: Experiment with Puter.js in your browser and see the results in real-time. Many examples are available to help you understand how to use Puter.js effectively.

  • Examples: A collection of code snippets and full applications that demonstrate how to use Puter.js to solve common problems and build innovative applications.