@vocalroute-ai/sdk
v0.2.11
Published
Voice navigation and AI assistance toolkit for Next.js applications
Maintainers
Readme
@vocalroute-ai/sdk
VocalRoute SDK is a powerful toolkit for adding voice navigation and AI assistance to your React/Next.js applications.
Installation
npm install @vocalroute-ai/sdk
# or
yarn add @vocalroute-ai/sdk
# or
pnpm add @vocalroute-ai/sdkCLI Usage
Scan your project routes and generate an intent registry:
npx vocalroute scanAdvanced Scanning
For complex apps with many similar routes or internationalization, use high-quality scanning:
# Use AI to generate diverse and natural intents (requires OPENAI_API_KEY)
npx vocalroute scan --ai
# Skip structural segments (like [locale]) to group logical pages
npx vocalroute scan --skip localeThe CLI will:
- Scan your Next.js
apporpagesdirectory. - Identify all available routes and parameters.
- Generate navigation intents (e.g., "go to my ads", "open chat").
- Create a
vocalroute/directory in your project containingregistry.jsonandregistry.ts.
Note: Run this command whenever you add or modify routes.
Optional Script
Add this to your package.json for easier access:
{
"scripts": {
"vocalroute:scan": "vocalroute scan"
}
}Setup
1. Root Layout
Import the CSS and wrap your application with the VocalRouteProvider.
// app/layout.tsx
import "@vocalroute-ai/sdk/vocalroute.css";
import { VocalRouteProvider } from "@vocalroute-ai/sdk";
import { staticRegistry } from "../vocalroute/registry"; // Generated by CLI
export default function RootLayout({ children }) {
return (
<html>
<body>
<VocalRouteProvider routes={staticRegistry} showButton={true}>
{children}
</VocalRouteProvider>
</body>
</html>
);
}Usage
VocalRouteProvider Props
| Prop | Type | Default | Description |
| :-------------- | :-------------- | :------ | :------------------------------------------ |
| routes | RouteRegistry | [] | The generated route registry |
| showButton | boolean | false | Whether to show the built-in trigger button |
| showOverlay | boolean | true | Whether to show the built-in voice overlay |
| buttonConfig | Object | - | Customization for the trigger button |
| overlayConfig | Object | - | Customization for the voice overlay |
| aiConfig | Object | - | Configuration for AI model and fallbacks |
AI Configuration (aiConfig)
Customize the AI engine to use specific models or providers.
| Property | Type | Default | Description |
| :------------------- | :-------- | :------------- | :-------------------------------------------------------------------------- |
| enabled | boolean | false | Enable cloud-based AI intent resolution (requires OpenAI Key) |
| openaiApiKey | string | - | Your OpenAI API Key (can also be set via OPENAI_API_KEY env) |
| baseURL | string | - | Custom API base URL (e.g. for Groq, Local LLMs, or Proxy) |
| intentModel | string | gpt-4o-mini | The model used for mapping speech to route intents |
| transcriptModel | string | - | Optional model for phonetic transcript correction before intent resolution |
| strictMode | boolean | false | If true, disables internal fallbacks if your custom models fail |
| fallbackToLocal | boolean | true | If true, falls back to browser-only matching if AI resolution fails |
Using the Hook
For custom implementations, use the useVocalRoute hook:
import { useVocalRoute } from "@vocalroute-ai/sdk";
const CustomTrigger = () => {
const { startListening, isListening } = useVocalRoute();
return (
<button onClick={startListening}>
{isListening ? "Listening..." : "Voice Search"}
</button>
);
};Features
- Local Intent Resolution: Works entirely in the browser using the generated route registry.
- Voice Overlay: Built-in, customizable UI for voice interaction.
- Automatic Route Discovery: Scans your Next.js project to generate navigation intents.
- TTS (Text-to-Speech): Conversational replies for navigation and status.
Feedback
We are actively shaping VocalRoute — reach out! Your feedback helps us determine what to build next.
- GitHub Discussions: Join our community to share ideas, ask questions, or report issues.
License
MIT
