Skip to content
WebMCP Agents
Esc
↑↓navigate↵open⌘Jpreview
On this page

Log model calls in Helicone

Helicone logs every model call as the chat's model, beside the telemetry layer rather than instead of it: the same six steps, two of them skipped.

Six steps, from the packages to one trace per turn in Helicone: the same six on every backend’s page. The framework picker above the code picks your routes; the backend stays picked for the pages after this one.

Install the packages

Helicone is not an OpenTelemetry backend: it has no general OTLP endpoint. It sits between your server and the model provider and logs every call that passes through it, so it is set up as the chat’s model. Its provider package:

npm install @helicone/ai-sdk-provider
pnpm add @helicone/ai-sdk-provider
yarn add @helicone/ai-sdk-provider
bun add @helicone/ai-sdk-provider
nub add @helicone/ai-sdk-provider
aube add @helicone/ai-sdk-provider

Set the environment

Your Helicone key, on the server. Your provider keys are kept in Helicone’s dashboard.

HELICONE_API_KEY=…

Add the server layer

Give the chat handler a Helicone model, in place of the model it had:

import { createHelicone } from "@helicone/ai-sdk-provider";
import { createChatHandler } from "@webmcp-agents/chat/server";

import { agents } from "../../shared/agents";

// Helicone sits between the chat and the model: every model call is
// logged there. It is not where the layer's spans go.
const helicone = createHelicone({
  apiKey: process.env.HELICONE_API_KEY,
});

export const POST = createChatHandler({
  agents,
  model: helicone("claude-4.5-haiku"),
});

The older proxy form (createOpenAI({ baseURL: "https://oai.helicone.ai/v1", headers: { "Helicone-Auth": … } }) with Helicone-Session-Id headers) is still maintained but no longer developed.

Add the relay route

Helicone takes no spans from the page, so there is no relay for it. Skip this step, or keep it when you also send spans to a backend: pick that backend in Installation and follow its step 4.

Observe the page

The same: the page’s runs and tool calls are spans, which Helicone does not take. Skip it unless you send spans elsewhere.

Check it in Helicone

Start the app and send one message in the chat. Each model call appears in Helicone. To group a conversation’s calls into a Helicone session, the provider takes extraBody: { helicone: { sessionId, userId } } per model.

Sources, and what was not confirmed

Not confirmed: that Helicone’s /v1/trace/log understands this library’s spans.

Next

The telemetry APIs

What you just set up, one API per page: the layer, where spans go, the relay, the page’s observer, sampling and the conversation key, each showing what differs for Helicone.

Was this page helpful?