⚡ Zero-Proxy AI Observability · OpenAI · Anthropic · Workers AI · 80+ Models Priced ⚡

01AI Observability

Your AI costs are bleeding.
Your dashboard shows green.

One npm install. Auto-captures every AI call — tokens, cost, latency, errors. No proxy, no wrapper per request, <1ms overhead. See it all right next to your application logs.

$npm install @flarelog/sdk
AI CALL INSPECTORLIVE INFERENCE

Total Cost

$11.67

Calls

847

Avg Latency

3.4s

200
gpt-4o-miniOpenAI
$0.000153266 tok · 4.9s
200
claude-3-5-sonnetAnthropic
$0.0023401,847 tok · 3.2s
200
llama-3.3-70bWorkers AI
$0.000421920 tok · 1.8s
429
gpt-4oOpenAI
$0.0087503,201 tok · 12.1s
// CALL DETAILS: gpt-4o-minitr_ai_88a91
Prompt Tokens180
Completion Tokens86
Computed Cost$0.000153

<1ms

overhead per call

80+

models priced locally

0

proxy hops required

1 line

to instrument everything

02The AI observability problem

Every team adding LLM calls
hits the same wall

No idea what you're spending

Cloudflare's cost metrics lag 15-60 minutes. OpenAI's usage dashboard refreshes daily. By the time you notice a $500 spike from a runaway loop, it's already billed.

No idea what's slow

A 30-second chat completion feels like "the model is thinking" — but is it TTFB (cold start), generation speed, or network? Without per-call latency breakdowns, you can't tell.

No idea what's failing

Rate limits, context-length errors, fallback chains, retry storms — these get logged as generic 500s, if they're logged at all. And they're never correlated with the app errors that triggered them.

No idea what your agents are doing

Tool calls happen inside a streaming response, the SDK doesn't expose them, and your dashboard shows a single black box. You're flying blind on the most expensive code path in your app.
03FlareLog vs Helicone / Langfuse

Same visibility.
None of the proxy tax.

Capability
FlareLog logoFlareLog
Helicone / Langfuse
Setup
One line — auto-patches global fetch()
Change base URL or wrap each call
Proxy required
No — intercepts locally, zero extra hops
Yes — routes traffic through their servers
Overhead
<1ms local interception
Proxy roundtrip per request
Workers AI
Native binding wrapper
Not supported
App logs
Same view — AI calls next to app errors
Separate product / dashboard
Cost engine
Local price table, 80+ models, instant
Server-side lookup
Self-host
Runs on Cloudflare edge
Docker compose or managed only
Vercel AI SDK
Built-in withFlarelog() wrapper
Requires custom middleware
0430-second setup

Two lines.
Full visibility.

1

Initialize the logger + enable AI instrumentation

The flarelogAI() call patches global fetch(). From this point, every request to an AI provider is intercepted.

src/index.ts
import { flarelog } from "@flarelog/sdk";
import { flarelogAI } from "@flarelog/sdk/ai";

const logger = flarelog({
  apiKey: process.env.FLARELOG_API_KEY!,
});

// One call. Every fetch() to OpenAI, Anthropic,
// Workers AI, and any OpenAI-compatible gateway
// is now captured — tokens, cost, latency, errors.
const ai = flarelogAI(logger);
2

Use your AI SDK as usual

Nothing changes in your application code. OpenAI, Anthropic, Workers AI, Vercel AI SDK — all captured automatically. No base URL changes, no per-call wrappers.

your-app.ts
// Just call your AI provider as usual.
// FlareLog captures it automatically.

// OpenAI
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-mini",
    messages: [{ role: "user", content: "Hello" }],
  }),
});

// Anthropic
await fetch("https://api.anthropic.com/v1/messages", {
  method: "POST",
  headers: {
    "x-api-key": process.env.ANTHROPIC_API_KEY!,
    "anthropic-version": "2023-06-01",
  },
  body: JSON.stringify({
    model: "claude-3-5-sonnet-20241022",
    max_tokens: 1024,
    messages: [{ role: "user", content: "Hello" }],
  }),
});
05Every provider you use

Works with your stack.
Not against it.

Auto-detects OpenAI, Anthropic, Google Gemini, Mistral, Cohere, DeepSeek, Together, and Groq. Add custom gateways with one config line.

