A lightweight, non-blocking telemetry client SDK with transparent wrappers for OpenAI & Anthropic. Track P95/P99 latency spikes, 429 rate limit cascades, token expenditure, and structured JSON schema conformance failures in real-time.
Install via npm or stream telemetry directly over HTTP. Our client SDK wraps OpenAI, Google Gemini, and Anthropic seamlessly.
import OpenAI from 'openai';
import { GoogleGenerativeAI } from '@google/generative-ai';
import { initMonitor } from 'llm-watchdog';
// 1. Initialize client watchdog
const monitor = initMonitor({ apiKey: process.env.WATCHDOG_API_KEY });
// 2. Transparently wrap any client SDK (1 line of code)
const openai = monitor.wrapOpenAI(new OpenAI());
const genAI = monitor.wrapGemini(new GoogleGenerativeAI(process.env.GEMINI_API_KEY!));
// 3. Make completions as usual — latency, tokens & schema diffs are buffered non-blocking!
const completion = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Extract invoice JSON' }],
response_format: { type: 'json_object' },
});Detect when an upstream model is hanging or slowing down before your users complain. Graph P50 vs P95 percentiles across time intervals.
Catch unexpected token or request per minute rate limit floods instantly and route traffic to fallbacks before your queues backup.
When an LLM returns a 200 OK but hallucinates invalid JSON types or misses required properties, Watchdog tags the trace and shows the error diff.
Telemetry is buffered in memory and flushed via keepalive fetch requests in the background. Your application code never experiences added blocking latency.
Compare OpenAI GPT-4o against Anthropic Claude 3.5 Sonnet and Groq Llama 3 side-by-side on real production traffic with exact token pricing.
Configurable threshold policies post rich incident blocks to your engineering Slack channels the moment error thresholds are breached.
For personal projects and local development.
Have questions about custom model integrations, enterprise volume, or architecture? Send a message and we will respond directly.