npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yassirbenmoussa/aicommerce-sdk

v1.9.15

Published

AI Commerce SDK - AI-powered product recommendations for e-commerce

Readme

AI Commerce SDK

AI-powered product recommendations for e-commerce. This SDK allows you to easily integrate AI Commerce into your website or application.

Installation

npm / yarn / pnpm

npm install @yassirbenmoussa/aicommerce-sdk
# or
yarn add @yassirbenmoussa/aicommerce-sdk
# or
pnpm add @yassirbenmoussa/aicommerce-sdk

Script Tag (CDN)

<script src="https://cdn.aicommerce.dev/sdk/ai-commerce.min.js"></script>

Quick Start

ES Modules / TypeScript

import { AICommerce } from '@yassirbenmoussa/aicommerce-sdk';

// Initialize the client
const client = new AICommerce({
  apiKey: 'your-api-key',
  storeId: 'your-store-id',
});

// Send a message and get product recommendations
const response = await client.chat('I need a laptop under $1000');

console.log(response.reply);      // AI response text
console.log(response.products);   // Recommended products

CommonJS

const { AICommerce } = require('@yassirbenmoussa/aicommerce-sdk');

const client = new AICommerce({
  apiKey: 'your-api-key',
  storeId: 'your-store-id',
});

client.chat('I need a laptop').then(response => {
  console.log(response.products);
});

Script Tag

<script src="https://cdn.aicommerce.dev/sdk/ai-commerce.min.js"></script>
<script>
  const client = new AICommerceSDK.AICommerce({
    apiKey: 'your-api-key',
    storeId: 'your-store-id'
  });

  client.chat('I need a laptop').then(response => {
    console.log(response.products);
  });
</script>

API Reference

new AICommerce(config)

Create a new AI Commerce client.

| Option | Type | Required | Description | |--------|------|----------|-------------| | apiKey | string | Yes | Your API key from the dashboard | | storeId | string | Yes | Your Store ID from the dashboard | | baseUrl | string | No | API base URL (defaults to auto-detect) | | timeout | number | No | Request timeout in ms (default: 30000) |

client.chat(message, context?)

Send a message and get product recommendations.

const response = await client.chat('I need running shoes', {
  budget: { max: 150, currency: 'USD' },
  preferences: ['comfortable', 'lightweight']
});

Returns:

{
  reply: string;           // AI response text
  products: Product[];     // Recommended products
  sessionToken: string;    // For follow-up messages
  suggestions?: string[];  // Suggested follow-up questions
  confidence?: number;     // AI confidence score (0-1)
}

client.createSession()

Create a new chat session explicitly.

const session = await client.createSession();
console.log(session.token);

client.clearSession()

Clear the current session token.

AICommerce.quickChat(options)

Static method for one-off requests without creating a client instance.

const response = await AICommerce.quickChat({
  apiKey: 'your-api-key',
  message: 'I need a laptop',
  context: { budget: { max: 1000 } }
});

TypeScript Support

Full TypeScript support with exported types:

import type {
  AICommerceConfig,
  ChatRequest,
  ChatResponse,
  Product,
  ChatContext
} from '@yassirbenmoussa/aicommerce-sdk';

Error Handling

import { AICommerce, AICommerceError } from '@yassirbenmoussa/aicommerce-sdk';

try {
  const response = await client.chat('Hello');
} catch (error) {
  if (error instanceof AICommerceError) {
    console.log(error.code);    // Error code (e.g., 'UNAUTHORIZED')
    console.log(error.status);  // HTTP status code
    console.log(error.message); // Error message
  }
}

License

MIT