SDK

Configuration

LLM Cost Tracker requires minimal configuration. The only required value is your project API key.

API key

Your API key is found in your LLM Cost Tracker dashboard under Settings. It looks like this:

lct_live_a1b2c3d4e5f6...

Pass it as the apiKey parameter on every tracked call. We recommend storing it as an environment variable:

# .env.localLLMCOSTTRACKER_API_KEY=lct_live_your_key_here
const response = await trackedCall({client: anthropic, apiKey: process.env.LLMCOSTTRACKER_API_KEY, feature: 'search', params,})

Custom endpoint

If you are self-hosting LLM Cost Tracker, point the SDK at your own instance:

const response = await trackedCall({client: anthropic, apiKey: process.env.LLMCOSTTRACKER_API_KEY, endpoint: 'https://your-instance.com/api/events', feature: 'search', params,})

Feature tags

The feature parameter is free-form text. Use consistent names across your codebase so the dashboard grouping is meaningful:

  • Good: 'search', 'summarize', 'chat', 'classify'
  • Avoid: 'llm_call', 'test', 'misc' — too generic to be useful

Next: Dashboard guide →