Introduction#
Vercel AI SDK is a TypeScript toolkit for building AI-powered applications with React, Next.js, Vue, and more.
The Helicone provider for Vercel AI SDK is available as a dedicated package: @helicone/ai-sdk-provider.
Integration Steps#
Create an account and generate an API key
Sign up at helicone.ai and generate an API key.
You'll also need to configure your provider API keys (OpenAI, Anthropic, etc.) at Helicone Providers for BYOK (Bring Your Own Keys).
Set up your Helicone API key in your .env file
Install the Helicone AI SDK provider
Configure Vercel AI SDK with Helicone
You can switch between 100+ models without changing your code. Just update the model name!
While you're here, why not give us a star on GitHub? It helps us a lot!
Complete Working Examples#
Basic Text Generation#
Streaming Text#
UI Message Stream Response#
Convert streaming results to a UI-compatible response format:
Provider Selection#
By default, Helicone's AI gateway automatically routes to the cheapest provider. You can also manually select a specific provider:
With Custom Properties and Session Tracking#
Tool Calling#
Agents#
Use Vercel AI SDK's Agent API with Helicone to build multi-step reasoning agents:
Helicone Prompts Integration#
Use prompts created in your Helicone dashboard instead of hardcoding messages in your application:
When using promptId, you must still pass a placeholder messages array to satisfy the Vercel AI SDK's validation. The actual prompt content will be fetched from your Helicone dashboard, and the placeholder messages will be ignored.
Benefits of using Helicone prompts:
- 🎯 Centralized Management: Update prompts without code changes
- 👩🏻💻 Perfect for non-technical users: Create prompts using the Helicone dashboard
- 🚀 Lower Latency: Single API call, no message construction overhead
- 🔧 A/B Testing: Test different prompt versions with environments
- 📊 Better Analytics: Track prompt performance across versions
Additional Examples#
For more comprehensive examples, check out the GitHub repository.
Looking for a framework or tool not listed here? Request it here!
Additional Resources#
Related Documentation#
Learn about Helicone's AI Gateway features and capabilities
Configure intelligent routing and automatic failover
Browse all available models and providers
Version and manage prompts with Helicone Prompts
Add metadata to track and filter your requests
Track multi-turn conversations and user sessions
Configure rate limits for your applications
Reduce costs and latency with intelligent caching
