Skip to main content
Helicone OSS LLM Observability

Vercel AI SDK Integration

Integrate Vercel AI SDK with Helicone to monitor, debug, and improve your AI applications.
1 min read
Warning

This integration method is maintained but no longer actively developed. For the best experience and latest features, use our new AI Gateway with unified API access to 100+ models.

How to Integrate#

Create an account and generate an API key

Log into Helicone or create an account. Once you have an account, you can generate an API key here.

Set up your Helicone API key in your .env file

Modify the base URL path

Configuring Helicone Features with Headers#

Enable Helicone features through headers, configurable at client initialization or individual request level.

Configure Client#

Generate Text#

Stream Text#

Using with Existing Custom Base URLs#

If you're already using a custom base URL for an OpenAI-compatible vendor, you can proxy your requests through Helicone by setting the Helicone-Target-URL header to your existing vendor's endpoint.

Example with Custom Vendor#

Example with Multiple Vendors#

You can also dynamically set the target URL per request:

This approach allows you to:

  • Keep your existing vendor integrations
  • Add Helicone monitoring and features
  • Switch between vendors without changing your base URL
  • Maintain compatibility with your current setup