Node.js SDK and CLI
The official TypeScript client for Node 18+, with zero runtime dependencies, and the voicemint command line.
Node.js 18+ (or any runtime with fetch), TypeScript types included, zero runtime dependencies. Source: github.com/alphaaiservice/voicemint-node.
Install#
Not on npm yet. Install from GitHub:
npm install github:alphaaiservice/voicemint-node
# a specific release
npm install github:alphaaiservice/voicemint-node#v0.3.0Once published: npm install @voicemint/sdk.
Configure#
import { VoiceMint } from '@voicemint/sdk';
const client = new VoiceMint(); // reads VOICEMINT_API_KEY
const other = new VoiceMint({ apiKey: 'vm_sk_live_...', timeoutMs: 60_000, maxRetries: 2 });Five lines#
import { VoiceMint } from '@voicemint/sdk';
const client = new VoiceMint();
const agent = await client.agents.create({ name: 'Support bot', instructions: 'Answer briefly.', status: 'active' });
console.log((await client.agents.chat(agent.id, 'What are your opening hours?')).reply);Method names are the camelCase of the Python ones (textToSpeech.create, liveSessions.create, jobs.wait), and response objects keep the API's field names. Anything without a typed method: client.request(method, path, { json, params, files, form, headers }).
Command line#
Installing the package also installs voicemint (it reads VOICEMINT_API_KEY):
npx voicemint agents list
npx voicemint tts "Hello from VoiceMint" --voice alloy --out hello.mp3
npx voicemint stt meeting.wav --language en
npx voicemint image generate "a fox in a misty forest" --out fox.png
npx voicemint calls place --agent AGENT_ID --to +919876543210 --var name=Asha
npx voicemint --helpPlacing a call and starting a campaign ask for confirmation first (--yes skips it); --json prints raw responses.
Errors and retries#
APIError subclasses per status, RateLimitError.retryAfter in seconds; 429 and 5xx are retried automatically. See Errors.