Docs / SDK

SDK quickstart

Five minutes to mask before the model with a workspace install of @noeticguard/core (not on public npm yet). For product AI assistants — mobile, web, or internal tools — run masking on your server, then call OpenAI, Anthropic, Gemini, or any other LLM HTTP API. Do not put API keys in mobile binaries.

On this page+

Install

  1. Sign in at app.noeticguard.com and create a workspace.
  2. Open Dashboard → API Keys and create a publishable ng_pub_… key. Copy it immediately — it is shown once. Set NOETICGUARD_PUBLISHABLE_KEY in your server environment.
  3. Install the engine. @noeticguard/core is not on the public npm registry yet — link the monorepo package, or ask [email protected] for a workspace tarball.
bash
npm install ../path/to/packages/noeticguard-core-sdk

# or in package.json:
#   "@noeticguard/core": "file:../packages/noeticguard-core-sdk"

Mask before the LLM

One loop: fetch policy (including enabled_packs), merge pack detectors with mergeEnabledKindsWithPacks, mask locally with the same engine, call any model with tokens only, report usage. Industry packs are entitlements on this engine — not a second SDK. If quotaExceeded is true, skip masking until the billing cycle resets — the config call still returns 200.

javascript
import {
  maskPii,
  mergeEnabledKindsWithPacks,
  resolveEnabledKindsFromRules,
} from '@noeticguard/core';

// Client → your backend → maskPii → OpenAI / Claude / Gemini
// Use ng_pub_… for config + telemetry. Never ship keys to mobile/web binaries.

const config = await fetch('https://api.noeticguard.com/v1/config', {
  headers: { Authorization: `Bearer ${process.env.NOETICGUARD_PUBLISHABLE_KEY}` },
}).then((r) => r.json());

if (config.quotaExceeded) {
  throw new Error('Monthly quota exceeded — masking is paused until the cycle resets.');
}

const kinds = mergeEnabledKindsWithPacks(
  resolveEnabledKindsFromRules(config.default_rules),
  config.enabled_packs,
);

const { output, matches } = maskPii(req.body.prompt, {
  kinds,
  brandGuard: {
    customTerms: config.brand_guard_terms ?? [],
    competitors: config.brand_guard_competitors ?? [],
    allowlist: config.brand_guard_allowlist ?? [],
  },
});

const llmReply = await callYourLlm(output);

await fetch('https://api.noeticguard.com/v1/telemetry', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.NOETICGUARD_PUBLISHABLE_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    masked_count: matches.length,
    events: [{ at: Date.now(), platform: 'my-app', masked_count: matches.length }],
  }),
});

return { reply: llmReply, entitiesMasked: matches.length };

What shows up in the dashboard

The publishable key is the link: Dashboard → API Keys → ng_pub_… in your server env. Shield and the SDK share one workspace quota.

  • Developer (Free) — Home and Billing show the cycle meter (for example 47 / 1,000). Combined Shield + SDK counts; no per-event list.
  • Startup+ — Audit Logs, 7-day volume charts, and masking-report triage.
  • Entitled packs arrive on enabled_packs. Apply them with mergeEnabledKindsWithPacks or they stay off even if you paid for them.

Restore tokens

Optional. Keep a per-session vault if you want the end user to see original values after the model replies. Competitors blocked by Brand Guard stay blocked.

javascript
import { maskPii, unmaskPii } from '@noeticguard/core';

const vault = new Map();
const { output: masked } = maskPii(userText, { vault });
const llmReply = await callYourLlm(masked);
return unmaskPii(llmReply, vault);

Plans: Developer $0 → Startup $99 → Business $399 — pricing. Next: API Gateway · Deterministic tokenization · Language support · Secrets Guard