JavaScript SDK

Installation

The llmonitor module is lightweight and works with Node JS, Deno, Cloudflare Workers, Vercel Edge functions and even Bun.

Node

npm install llmonitor

Deno

import LLMonitor from "https://esm.sh/llmonitor"

Setup

Start by importing the llmonitor module:

import monitor from "LLMonitor"

Then initialize the module with your unique app ID.

Option 1: Automatic using environment variables (recommended):

LLMONITOR_APP_ID="YOUR APP ID"

Option 2: Manually using the .init method:

// Initialize the LLMonitor module with your unique app ID
monitor.init({
appId: "YOUR APP ID",
})

The .init method accepts the following arguments:

{
"appId": string, // Your unique app ID obtained from the dashboard
"apiUrl": string, // Optional: Use a custom endpoint if you're self-hosting (you can also set LLMONITOR_API_URL)
"verbose": boolean // Optional: Enable verbose logging for debugging
}

Questions? We're here to help.