Skip to content

Mocks (no API key)

Example: examples/node-cli

Mocks share the same event contract as live providers, so the UI is written once.

import {
createMockASR,
createMockLLM,
createMockRuntime,
createMockTTS,
createVoiceSession,
} from '@ottervoice/core';
const runtime = createMockRuntime();
const session = createVoiceSession({
mode: 'half_duplex',
runtime,
providers: {
asr: createMockASR({ transcripts: ['Hello Otter'] }),
llm: createMockLLM({ reply: () => 'Hello! How can I help?' }),
tts: createMockTTS(),
},
});
session.on('asr_partial', ({ text }) => console.log('user:', text));
session.on('assistant_text_delta', ({ text }) => console.log('assistant:', text));
await session.start();
runtime.audioInput.emitChunk({
data: new ArrayBuffer(8),
timestamp: Date.now(),
durationMs: 800,
});
Terminal window
bun run demo
# same as bun run examples/node-cli/index.ts

Production only replaces runtime and providers. Session wiring stays the same.