Zero-dependency observability for any JavaScript runtime.
Ships logs, errors, and W3C-propagated traces from Cloudflare Workers, Vercel, Node.js, or the browser to FlareLog or any OTLP backend. One SDK, every platform.
Complete documentation with installation guides, API reference, framework integrations, and platform-specific setup.
npm install @flarelog/sdkimport { flarelog } from "@flarelog/sdk";
const logger = flarelog({});
logger.info("Hello!"); // → console (zero config)Add your API key to ship to the dashboard:
FLARELOG_API_KEY=fl_your_keyZero-config instrumentation for OpenAI, Anthropic, Cloudflare Workers AI, Vercel AI SDK, and any OpenAI-compatible gateway. Captures tokens, latency, cost in USD, tool calls, and errors — viewable in the AI observability dashboard.
import { flarelog } from "@flarelog/sdk";
const logger = flarelog({
apiKey: process.env.FLARELOG_API_KEY,
ai: true, // one flag — every fetch() to OpenAI/Anthropic/etc. is captured
});Need fine-grained control? Pass a config object instead:
const logger = flarelog({
apiKey: process.env.FLARELOG_API_KEY,
ai: {
captureSamples: true,
priceOverrides: { "gpt-4o": { input: 2.5, output: 10 } },
},
});You can also use flarelogAI directly (re-exported from the main package):
import { flarelog, flarelogAI } from "@flarelog/sdk";
const logger = flarelog({ apiKey: process.env.FLARELOG_API_KEY });
const handle = flarelogAI(logger);
// handle.dispose() to remove instrumentation laterStreaming OpenAI calls capture tokens when you enable usage reporting (Anthropic and Workers AI capture usage automatically):
await fetch("https://api.openai.com/v1/chat/completions", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.OPENAI_API_KEY}` },
body: JSON.stringify({
model: "gpt-4o",
stream: true,
stream_options: { include_usage: true }, // ← required for streaming token capture
messages: [{ role: "user", content: "Hello" }],
}),
});See the AI Observability guide for the full docs.
- Zero dependencies — nothing to audit, nothing to conflict
- Any JavaScript runtime — Cloudflare Workers, Vercel, Node.js, browsers
- W3C trace propagation — distributed tracing across services
- Auto-detection — environment, release, platform
- OTLP-compatible — ships to Grafana, Honeycomb, Datadog, or any OTLP backend
- AI inference observability — zero-config token, cost, and latency tracking for OpenAI, Anthropic, Workers AI, Vercel AI SDK, and any OpenAI-compatible gateway
MIT