Skip to main content
Fallom provides a wrapper for the Vercel AI SDK that automatically traces all your LLM calls, including streaming with time-to-first-token metrics.
AI SDK v6 Support: Fallom fully supports AI SDK v6 including the new ToolLoopAgent class, tool approval workflows, and all v6 features. Both v5 and v6 patterns work with our SDK.

Installation

Version Compatibility

We recommend upgrading to AI SDK v6 for the latest features including reusable agents and improved type safety. Run npx @ai-sdk/codemod upgrade v6 to migrate automatically.

Two Approaches (Pick ONE)

Choose ONE approach per call. Do NOT mix them.Using both wrapAISDK and traceModel together will create duplicate traces.

Full tracing - captures prompts, completions, tokens, costs, and all metadata.

Option 2: Wrap the Model (PostHog Style)

Simpler integration - captures tokens and timing only.
This approach does NOT capture prompt or completion content. Use Option 1 if you need full observability.

With OpenRouter

Streaming with TTFT

Streaming responses automatically capture time to first token (TTFT):

Structured Output

generateObject and streamObject are also supported:

Tool Calling (Agents)

The Vercel AI SDK supports tool/function calling with maxSteps for multi-turn agent behavior. All tool calls are automatically traced:

What Gets Traced for Tool Calls

AI SDK v6: ToolLoopAgent

AI SDK v6 introduces the ToolLoopAgent class for building reusable agents. Fallom supports tracing ToolLoopAgent by wrapping the underlying AI SDK functions:

ToolLoopAgent with Streaming

Call Options (v6)

AI SDK v6 supports type-safe call options for dynamic agent configuration:

Tool Approval (Human-in-the-Loop)

AI SDK v6 supports tool approval workflows. Use onStepFinish to implement human-in-the-loop:

Model A/B Testing

Test different models with consistent session assignment:

Prompt Management

Use managed prompts with the Vercel AI SDK:

What Gets Traced

With Other Providers

The wrapper works with any Vercel AI SDK provider:

Alternative: OpenRouter Broadcast

If you’re using OpenRouter and prefer zero-SDK tracing, use OpenRouter Broadcast. However, Vercel AI SDK doesn’t pass custom body fields to OpenRouter, so you’ll need to use the OpenAI SDK directly for session tracking:
Recommendation: Use session.wrapAISDK() for Vercel AI SDK. It provides full tracing, session tracking, and works with all Vercel AI SDK functions including generateObject and streamObject.

Next Steps

Model A/B Testing

Set up experiments to test different models.

Prompt Management

Manage and version your prompts.

Mastra Agents

Use with Mastra AI agent framework.

OpenRouter Broadcast

Zero-code tracing via OpenRouter.