Who can use this feature: Anyone on any plan.

This feature is currently in beta. While you’re welcome to try it out, please know that our team is still working to refine it. Your feedback is valuable to help us improve!

Introduction

Sessions in Helicone provide a powerful way to organize and analyze complex interactions within your LLM applications. By grouping related requests together, sessions offer a holistic view of user journeys, multi-step processes, or extended AI workflows. This feature is particularly valuable for applications that involve multiple back-and-forth exchanges or those that build upon previous context.

Helicone example of a session template for monitoring and managing inputs from requests sent to your AI applications.

Example: A Session creating an outline for a book about space

Why Sessions

Sessions, identified by a helicone-session-id header, allow you to:

  • Reconstruct the flow of a conversation or a multi-stage task
  • Analyze performance and outcomes across entire interaction sequences
  • Identify bottlenecks or areas for improvement in your AI workflows
  • Gain deeper insights into user behavior and application patterns

Quick Start

Simply add a Helicone-Session-Id header to your request to start tracking your sessions and traces.

To represent parent and child traces we take advantange of a simple path syntax in the Helicone-Session-Path header. For example, if you have a parent trace parent and a child trace child, you can represent this as /parent/child.

Depending on your library you will need to add the following two headers to your request:

  • Helicone-Session-Id - The session id you want to track
  • Helicone-Session-Path - The path of the session

Here is an example is ts: see other languages

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
  baseURL: "https://oai.helicone.ai/v1",
  defaultHeaders: {
    "Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY}`,
  },
});

const session = randomUUID();

openai.chat.completions.create(
  {
    messages: [
      {
        role: "user",
        content: "Generate an abstract for a course on space.",
      },
    ],
    model: "gpt-4",
  },
  {
    headers: {
      "Helicone-Session-Id": session,
      "Helicone-Session-Path": "/abstract",
    },
  }
);

Node JS Example

Javascript Session example shown above