npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@keysense/sdk

v0.2.0

Published

Official JavaScript/TypeScript SDK for the KeySense AI keyboard layout detection API

Readme

@keysense/sdk

Official JavaScript / TypeScript SDK for the KeySense AI keyboard layout detection API.

npm License

Typed руддщ when you meant hello? One call fixes it.


Install

npm install @keysense/sdk

Quick start

import { KeySenseClient } from '@keysense/sdk';

const ks = new KeySenseClient();

const result = await ks.detect('руддщ цщкдв');
console.log(result.decoded);       // 'hello world'
console.log(result.layout);        // 'ru-RU'
console.log(result.confidence);    // 0.97
console.log(result.word_coverage); // 1.0

API

new KeySenseClient(config?)

const ks = new KeySenseClient({
  apiUrl:       'https://keysense-ai.keysense-ai.workers.dev', // default
  timeout:      10_000,      // ms, default 10s
  maxRetries:   2,           // retries on 5xx / network errors
  defaultUseAI: false,       // force Claude AI on every request
  fetch:        customFetch, // optional custom fetch (e.g. node-fetch)
});

ks.detect(text, options?)

Detect the keyboard layout and return the corrected text.

const result = await ks.detect('руддщ', {
  useAI:  true,              // force Claude AI verification
  signal: abortCtrl.signal,  // optional AbortSignal
});

Returns DetectResult:

{
  decoded:    'hello',       // corrected text
  layout:     'ru-RU',       // detected source layout
  confidence: 0.97,          // 0–1
  ai_used:    false,         // was Claude invoked?
  processing_ms: 1,          // rule-based processing time (ms)
  word_coverage: 1.0,        // fraction of words matched against dictionary (Layer 8)
  keyboard_profile: {        // detected physical keyboard type (Layer 7)
    profile:    'ansi-104',
    confidence: 0.8,
  },
  candidates: [              // top alternative decodings (up to 3)
    { layout: 'ru-RU', text: 'hello', confidence: 0.97, word_coverage: 1.0 },
  ],
  original:  'руддщ',        // original input (added by SDK)
  unchanged: false,          // true if no correction was applied
}

ks.health()

Check the worker status and number of loaded layouts.

const h = await ks.health();
// { status: 'ok', layouts_loaded: 70, version: '0.2.0', timestamp: '...' }

ks.layouts()

List all 70 supported layouts with writing direction and priority.

const { count, layouts } = await ks.layouts();
// count: 70
// layouts: [{ id: 'ru-RU', name: 'Russian', direction: 'ltr', priority: 9 }, ...]

Error handling

All errors thrown by the SDK are instances of KeySenseError:

import { KeySenseClient, KeySenseError } from '@keysense/sdk';

try {
  const result = await ks.detect(text);
} catch (err) {
  if (err instanceof KeySenseError) {
    console.error(err.code);      // 'NETWORK_ERROR' | 'TIMEOUT' | 'RATE_LIMITED'
                                  // | 'INVALID_INPUT' | 'SERVER_ERROR' | 'ABORTED'
    console.error(err.message);
    console.error(err.status);    // HTTP status if applicable
    console.error(err.retryable); // true if safe to retry
  }
}

Supported layouts (70)

Russian, Ukrainian, Belarusian, Arabic, Hebrew, Persian, German, French, Spanish, Polish, Turkish, Greek, Armenian, Georgian, Japanese, Korean, Chinese (Traditional), Thai, Vietnamese, and many more. Full list at GET /layouts.


Use with Node.js < 18

Node.js 18+ has native fetch. For older versions, pass a custom fetch:

import fetch from 'node-fetch';
import { KeySenseClient } from '@keysense/sdk';

const ks = new KeySenseClient({ fetch: fetch as typeof globalThis.fetch });

License

MIT © 2026 Aras Hatemi