Registry / database / llmmeter-postgres

llmmeter-postgres

JSON →
library0.1.1jsnpmunverified

Postgres sink and read API for llmmeter, designed for self-hosted, multi-instance production deployments. Current stable version is 0.1.1. The package auto-creates the database schema on first write and supports batching, configurable flush intervals, and skip of schema initialization. It ships TypeScript types and requires Node >=18.18.0. Compared to the default in-memory store, it provides persistence, scalability, and query capabilities for production use.

npm install llmmeter-postgres
INSTALL
IMPORT
SIG · LLMMETER-POSTGRES
L
llmmeter-postgres
databasejavascriptv0.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

postgresSink
import { postgresSink } from "llmmeter-postgres"
const postgresSink = require("llmmeter-postgres").postgresSink
ESM-only package; CommonJS require not supported.
postgresSink
import { postgresSink } from "llmmeter/postgres"
import postgresSink from "llmmeter/postgres"
Secondary entry point via llmmeter/postgres subpath.
type PostgresConfig
import type { PostgresConfig } from "llmmeter-postgres"
import { PostgresConfig } from "llmmeter-postgres"
PostgresConfig is a TypeScript type, not a runtime value.

Creates a Postgres sink with connection string, batch size, and flush interval for production llmmeter deployments.

import { postgresSink } from "llmmeter-postgres"; const sink = postgresSink({ connectionString: process.env.DATABASE_URL ?? 'postgresql://user:pass@localhost:5432/llmmeter', batchSize: 100, flushIntervalMs: 1000, }); // Use sink with llmmeter collector, then query via dashboard
Debug
Known issues
gotchaDo not use CommonJS require; package is ESM-only and will fail with require().
fix
Use import syntax instead of require().
affects: >=0.1.0
gotchaSchema auto-creation may fail if the database user lacks CREATE TABLE permissions.
fix
Set skipSchemaInit: true in config and run migrations manually.
affects: >=0.1.0
gotchaThe package is pre-1.0 (v0.1.1); APIs may change without major version bump.
fix
Pin dependency and test upgrades thoroughly.
affects: >=0.1.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module not supported
Using CommonJS require() on an ESM-only module.
fix
Switch to import syntax or use dynamic import() if in CJS context.
error: permission denied for schema public
Database user lacks privileges to create tables for auto-schema.
fix
Grant CREATE privilege or set skipSchemaInit: true and run manual migrations.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
llmmeter-postgres — npm install llmmeter-postgres · libregistry