Custom applications

TypeScript

Track any AI interaction with begin() / end()

Install

npm install voxmithai

Integrate

import * as voxmith from 'voxmithai';

voxmith.init('your-org-id');

Get your org ID from app.voxmith.com.

Track interactions

const interaction = voxmith.begin({ userId: 'u-123', agentName: 'my-agent', input: '...' });
// ... your AI call ...
interaction.end('...');

Latency is auto-calculated. For errors:

interaction.end('Error: timeout', false);

Group into conversations

const conversationId = crypto.randomUUID();

const t1 = voxmith.begin({ userId: 'u-123', agentName: 'my-agent', input: 'Hello', conversationId });
t1.end('Hi!');

const t2 = voxmith.begin({ userId: 'u-123', agentName: 'my-agent', input: 'Follow-up', conversationId });
t2.end('Sure!');

Identify users

voxmith.identify('u-123', { plan: 'pro', role: 'admin' });

Custom properties

const interaction = voxmith.begin({ userId: 'u-123', agentName: 'my-agent', input: '...' });
interaction.setProperties({ model: 'gpt-4', tokens: '150' });
interaction.end('...');

Retrieve an interaction by ID

Useful when you need to complete an interaction from a different function or callback:

voxmith.begin({ userId: 'u-123', agentName: 'my-agent', input: '...', interactionId: 'req-1' });

// elsewhere...
const interaction = voxmith.getInteraction('req-1');
interaction?.end('...');

Configuration

voxmith.init('your-org-id', { endpoint: 'https://api.voxmith.com', debug: true });
Option Type Default Description
endpoint string https://api.voxmith.com API endpoint
debug boolean false Enable debug logging

Cleanup

await voxmith.shutdown(); // flushes and cleans up

What appears in Voxmith

  • Conversations grouped by conversationId.
  • User-level analytics grouped by userId.
  • Events for every tracked interaction.
  • Unsuccessful interactions remain visible in Events with success=false.

Verify

Run one begin() / end() interaction, then open app.voxmith.com. Check Events first, then Conversations.

Troubleshooting

  • Confirm voxmith.init('your-org-id') runs before tracking.
  • Await voxmith.shutdown() before short-lived scripts exit.
  • Confirm the endpoint is https://api.voxmith.com unless you intentionally use another endpoint.

Next steps

  • Conversations: review how TypeScript interactions are grouped.
  • Events: inspect the exact records the SDK sent.
  • Intents: organize production conversations by what users wanted.