@shipgauge/node
v0.1.1
Published
ShipGauge Node.js SDK for LLM cost tracking and budget guardrails
Downloads
276
Maintainers
Readme
@shipgauge/node
Node.js SDK for ShipGauge — per-feature LLM cost tracking and production budget guardrails.
Metadata only: prompts and completions are never sent to ShipGauge.
Install
npm i @shipgauge/nodeQuick start
import OpenAI from "openai";
import { ShipGauge } from "@shipgauge/node";
const sg = ShipGauge.init({
apiKey: process.env.SHIPGAUGE_API_KEY!,
projectId: process.env.SHIPGAUGE_PROJECT_ID!,
baseUrl: "https://app.shipgauge.dev",
});
const openai = sg.wrapOpenAI(new OpenAI(), { defaultFeatureId: "chat" });
const res = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello" }],
});Features
wrapOpenAI()/wrapAnthropic()— auto token + cost metadatarecord()— manual event ingestconfigureBudget()— handle hard budget blocks (429) in your appconfigurePricing()— override model price table- OTel export — optional
otel: { endpoint }ininit()
Environment
| Variable | Description |
|----------|-------------|
| SHIPGAUGE_API_KEY | Ingest key (sg_ingest_...) |
| SHIPGAUGE_PROJECT_ID | Project UUID |
Links
License
MIT
