Llm
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
GET | |
POST | |
GET | |
POST | |
GET | |
PATCH | |
DELETE | |
POST | |
GET | |
POST | |
GET | |
POST | |
GET | |
PATCH | |
DELETE | |
POST | |
GET |
List all llm analytics personal spend
Return a structured personal LLM spend analysis for the requesting user. Pass date_from / date_to (absolute like 2026-04-23 or relative like -7d) to bound the window — defaults to the last 30 days, max 90 days. The product=<ai_product> query param is required and scopes the tool / model / day / trace breakdowns to a single product; supported values: posthog_code. by_product is always returned for cross-product visibility. by_day returns a day-ascending spend series for the scoped product. Pass bucket_minutes (5, 15, 30, or 60; the window may span at most 600 buckets) to additionally get by_bucket, a time-ascending series with per-bucket cost split into uncached input / output / cache read / cache creation components. Use refresh=true to bypass the 5-minute response cache.
Required API key scopes
user:readQuery parameters
- bucket_minutesintegerOne of:
"5""15""30""60" - date_fromstringDefault:
-30d - date_tostringnull
- limitintegerDefault:
50 - productstring
- refreshbooleanDefault:
false
Example request
GET /api /llm_analytics /@me /spendExample response
Status 200
Status 400
Status 401
Status 403
Status 404
Status 429
List all llm analytics clustering config
Team-level clustering configuration (event filters for automated pipelines).
Required API key scopes
ai_observability_clusters:readResponse
Example request
GET /api /projects /:project_id /llm_analytics /clustering_configExample response
Status 200
Create llm analytics clustering config set event filters
Team-level clustering configuration (event filters for automated pipelines).
Required API key scopes
ai_observability_clusters:writeRequest parameters
- event_filtersarray
Response
Example request
POST /api /projects /:project_id /llm_analytics /clustering_config /set_event_filtersExample response
Status 200
List all llm analytics clustering jobs
CRUD for clustering job configurations (max 10 per team).
Required API key scopes
ai_observability_clusters:readQuery parameters
- limitinteger
- offsetinteger
Response
Example request
GET /api /projects /:project_id /llm_analytics /clustering_jobsExample response
Status 200
Create llm analytics clustering jobs
CRUD for clustering job configurations (max 10 per team).
Required API key scopes
ai_observability_clusters:writeRequest parameters
- namestring
- analysis_level
- event_filters
- enabledboolean
Response
Example request
POST /api /projects /:project_id /llm_analytics /clustering_jobsExample response
Status 201
Retrieve llm analytics clustering jobs
CRUD for clustering job configurations (max 10 per team).
Required API key scopes
ai_observability_clusters:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /llm_analytics /clustering_jobs /:idExample response
Status 200
Update llm analytics clustering jobs
CRUD for clustering job configurations (max 10 per team).
Required API key scopes
ai_observability_clusters:writePath parameters
- idstring
Request parameters
- namestring
- analysis_level
- event_filters
- enabledboolean
Response
Example request
PATCH /api /projects /:project_id /llm_analytics /clustering_jobs /:idExample response
Status 200
Delete llm analytics clustering jobs
CRUD for clustering job configurations (max 10 per team).
Required API key scopes
ai_observability_clusters:writePath parameters
- idstring
Example request
DELETE /api /projects /:project_id /llm_analytics /clustering_jobs /:idExample response
Status 204 No response body
Create llm analytics clustering runs
Trigger a new clustering workflow run.
This endpoint validates the request parameters and starts a Temporal workflow to perform trace clustering with the specified configuration.
Required API key scopes
ai_observability_clusters:writeRequest parameters
- lookback_daysintegerDefault:
7 - max_samplesintegerDefault:
1500 - embedding_normalizationDefault:
none - dimensionality_reduction_methodDefault:
umap - dimensionality_reduction_ndimsintegerDefault:
100 - clustering_methodDefault:
hdbscan - min_cluster_size_fractionnumberDefault:
0.02 - hdbscan_min_samplesintegerDefault:
5 - kmeans_min_kintegerDefault:
2 - kmeans_max_kintegerDefault:
20 - run_labelstringDefault:
- visualization_methodDefault:
umap - event_filtersarray
- clustering_job_idstringnull
Response
Example request
POST /api /projects /:project_id /llm_analytics /clustering_runsExample response
Status 201
Retrieve llm analytics evaluation config
Get the evaluation config for this team
Required API key scopes
evaluation:readResponse
Example request
GET /api /projects /:project_id /llm_analytics /evaluation_configExample response
Status 200
Create llm analytics evaluation config set active key
Set the active provider key for evaluations
Required API key scopes
evaluation:writeRequest parameters
- key_idstring
Response
Example request
POST /api /projects /:project_id /llm_analytics /evaluation_config /set_active_keyExample response
Status 200
List all llm analytics evaluation reports
CRUD for evaluation report configurations + report run history.
Required API key scopes
llm_analytics:readQuery parameters
- evaluationstring
- limitinteger
- offsetinteger
Response
Example request
GET /api /projects /:project_id /llm_analytics /evaluation_reportsExample response
Status 200
Create llm analytics evaluation reports
CRUD for evaluation report configurations + report run history.
Required API key scopes
llm_analytics:writeRequest parameters
- evaluationstring
- frequency
- rrulestring
- delivery_targets
- max_sample_sizeinteger
- enabledboolean
- report_prompt_guidancestring
- trigger_thresholdintegernull
- cooldown_minutesinteger
- daily_run_capinteger
Response
Example request
POST /api /projects /:project_id /llm_analytics /evaluation_reportsExample response
Status 201
Retrieve llm analytics evaluation reports
CRUD for evaluation report configurations + report run history.
Required API key scopes
llm_analytics:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /llm_analytics /evaluation_reports /:idExample response
Status 200
Update llm analytics evaluation reports
CRUD for evaluation report configurations + report run history.
Required API key scopes
llm_analytics:writePath parameters
- idstring
Request parameters
- frequency
- rrulestring
- delivery_targets
- max_sample_sizeinteger
- enabledboolean
- report_prompt_guidancestring
- trigger_thresholdintegernull
- cooldown_minutesinteger
- daily_run_capinteger
Response
Example request
PATCH /api /projects /:project_id /llm_analytics /evaluation_reports /:idExample response
Status 200
Delete llm analytics evaluation reports
Evaluation report configs are deleted only when their evaluation is deleted. Use PATCH enabled=false to stop delivery.
Required API key scopes
llm_analytics:writePath parameters
- idstring
Example request
DELETE /api /projects /:project_id /llm_analytics /evaluation_reports /:idExample response
Status 405 No response body
Create llm analytics evaluation reports generate
Trigger immediate report generation.
Required API key scopes
llm_analytics:writePath parameters
- idstring
Example request
POST /api /projects /:project_id /llm_analytics /evaluation_reports /:id /generateExample response
Status 202 No response body
List all llm analytics evaluation reports runs
List report runs (history) for this report.
Required API key scopes
llm_analytics:readPath parameters
- idstring
Query parameters
- limitinteger
- offsetinteger
Response
Example request
GET /api /projects /:project_id /llm_analytics /evaluation_reports /:id /runs