Skip to main content
Learn how to create an interactive AI debate application that demonstrates four different integration approaches for Vercel AI Gateway with Helicone observability. This cookbook shows you how to support both streaming and non-streaming responses across different SDKs.

What You’ll Build

An AI debate simulator where:
  • Users can select topics and watch AI-generated debates
  • Four different integration methods showcase flexibility
  • Helicone provides complete observability for all approaches
  • Both streaming and non-streaming responses are supported

Prerequisites

Setup

Install the required dependencies:
Set up your environment variables:

Integration Methods

1. Vercel AI SDK (Non-Streaming)

Create a basic debate generation endpoint using the Vercel AI SDK:

2. Vercel AI SDK (Streaming)

Enable real-time debate streaming for better user experience:

3. OpenAI SDK (Non-Streaming)

Use the OpenAI SDK directly with Vercel AI Gateway routing:

4. OpenAI SDK (Streaming)

Enable streaming with the OpenAI SDK:

Frontend Integration

Create a debate interface that supports all integration methods:

Monitoring in Helicone

View comprehensive analytics for your debate simulator:
  1. Method Comparison: Compare performance across integration methods
  2. Topic Analytics: See which debate topics are most popular
  3. Stream vs Non-Stream: Analyze latency and user experience differences
  4. Cost Tracking: Monitor costs per debate and integration method

Custom Filters

Use Helicone’s property filters to analyze:
  • Performance by integration method: property:Method = "vercel-ai-stream"
  • Popular topics: Group by property:Topic
  • Streaming usage: Filter by property:Stream = "true"

Next Steps

Sessions

Track multi-turn debates

Prompts

Manage debate templates

Rate Limiting

Control debate frequency

Custom Properties

Track debate metadata