Skip to content

Node.js

Examples:

Terminal window
bun run examples/node-openrouter/index.ts
# optional: export OPENROUTER_API_KEY=...
import { createVoiceSession } from '@ottervoice/core';
import { createNodeRuntime } from '@ottervoice/runtime-node';
import { createOpenRouterAudioLLM } from '@ottervoice/provider-openrouter';
const runtime = createNodeRuntime();
const session = createVoiceSession({
mode: 'half_duplex',
runtime,
providers: {
audioLlm: createOpenRouterAudioLLM({
apiKey: process.env.OPENROUTER_API_KEY!,
model: 'openai/gpt-audio-mini',
voice: 'alloy',
}),
},
});
await session.start();

Servers can also compose createOpenRouterLLM(), ASR, and createOpenRouterTTS() behind one AudioLLMProvider; the node-openrouter example shows that boundary. Browsers and apps must use the token broker.