@voniai/nodejs
v0.1.5
Published
Programmable AI Infrastructure Node.js SDK
Maintainers
Readme
Voni AI Node.js SDK
The official Node.js SDK for the Voniai programmable AI infrastructure.
Installation
npm install @voniai/nodejsQuick Start (Headless Mode)
const { Voni } = require('@voniai/nodejs');
// Initialize the client (automatically loads VONI_API_KEY from env)
const voni = new Voni({});
async function main() {
// Send a message to your co-pilot
const response = await voni.chat.sendMessage('your_project_id', {
message: 'How do I integrate Voni?',
sessionId: 'user_123'
});
console.log(`AI Response: ${response.message}`);
}
main();Features
- TypeScript Support: Full type definitions included.
- Robust Security: Automatic HMAC-SHA256 request signing.
- Environment Support: Automatically loads
VONI_API_KEYfrom environment variables. - Headless Chat: Build custom AI interfaces.
- Management API: Control projects and webhooks via code.
Authentication
The SDK handles HMAC signature generation automatically. You can provide your API Key during initialization or set the VONI_API_KEY environment variable.
// Option 1: Load from environment (Recommended)
const voni = new Voni({});
// Option 2: Explicitly provide key
const voni = new Voni({ apiKey: '...' });Error Handling
const { VoniAuthError, VoniApiError } = require('@voniai/nodejs');
try {
const projects = await voni.projects.list();
} catch (error) {
if (error instanceof VoniAuthError) {
console.error('Authentication failed');
} else if (error instanceof VoniApiError) {
console.error(`API Error: ${error.statusCode}`);
}
}License
MIT
