Developers
Quick Start Guide
Instrument prompt analytics in minutes. No architectural changes required.
1
Install SDK
Add the analytics SDK to your project.
2
Initialize
Provide your API key and minimal config.
3
Send Events
Track prompt/response and optional monetization events.
Prerequisites
- Node.js 18+ or a modern runtime
- Public key for the SDK (`VEXRAIL_KEY`)
- Ability to send client or server events
Environment
# .env.local VEXRAIL_KEY=your_public_key_here
Install
npm install @vexrail/sdk
Initialize
import { VexRail } from '@vexrail/sdk' const vx = new VexRail({ apiKey: process.env.VEXRAIL_KEY })
Track Events
vx.track('prompt', { text: userInput.slice(0, 256), labels: ['study-help', 'math'], sessionId: hash(session), }) vx.track('response', { tokens: responseTokens, latencyMs: modelLatency, summary: respSummary?.slice(0, 256), })
Troubleshooting
- Verify `VEXRAIL_KEY` is set and accessible in your runtime.
- Ensure events are de-identified (no PII) and prompts are truncated.
- Check network logs for any blocked requests or CSP issues.