Skip to main content

Maxim Integration for Vercel

Requirements

Maxim supports both AI SDK 5 and AI SDK 6. The integration works seamlessly with either version.

Environment Variables

Initialize Logger

Wrap AI SDK Models with Maxim

Make LLM Calls Using Wrapped Models

Working with Different AI SDK Functions

The wrapped model works seamlessly with all Vercel AI SDK functions:

Generate Object

Stream Text

Custom Metadata and Tracing

Using Custom Metadata

Available Metadata Fields

Entity Naming:
  • sessionName - Override the default session name
  • traceName - Override the default trace name
  • spanName - Override the default span name
  • generationName - Override the default LLM generation name
Entity Tagging:
  • sessionTags - Add custom tags to the session (object: {key: value})
  • traceTags - Add custom tags to the trace (object: {key: value})
  • spanTags - Add custom tags to span (object: {key: value})
  • generationTags - Add custom tags to LLM generations (object: {key: value})
ID References:
  • sessionId - Link this trace to an existing session
  • traceId - Use a specific trace ID
  • spanId - Use a specific span ID

Streaming Support

Multiple Provider Support

Next.js Integration

API Route Example

Client-side Integration

Resources

Vercel AI SDK

Vercel Maxim Example