src/index.ts
import { wrapWorkersAI } from "@flarelog/sdk/ai";

export default {
  async fetch(req, env, ctx) {
    const ai = wrapWorkersAI(env.AI, logger);
    const result = await ai.run("@cf/meta/llama-3.3-70b-instruct-fp8-fast", {
      messages: [{ role: "user", content: "Hello" }],
    });
    return Response.json(result);
  },
};

Wraps env.AI.run() — the only library that instruments Cloudflare Workers AI natively.

06What you get

Full visibility into
every AI inference

Zero-config

Auto-patches global fetch()

One function call intercepts every outbound AI request. No base URL changes, no per-call wrapping, no proxy server. Just add the SDK and your existing code is instrumented.

Cost

Instant cost per call

Local price table covering 80+ models across OpenAI, Anthropic, Gemini, Mistral, Cohere, DeepSeek, and more. Cost computed in-process — no server roundtrip. Override prices for negotiated rates.

Latency

TTFB + generation speed breakdown

See time-to-first-byte separately from total duration. Track tokens-per-second across streaming responses. Know if a slow call is cold start, network, or model throughput.

Unified

AI calls next to app logs

The AI call that cost $0.50 sits right next to the application error that triggered the retry storm. No separate dashboard, no context switching, no correlation by trace ID.

Workers AI

Native Cloudflare binding support

Workers AI uses a binding, not fetch. FlareLog wraps env.AI.run() directly — the only observability tool that instruments it natively.

OTel

W3C trace propagation

Trace context injected on outbound AI calls. All span attributes follow OpenTelemetry GenAI semantic conventions. Compatible with Grafana, Honeycomb, Datadog, and Tempo.

Privacy

Metadata-only by default

Captures tokens, cost, latency, status, and model — never prompt or completion content. Enable captureSamples for truncated prompt previews when debugging.

Streaming

SSE chunk counting + zero-copy tee

Streaming responses are tee()'d once (zero-copy). SSE parsing runs in a background promise that never blocks the consumer.

Configurable

Filter, sample, and override

shouldInstrument to filter URLs. sampleRate independent of logger. costMultiplier for internal billing. extraProviderHosts for custom gateways.

07FAQ

Questions teams ask
before switching

How does the fetch interception work?

flarelogAI() patches the global fetch() function. When an outgoing request matches a known AI provider hostname (api.openai.com, api.anthropic.com, etc.), FlareLog clones the request body, creates an OTel span, and parses the response — all without modifying your original request or adding latency.

Will this slow down my app?

No. The interceptor adds <1ms per AI call. The hot path is: URL parse (~0.05ms), body peek (~0.3ms), span creation (~0.1ms), response parsing (~0.2ms). For streaming responses, the body is tee()'d once and SSE parsing runs in a background promise.

Do I need a proxy server like Helicone?

No. FlareLog intercepts fetch() locally in your runtime. Your AI requests go directly to the provider. This eliminates a network hop, reduces latency, and removes a single point of failure.

What if I use a custom AI gateway?

Add it as an OpenAI-compatible host: flarelogAI(logger, { extraProviderHosts: [{ pattern: "api.your-gateway.com", provider: "openai" }] }). Or build a custom ProviderMatcher for non-standard APIs.

Does it capture prompt content?

No, by default. Only metadata is captured: token counts, cost, latency, model name, status code. You can opt in to truncated prompt/completion samples (first 500 chars) with captureSamples: true for debugging.

How accurate is the cost calculation?

The bundled price table covers 80+ models from public pricing pages. Prices drift — always use priceOverrides for billing-grade accuracy. You can also apply a costMultiplier for internal cost allocation.

Can I see AI calls alongside my regular application logs?

Yes. That's the core differentiator. Every AI call is emitted as a structured log entry with flarelog.kind: "ai_call". It appears in the same dashboard, same search, same retention as your application logs. The retry loop that spiked costs sits right next to the error that caused it.

What about Workers AI? It doesn't use fetch().

Workers AI uses a binding (env.AI.run()), so fetch interception doesn't apply. Use wrapWorkersAI(env.AI, logger) — it wraps the binding directly and captures the same metrics.

08Start today

Add AI observability
in 30 seconds.

One npm install. One function call. Full visibility into every AI call — costs, tokens, latency, errors. No proxy, no credit card, no changes to your application code.