Developers
Code Examples
Practical examples to get you started quickly.
Track Prompt
vx.track('prompt', {
text: userInput.slice(0, 256),
sessionId: hash(session),
})Track Response
vx.track('response', {
tokens: responseTokens,
latencyMs: modelLatency,
})Optional Monetization
vx.track('impression', { slot: 'suggestion.inline' })
vx.track('click', { slot: 'suggestion.inline', target: 'affiliate:xyz' })
vx.track('conversion', { orderId, value: 49.0 })Fetching Scores
const clusters = await vx.clusters.list({ limit: 10 })
const pricing = await vx.scores.get({ clusterId: clusters[0].id, placement: 'suggestion.inline' })