dexcost
TypeScript

Installation

Install the dexcost TypeScript SDK with npm, including optional LLM provider packages.

npm install dexcost

Optional extras

LLM provider SDKs are optional — install only the ones your application uses. dexcost detects them at runtime and instruments only those it finds; missing providers are silently skipped.

ProviderPackage to install
OpenAInpm install openai
Anthropicnpm install @anthropic-ai/sdk
Vercel AInpm install ai
Google Gemininpm install @google/generative-ai
AWS Bedrocknpm install @aws-sdk/client-bedrock-runtime
Coherenpm install cohere-ai

For example, to add OpenAI and Anthropic alongside dexcost:

npm install dexcost openai @anthropic-ai/sdk

playwright is an optional peer dependency, required only if you use the browser adapter (trackBrowser):

npm install playwright

Requirements

Node.js 18 or later. The core package depends only on better-sqlite3, ajv, ajv-formats, and js-yaml — no LLM provider SDK is required for local tracking.

Verify your install

import { init, close } from 'dexcost';

const tracker = init({ environment: 'development' });
console.log('dexcost initialized:', tracker.config.storageMode);
close();

This prints dexcost initialized: local when the import resolves correctly. config and storageMode are properties of the ResolvedConfig type exported from dexcost. If the import fails, verify that your package.json includes "type": "module" or that you are using a bundler or tsx/ts-node with ESM support.

On this page