This directory contains examples demonstrating how to use the Helicone AI SDK Provider with the Vercel AI SDK.
- Install dependencies:
npm install- Create a
.envfile in the root directory with your Helicone API key:
HELICONE_API_KEY=your_api_key_hereYou can run any example using tsx:
npx tsx examples/basic.ts
npx tsx examples/streaming.ts
npx tsx examples/advanced-tracking.ts
npx tsx examples/multiple-providers.ts
npx tsx examples/tool-calling.ts
npx tsx examples/stream-tool-calling.ts
npx tsx examples/streamText-tools-properties.ts
npx tsx examples/prompts.ts
npx tsx examples/agent-tools.ts
npx tsx examples/agents-json.ts
npx tsx examples/agents-zod.ts
npx tsx examples/validate-ui-messages.tsSimple text generation example showing basic usage of the Helicone provider.
Demonstrates streaming responses from the model.
Shows how to use advanced tracking features like session IDs, user IDs, custom properties, tags, and caching.
Example of using multiple AI providers (OpenAI and Anthropic) through Helicone.
Comprehensive example demonstrating how to use tool calling (function calling) with generateText.
Note: generateText returns tool call requests but does not execute them automatically. For automatic tool execution, see stream-tool-calling.ts.
Demonstrates streaming with tool calling using streamText. Shows how to handle tool calls and results in a streaming context, including processing fullStream chunks for text deltas, tool calls, and tool results. Includes weather and calculation tools with automatic execution.
Example showing tool calling with streamText and how to access tool properties in the streaming response. Useful for debugging and monitoring tool execution in real-time.
Comprehensive examples of Helicone prompts integration, including:
- Basic prompt usage with inputs
- Streaming with prompts
- Multiple environment configurations (development, staging, production)
- Prompts combined with tools
- Regular messages (without prompts) for comparison
Demonstrates using the experimental Agent class with Helicone, showing a customer support agent with multiple tools.
Includes detailed step-by-step execution tracking and tool call/result logging.
Agent demo using jsonSchema(...) helpers to define tool schemas. Shows how to structure agent tools using JSON Schema format.
Agent demo using raw Zod schemas to define tool schemas. Functionally similar to agents-json.ts but demonstrates the Zod schema approach.
Both agents-json.ts and agents-zod.ts send the same tool definitions; any behavioral differences stem from model choice or prompt/tool-choice settings (e.g., forcing toolChoice: { type: 'required' }).
Example demonstrating how to use validateUIMessages with Helicone provider, commonly used in API routes. Shows how to handle AI SDK v6 UI message format with parts array, including:
- Message validation
- Conversation history handling
- Edge cases and different message types
- Integration with the Agent class
- Make sure you have a valid Helicone API key from helicone.ai
- Some examples may require specific model access (e.g., GPT-4, Claude)
- All requests are tracked in your Helicone dashboard