Implementation:Helicone Helicone UseProFeature
| Knowledge Sources | |
|---|---|
| Domains | Billing, Access Control |
| Last Updated | 2026-02-14 06:32 GMT |
Overview
React hook that gates premium features behind subscription tier checks and provides contextual upgrade messaging.
Description
The useProFeature hook checks the current organization's subscription tier to determine whether the user has access to a specific premium feature. It evaluates tier strings such as pro-20240913, pro-20250202, pro-20251210, growth, pro, enterprise, demo, team-20250130, and team-20251210, as well as stripe metadata addon flags. The hook returns a hasAccess boolean, a feature-specific title and customDescription for upgrade dialogs, and an isPro flag indicating whether the user is on a pro or team tier specifically.
The file also exports two lookup objects: descriptions (mapping feature names to their upgrade prompt messages) and titles (mapping feature names to their upgrade dialog titles), covering features including Datasets, Alerts, time_filter, invite, RateLimit, Properties, Prompts, cache, Evaluators, Playground, Sessions, Vault, Webhooks, and Users.
Usage
Use this hook in any component that needs to conditionally render premium features or display upgrade prompts. Pass a FeatureName to get access status and pre-configured upgrade messaging for that specific feature.
Code Reference
Source Location
- Repository: Helicone
- File: web/hooks/useProFeature.ts
Signature
export const descriptions: Record<FeatureName, string>;
export type FeatureName = keyof typeof descriptions;
export const titles: Record<FeatureName, string>;
export function useProFeature(featureName: FeatureName, enabled?: boolean): {
hasAccess: boolean;
customDescription: string;
title: string;
isPro: boolean;
};
Import
import { useProFeature, FeatureName, descriptions, titles } from "@/hooks/useProFeature";
I/O Contract
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| featureName | FeatureName |
Yes | The feature to check access for (e.g., "Datasets", "Alerts", "Prompts") |
| enabled | boolean |
No | Defaults to true; when false, hasAccess will always be false
|
Return Value
| Property | Type | Description |
|---|---|---|
| hasAccess | boolean |
Whether the current organization's tier grants access to the feature |
| customDescription | string |
Upgrade prompt description for the specific feature |
| title | string |
Upgrade dialog title (e.g., "Unlock Datasets") |
| isPro | boolean |
Whether the org is specifically on a pro or team tier |
Supported Tiers for Access
| Tier | Grants Access |
|---|---|
| pro-20240913 | Yes |
| pro-20250202 | Yes |
| pro-20251210 | Yes |
| growth | Yes |
| pro | Yes |
| enterprise | Yes |
| demo | Yes |
| team-20250130 | Yes |
| team-20251210 | Yes |
| stripe_metadata.addons.prompts | Yes (addon check) |
Usage Examples
import { useProFeature } from "@/hooks/useProFeature";
function DatasetPage() {
const { hasAccess, title, customDescription } = useProFeature("Datasets");
if (!hasAccess) {
return <UpgradeDialog title={title} description={customDescription} />;
}
return <DatasetContent />;
}