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

sct-client

v2.2.0

Published

Official Node.js/TypeScript SDK for the SCT (Secure Compact Tokenization) API — pseudonymize PII, stream encrypted data, and optimize LLM tokens.

Readme

@sct/client

Official Node.js/TypeScript SDK for the SCT (Secure Compact Tokenization) API — pseudonymize PII, restore pseudonymized data, detect PII in free text, and optimize LLM token usage, all through one typed client.

Requirements

  • Node.js >=18 (uses the global fetch API)
  • An SCT API key (get one here)

Installation

npm install @sct/client

Quick Start

import { SCTClient } from '@sct/client';

const client = new SCTClient({
  apiKey: process.env.SCT_API_KEY!,
  // baseUrl defaults to 'https://sct.simosphereai.com/api/v1'
});

const result = await client.pseudonymize(
  JSON.stringify({
    name: 'Max Mustermann',
    email: '[email protected]',
    iban: 'DE89370400440532013000',
  }),
  { format: 'json', autoDetectPii: true },
);

console.log(result.pseudonymized_data);
console.log(result.encryption_key);

Configuration

const client = new SCTClient({
  apiKey: 'sct_your_api_key',
  baseUrl: 'https://sct.simosphereai.com/api/v1', // optional
  timeoutMs: 10_000, // optional, aborts the request after this duration
});

API

pseudonymize(data, options?)

Replace PII in structured or free-text data with reversible pseudonyms.

const result = await client.pseudonymize(csvData, {
  format: 'csv',
  method: 'aes-256-gcm', // 'aes-256-gcm' | 'fpe-ff1'
  fields: ['name', 'email'], // only pseudonymize these fields
  // excludeFields: ['amount', 'currency'], // ...or exclude these instead
  autoDetectPii: true, // NLP-based PII detection
});

// result.pseudonymized_data
// result.encryption_key
// result.fields_encrypted
// result.detected_entities
// result.record_count

dePseudonymize(data, encryptionKey, options?)

Restore data that was previously pseudonymized, using the key returned by pseudonymize.

const restored = await client.dePseudonymize(result.pseudonymized_data, result.encryption_key, {
  format: 'json',
});

console.log(restored.original_data);

detectPii(text)

Scan free text for PII entities (names, emails, phone numbers, IBANs, addresses, IDs, IP addresses) without pseudonymizing it.

const detection = await client.detectPii('Contact Max Mustermann at [email protected].');

for (const entity of detection.entities) {
  console.log(`${entity.entity_type}: ${entity.value} (confidence ${entity.confidence})`);
}

optimizeTokens(text, targetModel?)

Reduce LLM token consumption for a piece of text while preserving its meaning.

const optimized = await client.optimizeTokens(
  'Your verbose text content that could be optimized...',
  'gpt-4o', // any model id the service supports; free string
);

console.log(optimized.optimized_text);
console.log(`${optimized.reduction_percent}% smaller (${optimized.tokens_saved} tokens saved)`);

compressOutput(text, options?)

Compress bulky text — tool/observation output, logs, structured test/CI output, or prose — so it costs fewer LLM tokens while never being larger (in tokens) than the raw input. The service picks the best layer automatically: a format-aware structured parser (pytest, jest, eslint, git-diff, …), the noise-strip engine, or the prose optimizer — guided by the optional format hint or by sniffing the content. The result is tiktoken-verified, so savings_pct >= 0 always.

const compressed = await client.compressOutput(rawPytestOutput, {
  format: 'pytest', // optional hint; omit to let the service sniff the format
  model: 'gpt-4o', // optional; the model the token savings are computed against
  verbosity: 'compact', // 'compact' | 'verbose' | 'ultra'
});

console.log(compressed.compressed);
console.log(`${compressed.savings_pct}% smaller (${compressed.tokens_saved} tokens saved)`);
console.log(compressed.tier); // 'format-aware' | 'prose' | 'raw' | 'error-fallback'

countTokens(text, model?)

Count tokens for a text/model pair without modifying the content.

const { token_count } = await client.countTokens('Your text content here...', 'gpt-4o');

Error Handling

All methods reject with an SCTError on non-2xx responses, network failures, or timeouts.

import { SCTClient, SCTError } from '@sct/client';

try {
  await client.pseudonymize(invalidPayload);
} catch (error) {
  if (error instanceof SCTError) {
    console.error(`SCT API error (${error.statusCode}): ${error.message}`);
    // error.statusCode is 0 for network/timeout failures
  } else {
    throw error;
  }
}

Full Example: PII-Safe LLM Round-Trip

import { SCTClient } from '@sct/client';

const client = new SCTClient({ apiKey: process.env.SCT_API_KEY! });

const prompt = 'Please draft a follow-up email to Max Mustermann ([email protected]).';

// 1. Pseudonymize before sending to an LLM provider
const { pseudonymized_data, encryption_key } = await client.pseudonymize(prompt, {
  format: 'text',
  autoDetectPii: true,
});

// 2. ... send pseudonymized_data to your LLM provider, get llmResponse back ...

// 3. Restore the original PII in the LLM's response
const { original_data } = await client.dePseudonymize(llmResponse, encryption_key, {
  format: 'text',
});

console.log(original_data);

TypeScript

This package ships its own type declarations — no @types package needed. All response and option types are exported from the package root:

import type {
  SCTClientOptions,
  PseudonymizeOptions,
  PseudonymizeResult,
  DePseudonymizeOptions,
  DePseudonymizeResult,
  DetectPIIResult,
  DetectedEntity,
  OptimizeResult,
  TokenCountResult,
  CompressOutputOptions,
  CompressResult,
  CompressTier,
  CompressVerbosity,
  DataFormat,
  EncryptionMethod,
  TokenizerModel,
} from '@sct/client';

License

UNLICENSED — SIMO GmbH internal / commercial use only.