Token management, API key security, data minimization, webhook optimization, and fine-tuning tips
Following these best practices will help you optimize your ViriSIM integration, reduce costs, improve security, and get the most value from AI observability and compliance.
Tokens are consumed with each audit submission (max 2,000 tokens per request). Efficient token usage reduces costs and ensures continuous operation.
// ✅ DO: Use environment variables
const apiKey = process.env.VIRIDEED_API_KEY;
// ❌ DON'T: Hardcode keys in source code
// const apiKey = "sk-viri-abc123..."; // NEVER DO THIS
Sending only necessary data reduces token consumption and improves processing speed.
format to "text" or "json" accurately
Tokens above the limit of 2k. Incorrect requests could incure 10 tokens per request.
submission_id
// ✅ Best practice: Async audit submission
async function submitAudit(userInput, aiOutput) {
const response = await fetch('https://https://analyzecompliance-vrbinbrbkq-uc.a.run.app', {
method: 'POST',
headers: { 'X-API-Key': apiKey, 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
const result = await response.json();
const submissionId = result.submission_id;
// Store ID for later reference — don't wait for audit completion
await saveSubmissionId(submissionId);
// Return immediately — audit runs asynchronously
return { submissionId, status: 'processing' };
}
ViriSIM provides 1 GB of free storage for audit logs. Proactive management prevents service interruption.
// ✅ Secure integration example
const apiKey = process.env.VIRIDEED_API_KEY;
const headers = new Headers({
'X-API-Key': apiKey,
'Content-Type': 'application/json'
});
const response = await fetch('https://https://analyzecompliance-vrbinbrbkq-uc.a.run.app/', {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
});
Go to ViriSIM, get your API key and run your first compliance audit in under 30 minutes.
Go to ViriSIM