npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@unhandled/instrumentation-vercel-ai

v1.0.14

Published

Vercel AI SDK telemetry normalized to GenAI conventions for Unhandled

Readme

@unhandled/instrumentation-vercel-ai

Turns Vercel AI SDK telemetry into GenAI-convention spans. The instrumentation switches experimental_telemetry on for you; the span processor renames and re-maps the spans the SDK emits. Neither creates spans of its own.

Covers generateText, streamText, generateObject, streamObject, embed, embedMany and rerank. Peer: ai >=3.0.0 <7.

Install

pnpm add @unhandled/instrumentation-vercel-ai

Register

With the AdonisJS agent:

import { vercelAi } from '@unhandled/instrumentation-vercel-ai/integration'

export default defineConfig({
  integrations: [vercelAi({ recordInputs: true, recordOutputs: false })],
})

Standalone:

import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node'
import {
  VercelAiInstrumentation,
  VercelAiSpanProcessor,
} from '@unhandled/instrumentation-vercel-ai'

const provider = new NodeTracerProvider({ spanProcessors: [new VercelAiSpanProcessor()] })
provider.register()
new VercelAiInstrumentation().enable()

Register before ai is imported. Nothing is traced until the instrumentation is enabled.

Options

| Option | Where | Default | Effect | | --------------- | -------------------------------------- | ------- | --------------------------------------------------------------------------------------- | | recordInputs | integration, instrumentation, processor | false | Prompt, system instructions, tool arguments. Integration value beats the per-call value. The processor defaults to true and keeps whatever the SDK recorded. | | recordOutputs | integration, instrumentation, processor | false | Response text, tool calls, object, tool results. Same precedence and processor default. | | enabled | integration | true | false skips the integration entirely. |

Content is opt-in: set the options above, or recordInputs / recordOutputs in a call's experimental_telemetry. A call with experimental_telemetry: { isEnabled: false } stays untraced. Pass the same recording options to the processor so content is also dropped from spans the SDK already recorded.

Conversation id

import { withConversationId, getConversationId } from '@unhandled/instrumentation-vercel-ai'

await withConversationId('chat-42', () => generateText({ ... }))
getConversationId() // 'chat-42' inside the callback

Every span started inside gets gen_ai.conversation.id.

Span names

| Span | Name | Example | | -------- | -------------------------- | ---------------------------- | | pipeline | {operation} {functionId} | invoke_agent weather-app | | model | {operation} {modelId} | generate_text gpt-4o | | tool | execute_tool {toolName} | execute_tool getWeather |

Operations: invoke_agent (generateText, streamText), generate_object, stream_object, embeddings, rerank, generate_text / stream_text (model spans), execute_tool.

Attributes

  • Always: gen_ai.operation.name, gen_ai.request.model, gen_ai.response.model, gen_ai.provider.name, gen_ai.function_id, gen_ai.tool.name.
  • Model spans only: gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, gen_ai.usage.cache_read.input_tokens, gen_ai.usage.cache_write.input_tokens, gen_ai.usage.reasoning.output_tokens. Pipeline spans keep the summed usage as vercel.ai.usage.*.
  • Inputs (recordInputs): gen_ai.system_instructions, gen_ai.input.messages, gen_ai.tool.call.arguments.
  • Outputs (recordOutputs): gen_ai.output.messages, gen_ai.tool.call.result.
  • Every other ai.* attribute is kept as vercel.ai.*, for example vercel.ai.response.msToFirstChunk.
  • Tool results that embed an error (tool-error, error-text, error-json, isError) add an exception event and ERROR status to the tool span.

Model spans carry gen_ai.usage.cost only when the SDK reports ai.usage.cost. Otherwise Unhandled computes cost when it reads the spans, from the model's price on that day.

For AI agents

A coding agent can install this package, check that its data arrives and fix the errors it reports through the Unhandled MCP server at https://unhandled.net/mcp. In Claude Code, the Unhandled plugin adds that server plus skills for instrumenting a service, fixing a production error with a failing test first and verifying a deploy:

claude plugin marketplace add treboryx/unhandled
claude plugin install unhandled@unhandled

Codex, Cursor, Gemini CLI and other agents connect to the same URL. Coding agents has the setup for each one and an AGENTS.md section to add to your repository.