Now available on npm

Superfast Semantic
Routing for Node.js

Route user queries to the right handlers using vector embeddings. 90x faster than LLMs, 89% accurate, and 23x cheaper.

90x
Speed
faster than LLM
23x
Cost
cheaper than LLM
89%
Accuracy
with OpenAI

Simple to use, powerful in action

Get started with just a few lines of code

example.ts
import { Router, Route, OpenAIEncoder } from 'semantic-node-router';

const encoder = new OpenAIEncoder({
  apiKey: process.env.OPENAI_API_KEY
});

const routes = [
  new Route({
    name: 'technical_support',
    utterances: ['my app crashed', 'error message', 'bug']
  }),
  new Route({
    name: 'billing',
    utterances: ['subscription', 'payment', 'invoice']
  })
];

const router = new Router({ routes, encoder });
await router.initialize();

const result = await router.route('The app is not working');
// { route: 'technical_support', score: 0.87 }

Everything you need for semantic routing

Built with performance, developer experience, and production readiness in mind

Blazing Fast

~5ms with local embeddings or ~320ms with OpenAI. Up to 90x faster than LLM-based routing.

Cost Effective

23x cheaper than LLM routing at $0.002 per 1,000 requests, or completely free with local models.

High Accuracy

89% accuracy on semantic routing decisions. Handles synonyms, variations, and typos effortlessly.

Type Safe

Full TypeScript support with comprehensive type definitions for a great developer experience.

Offline Ready

Use Transformers.js for completely offline, local semantic routing with zero API calls or costs.

Dynamic Routes

Add, remove, or update routes at runtime. Perfect for evolving applications and A/B testing.

Built for real-world applications

From customer support to conversational AI, semantic routing powers intelligent applications

🎧

Customer Support

Route support tickets to the right department based on semantic understanding of the issue.

🤖

Chatbot Intents

Classify user intents in conversational AI without training complex NLU models.

📚

Content Categorization

Automatically categorize articles, posts, and messages by semantic similarity.

⌨️

Command Routing

Route natural language commands to appropriate handlers in CLI tools and apps.

Ready to get started?

Install with your favorite package manager and start routing in minutes

bash
npm install semantic-node-router

Join the semantic routing revolution

Fast, accurate, and cost-effective. Everything you need to build intelligent routing into your applications.