Skip to main content
Helicone integrates seamlessly with the Vercel AI SDK, providing observability for streaming AI applications built with Next.js and React.

Integration Methods

Provider Configuration

Configure AI SDK providers to route through Helicone.

AI Gateway

Use the AI Gateway for unified access to all providers.

Custom Headers

Add Helicone headers to track sessions and custom properties.

Async Logging

Zero-latency logging for production apps.

Quick Start

1

Install dependencies

2

Configure provider with Helicone

3

Use with AI SDK functions

Streaming Chat

Integrate Helicone with Next.js API routes:
Client-side:

Session Tracking

Track multi-turn conversations with session IDs:
In API routes:
Learn more about Session Tracking.

Custom Properties

Add custom metadata to track important context:

Tool Calling

Helicone tracks tool calls with full visibility:

AWS Bedrock

Use Vercel AI SDK with AWS Bedrock through Helicone:

Response Caching

Reduce costs with response caching:
Learn more about Response Caching.

Object Generation

Track structured object generation:

Streaming Objects

Stream structured data generation:

Multi-Modal (Vision)

Use vision models with Helicone:

Rate Limiting

Control usage per user:
Learn more about Rate Limiting.

Best Practices

Track conversations with session IDs:
Add context for better organization:
Label requests that use tools:
Reduce costs with caching:

Server Actions

Use Helicone with Next.js Server Actions:

Troubleshooting

  1. Verify your Helicone API key is correct
  2. Check the Helicone-Auth header format: Bearer sk-helicone-...
  3. Ensure you’re passing headers to the provider config, not the individual function
  4. Check browser network tab for failed requests
  • Ensure your Next.js API route returns result.toDataStreamResponse()
  • Check that streaming is enabled in your deployment platform
  • Verify no middleware is buffering the response
  • Session IDs must be consistent across requests
  • Pass session ID from client to API route
  • Use UUIDs or unique strings for session IDs
Headers should be in the provider configuration:

Next Steps

AI Gateway

Use multiple providers with automatic fallbacks

Session Tracking

Track multi-turn conversations

Custom Properties

Add custom metadata

Response Caching

Reduce costs with caching