Helicone Query Language (HQL) lets you query your Helicone analytics data directly using SQL.
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#
- Go to
HQLin the sidebar - Browse tables and columns in the left panel
- Write your SQL in the editor
- 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 queriesPOST /v1/helicone-sql/saved-query- Create a new saved queryGET /v1/helicone-sql/saved-query/{queryId}- Get a specific saved queryPUT /v1/helicone-sql/saved-query/{queryId}- Update a saved queryDELETE /v1/helicone-sql/saved-query/{queryId}- Delete a saved query
Interactive API documentation: https://api.helicone.ai/docs/#/HeliconeSql
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
