When building AI applications with multiple users, you need to track costs, usage patterns, and performance per individual user for billing, optimization, and abuse detection. User Metrics automatically aggregates all requests by user ID, giving you detailed analytics on each user’s AI usage across your entire application.
User metrics overview: Requests, costs, and activities tracked in Helicone

See user metrics such as the number of requests, costs, and activities.

Why use User Metrics

  • Track billing and costs: Calculate exact costs per user for accurate billing and profitability analysis
  • Detect abuse and anomalies: Identify users with unusual usage patterns or potential API abuse
  • Optimize user experience: Find performance bottlenecks and high-cost operations affecting specific users

Quick Start

1

Add user identification

Include a Helicone-User-Id header in your LLM requests:
{
  "Helicone-User-Id": "user-123" // Or email: "user@example.com"
}
2

Make your request

Execute your LLM request with the user ID header:
const response = await openai.chat.completions.create(
  {
    model: "gpt-4o-mini",
    messages: [{ role: "user", content: "Hello!" }]
  },
  {
    headers: {
      "Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY}`,
      "Helicone-User-Id": "user-123"
    }
  }
);
3

View user analytics

Access detailed per-user metrics in the Users tab of your Helicone dashboard, including costs, request volumes, and usage patterns.

Configuration Options

Basic Settings

User identification can be set through multiple methods:
MethodHeader/ParameterTypeDescriptionExample
Helicone HeaderHelicone-User-IdstringRecommended approach for user tracking"user-123"
OpenAI Parameteruser in request bodystringOpenAI’s built-in user parameter"user-123"

Advanced Settings

Use Cases

Track costs per user for accurate billing and profitability analysis:
import OpenAI from "openai";

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}`,
  },
});

// Track AI costs per customer for billing
async function handleUserRequest(userId, prompt) {
  const response = await openai.chat.completions.create(
    {
      model: "gpt-4o-mini",
      messages: [{ role: "user", content: prompt }]
    },
    {
      headers: {
        "Helicone-User-Id": userId,
        "Helicone-Property-Plan": "premium", // Track by plan type
        "Helicone-Property-Feature": "chat" // Track by feature
      }
    }
  );
  
  // Use response...
  return response;
}

// Now analyze:
// - Total cost per user this month
// - Average cost per user by plan type  
// - Which users are most/least profitable