Open-source AI observability. Every token, every dollar, every context diff — visible in real time.
MIT licensed · self-hostable · TypeScript
The Problem
Every step in a multi-step agent re-sends the entire conversation history. By step 10, you're paying 39× what you paid on step 1. No alert fires. No log appears.
How It Works
npm install @prompt-tracer/sdkOne package. Works with OpenAI, Anthropic, and any OpenAI-compatible API. Zero configuration required.
const ai = wrapOpenAI(openai, tracer);A JavaScript Proxy intercepts every call. Tokens, cost, latency — captured automatically on the microtask queue.
Every session, every step, full context diff. Cost anomalies flagged the moment growth exceeds your baseline.
Integration
JavaScript Proxy objects intercept calls — no monkey-patching. Telemetry fires on the microtask queue after your code continues. Your agent never slows down.
import OpenAI from "openai";import { Tracer, wrapOpenAI } from "@prompt-tracer/sdk";const tracer = new Tracer({ ingestUrl: "https://app.com/api/ingest", sessionId: crypto.randomUUID(),});const ai = wrapOpenAI(openai, tracer);// Every call is now traced. Nothing else changes.const res = await ai.chat.completions.create({ model: "gpt-4o", messages,});Features
Native JavaScript Proxy wraps your LLM client. No monkey-patching. Original types fully preserved. Streaming works identically.
See exactly which messages were added or removed at every step. Stored as diffs — 85% storage reduction.
Automatic classification of normal, spike, and error steps. Flagged the moment context growth exceeds your session baseline.
Re-fire any captured prompt against any model. A/B compare outputs. Optimize without re-running your entire agent.
Free. Open source. No credit card required.
MIT licensed · self-hostable · your data never leaves your infrastructure