Files
puter/src/puter-js
Daniel Salazar 493334b030
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test (18.x) (push) Has been cancelled
test / test (20.x) (push) Has been cancelled
test / test (22.x) (push) Has been cancelled
chore: update README for puter.js to publish on npm
2025-09-19 02:34:33 -07:00
..
…
2025-07-11 17:03:33 -07:00
2025-01-19 22:27:31 -08:00

Puter.js

The official JavaScript SDK for Puter.com — access cloud and AI features directly from your frontend code.


Installation (npm)

npm install @heyputer/puterjs

Importing

ES Modules

import puter from '@heyputer/puterjs';

CommonJS

const puter = require('@heyputer/puterjs');

Usage Example

// Print a message
puter.print('Hello from Puter.js!');

// Chat with GPT-3.5 Turbo
puter.ai.chat('What color was Napoleon\'s white horse?').then(response => {
  puter.print(response);
});

CDN Usage

Include Puter.js directly in your HTML via CDN:

<script src="https://js.puter.com/v2/"></script>
<script>
  puter.print('Hello from Puter.js via CDN!');
  puter.ai.chat('What color was Napoleon\'s white horse?').then(response => {
    puter.print(response);
  });
</script>

Documentation & Community


Local Development Example

Make sure the development server is running.

<html>
<body>
    <script src="http://puter.localhost:4100/sdk/puter.dev.js"></script>
    <script>
        // Loading ...
        puter.print(`Loading...`);

        // Chat with GPT-3.5 Turbo
        puter.ai.chat(`What color was Napoleon's white horse?`).then((response) => {
            puter.print(response);
        });
    </script>
</body>
</html>