Skip to main content
Helicone OSS LLM Observability

HQL (Helicone Query Language)

Query your Helicone analytics data directly using SQL with row-level security and built-in limits
2 min read

Helicone Query Language (HQL) lets you query your Helicone analytics data directly using SQL.

Note

HQL is currently available to selected workspaces. If you don’t see the HQL page in your dashboard, click “Request Access” from the HQL screen or contact support.

What you can query#

  • request_created_at: timestamp of the request
  • request_model: model name used (e.g. gpt-4o)
  • status: HTTP status code
  • user_id: your application user identifier (if provided)
  • cost / provider_total_cost: cost metrics
  • prompt_tokens, completion_tokens, total_tokens: token usage
  • properties: custom properties map (e.g. properties['Helicone-Session-Id'])

Examples#

Top costly requests (last 7 days)#

Error rate (last 24 hours)#

Active users by day (last 14 days)#

Session analysis using custom properties#

Cost by model (last 30 days)#

How to use HQL#

In the Dashboard#

  1. Go to HQL in the sidebar
  2. Browse tables and columns in the left panel
  3. Write your SQL in the editor
  4. Press Cmd/Ctrl+Enter to run; Cmd/Ctrl+S to save as a query

Saved queries can be revisited and shared within your organization.

Via REST API#

The HQL REST API allows you to execute SQL queries programmatically. All endpoints require authentication via API key.

Authentication#

Include your API key in the Authorization header:

Execute a Query#

Endpoint: POST https://api.helicone.ai/v1/helicone-sql/execute

Response:

Get Schema#

Endpoint: GET https://api.helicone.ai/v1/helicone-sql/schema

Returns available tables and columns for querying.

Download Results as CSV#

Endpoint: POST https://api.helicone.ai/v1/helicone-sql/download

Executes a query and returns a signed URL to download the results as CSV.

Saved Queries#

You can also manage saved queries programmatically:

  • GET /v1/helicone-sql/saved-queries - List all saved queries
  • POST /v1/helicone-sql/saved-query - Create a new saved query
  • GET /v1/helicone-sql/saved-query/{queryId} - Get a specific saved query
  • PUT /v1/helicone-sql/saved-query/{queryId} - Update a saved query
  • DELETE /v1/helicone-sql/saved-query/{queryId} - Delete a saved query

Interactive API documentation: https://api.helicone.ai/docs/#/HeliconeSql

Warning

Cost Values Are Stored as Integers

Cost values in ClickHouse are stored multiplied by 1,000,000,000 (one billion) for precision. When querying costs via the API, divide by this multiplier to get the actual USD value:

API Limits#

  • Query limit: 300,000 rows maximum per query
  • Timeout: 30 seconds per query
  • Rate limits: 100 queries/min, 10 CSV downloads/min