Skip to main content

Documentation Index

Fetch the complete documentation index at: https://hydroxai.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The @know-your-ai SDK is a TypeScript toolkit for monitoring, tracing, evaluating, and securing AI model interactions. It follows a modular architecture with five packages that work together or independently.

Packages

PackageDescription
@know-your-ai/nodePrimary entry point — monitoring & tracing for Node.js applications
@know-your-ai/coreCore library (used internally by node and firewall)
@know-your-ai/firewallContent safety validation via hooks
@know-your-ai/evaluateProgrammatic evaluation SDK — datasets, evaluations, test runs
@know-your-ai/cliCommand-line interface for running evaluations from the terminal
@know-your-ai/node    → @know-your-ai/core
@know-your-ai/firewall → @know-your-ai/core
@know-your-ai/cli     → @know-your-ai/evaluate

Requirements

  • Node.js >= 18
  • TypeScript (optional but recommended) — all packages ship with .d.ts type definitions
  • ESM and CommonJS are both supported

Installation

npm install @know-your-ai/node

Quick start

1. Get your DSN

Go to Settings → API Keys in the Know Your AI dashboard and copy your DSN. It looks like:
https://kya_xxx:da2-xxx@api.knowyourai.hydrox.ai/your-product-id

2. Initialize the SDK

import * as KnowYourAI from '@know-your-ai/node';

KnowYourAI.init({
  dsn: process.env.KNOW_YOUR_AI_DSN!,
  environment: 'production',
  integrations: [
    KnowYourAI.googleGenAIIntegration(),
  ],
});

3. Instrument your AI client

import { GoogleGenAI } from '@google/genai';

const genAI = new GoogleGenAI({ apiKey: process.env.GOOGLE_API_KEY! });
const client = KnowYourAI.instrumentGoogleGenAIClient(genAI);

// Use `client` as normal — all calls are automatically tracked
const response = await client.models.generateContent({
  model: 'gemini-2.0-flash',
  contents: 'Explain quantum computing in one sentence.',
});
console.log(response.text);
That’s it. Requests, tokens, latency, cost, and errors are now tracked in your monitoring dashboard.

Configuration reference

All configuration is passed to KnowYourAI.init():
OptionTypeDefaultDescription
dsnstringrequiredDSN from the dashboard
environmentstring'production'Environment identifier (e.g. 'staging', 'development')
debugbooleanfalseEnable debug logging
sampleRatenumber1.0Sampling rate (0.01.0)
batchSizenumber10Events to batch before sending
flushIntervalnumber5000Max milliseconds before flushing events
traceModebooleantrueSend complete trace trees (vs individual events)
recordInputsbooleantrueCapture user input messages
recordOutputsbooleantrueCapture AI responses
recordRequestParamsbooleantrueCapture temperature, maxTokens, etc.
enableDeduplicationbooleantrueDeduplicate payload content for traces
enableCostEstimationbooleantrueEstimate cost per request
releasestringYour application version string
integrationsIntegration[][]SDK integrations (e.g. Google GenAI, Firewall)
onCapturefunctionCallback invoked for every captured event
beforeRequestBeforeRequestHook[]Pre-request hooks
afterResponseAfterResponseHook[]Post-response hooks

What’s next

Monitoring

Track requests, tokens, cost, and latency in production.

Tracing

Visualize multi-step AI agent interactions as span trees.

Firewall

Block dangerous inputs and flag risky outputs in real time.

Evaluate

Run security evaluations programmatically.