Llm

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
POST
GET
POST
GET
PATCH
DELETE
GET
POST
GET
POST
GET
PATCH

Retrieve llm analytics clustering config

Team-level clustering configuration (event filters for automated pipelines).

Required API key scopes

llm_analytics:read

Example request

GET /api/environments/:project_id/llm_analytics/clustering_config
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/clustering_config/

Example response

Status 200

Create llm analytics clustering config set event filters

Team-level clustering configuration (event filters for automated pipelines).

Required API key scopes

llm_analytics:write

Example request

POST /api/environments/:project_id/llm_analytics/clustering_config/set_event_filters
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/clustering_config/set_event_filters/

Example response

Status 200

List all llm analytics clustering jobs

CRUD for clustering job configurations (max 5 per team).

Required API key scopes

llm_analytics:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/environments/:project_id/llm_analytics/clustering_jobs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/clustering_jobs/

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"analysis_level": "trace",
"event_filters": null,
"enabled": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
]
}

Create llm analytics clustering jobs

CRUD for clustering job configurations (max 5 per team).

Required API key scopes

llm_analytics:write

Request parameters

  • name
    string
  • analysis_level
  • event_filters
  • enabled
    boolean

Response


Example request

POST /api/environments/:project_id/llm_analytics/clustering_jobs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/clustering_jobs/\
-d name="string",\
-d analysis_level=undefined

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"analysis_level": "trace",
"event_filters": null,
"enabled": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Retrieve llm analytics clustering jobs

CRUD for clustering job configurations (max 5 per team).

Required API key scopes

llm_analytics:read

Path parameters

  • id
    string

Response


Example request

GET /api/environments/:project_id/llm_analytics/clustering_jobs/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/clustering_jobs/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"analysis_level": "trace",
"event_filters": null,
"enabled": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Update llm analytics clustering jobs

CRUD for clustering job configurations (max 5 per team).

Required API key scopes

llm_analytics:write

Path parameters

  • id
    string

Request parameters

  • name
    string
  • analysis_level
  • event_filters
  • enabled
    boolean

Response


Example request

PATCH /api/environments/:project_id/llm_analytics/clustering_jobs/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/clustering_jobs/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"analysis_level": "trace",
"event_filters": null,
"enabled": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Delete llm analytics clustering jobs

CRUD for clustering job configurations (max 5 per team).

Required API key scopes

llm_analytics:write

Path parameters

  • id
    string

Example request

DELETE /api/environments/:project_id/llm_analytics/clustering_jobs/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/clustering_jobs/:id/

Example response

Status 204 No response body

Retrieve llm analytics evaluation config

Get the evaluation config for this team

Required API key scopes

evaluation:read

Response


Example request

GET /api/environments/:project_id/llm_analytics/evaluation_config
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/evaluation_config/

Example response

Status 200
RESPONSE
{
"trial_eval_limit": 0,
"trial_evals_used": 0,
"trial_evals_remaining": 0,
"active_provider_key": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"provider": "openai",
"name": "string",
"state": "unknown",
"error_message": "string",
"api_key": "string",
"api_key_masked": "string",
"azure_endpoint": "http://example.com",
"api_version": "string",
"azure_endpoint_display": "string",
"api_version_display": "string",
"set_as_active": false,
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"last_used_at": "2019-08-24T14:15:22Z"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Create llm analytics evaluation config set active key

Set the active provider key for evaluations

Required API key scopes

evaluation:write

Request parameters

  • key_id
    string

Response


Example request

POST /api/environments/:project_id/llm_analytics/evaluation_config/set_active_key
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/evaluation_config/set_active_key/\
-d key_id="string"

Example response

Status 200
RESPONSE
{
"trial_eval_limit": 0,
"trial_evals_used": 0,
"trial_evals_remaining": 0,
"active_provider_key": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"provider": "openai",
"name": "string",
"state": "unknown",
"error_message": "string",
"api_key": "string",
"api_key_masked": "string",
"azure_endpoint": "http://example.com",
"api_version": "string",
"azure_endpoint_display": "string",
"api_version_display": "string",
"set_as_active": false,
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"last_used_at": "2019-08-24T14:15:22Z"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

List all llm analytics evaluation reports

CRUD for evaluation report configurations + report run history.

Required API key scopes

llm_analytics:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/environments/:project_id/llm_analytics/evaluation_reports
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/evaluation_reports/

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"evaluation": "8b4883eb-9190-4e70-bfb9-71682af8a50b",
"frequency": "scheduled",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone_name": "string",
"next_delivery_date": "2019-08-24T14:15:22Z",
"delivery_targets": null,
"max_sample_size": -2147483648,
"enabled": true,
"deleted": true,
"last_delivered_at": "2019-08-24T14:15:22Z",
"report_prompt_guidance": "string",
"trigger_threshold": 10,
"cooldown_minutes": 60,
"daily_run_cap": 1,
"created_by": 0,
"created_at": "2019-08-24T14:15:22Z"
}
]
}

List all llm analytics evaluation reports

CRUD for evaluation report configurations + report run history.

Required API key scopes

llm_analytics:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/environments/:project_id/llm_analytics/evaluation_reports
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/evaluation_reports/

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"evaluation": "8b4883eb-9190-4e70-bfb9-71682af8a50b",
"frequency": "scheduled",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone_name": "string",
"next_delivery_date": "2019-08-24T14:15:22Z",
"delivery_targets": null,
"max_sample_size": -2147483648,
"enabled": true,
"deleted": true,
"last_delivered_at": "2019-08-24T14:15:22Z",
"report_prompt_guidance": "string",
"trigger_threshold": 10,
"cooldown_minutes": 60,
"daily_run_cap": 1,
"created_by": 0,
"created_at": "2019-08-24T14:15:22Z"
}
]
}

Create llm analytics evaluation reports

CRUD for evaluation report configurations + report run history.

Required API key scopes

llm_analytics:write

Request parameters

  • evaluation
    string
  • frequency
  • rrule
    string
  • starts_at
    stringnull
  • timezone_name
    string
  • delivery_targets
  • max_sample_size
    integer
  • enabled
    boolean
  • deleted
    boolean
  • report_prompt_guidance
    string
  • trigger_threshold
    integernull
  • cooldown_minutes
    integer
  • daily_run_cap
    integer

Response


Example request

POST /api/environments/:project_id/llm_analytics/evaluation_reports
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/evaluation_reports/\
-d evaluation="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"evaluation": "8b4883eb-9190-4e70-bfb9-71682af8a50b",
"frequency": "scheduled",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone_name": "string",
"next_delivery_date": "2019-08-24T14:15:22Z",
"delivery_targets": null,
"max_sample_size": -2147483648,
"enabled": true,
"deleted": true,
"last_delivered_at": "2019-08-24T14:15:22Z",
"report_prompt_guidance": "string",
"trigger_threshold": 10,
"cooldown_minutes": 60,
"daily_run_cap": 1,
"created_by": 0,
"created_at": "2019-08-24T14:15:22Z"
}

Create llm analytics evaluation reports

CRUD for evaluation report configurations + report run history.

Required API key scopes

llm_analytics:write

Request parameters

  • evaluation
    string
  • frequency
  • rrule
    string
  • starts_at
    stringnull
  • timezone_name
    string
  • delivery_targets
  • max_sample_size
    integer
  • enabled
    boolean
  • deleted
    boolean
  • report_prompt_guidance
    string
  • trigger_threshold
    integernull
  • cooldown_minutes
    integer
  • daily_run_cap
    integer

Response


Example request

POST /api/environments/:project_id/llm_analytics/evaluation_reports
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/evaluation_reports/\
-d evaluation="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"evaluation": "8b4883eb-9190-4e70-bfb9-71682af8a50b",
"frequency": "scheduled",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone_name": "string",
"next_delivery_date": "2019-08-24T14:15:22Z",
"delivery_targets": null,
"max_sample_size": -2147483648,
"enabled": true,
"deleted": true,
"last_delivered_at": "2019-08-24T14:15:22Z",
"report_prompt_guidance": "string",
"trigger_threshold": 10,
"cooldown_minutes": 60,
"daily_run_cap": 1,
"created_by": 0,
"created_at": "2019-08-24T14:15:22Z"
}

Retrieve llm analytics evaluation reports

CRUD for evaluation report configurations + report run history.

Required API key scopes

llm_analytics:read

Path parameters

  • id
    string

Response


Example request

GET /api/environments/:project_id/llm_analytics/evaluation_reports/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/evaluation_reports/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"evaluation": "8b4883eb-9190-4e70-bfb9-71682af8a50b",
"frequency": "scheduled",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone_name": "string",
"next_delivery_date": "2019-08-24T14:15:22Z",
"delivery_targets": null,
"max_sample_size": -2147483648,
"enabled": true,
"deleted": true,
"last_delivered_at": "2019-08-24T14:15:22Z",
"report_prompt_guidance": "string",
"trigger_threshold": 10,
"cooldown_minutes": 60,
"daily_run_cap": 1,
"created_by": 0,
"created_at": "2019-08-24T14:15:22Z"
}

Retrieve llm analytics evaluation reports

CRUD for evaluation report configurations + report run history.

Required API key scopes

llm_analytics:read

Path parameters

  • id
    string

Response


Example request

GET /api/environments/:project_id/llm_analytics/evaluation_reports/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/evaluation_reports/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"evaluation": "8b4883eb-9190-4e70-bfb9-71682af8a50b",
"frequency": "scheduled",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone_name": "string",
"next_delivery_date": "2019-08-24T14:15:22Z",
"delivery_targets": null,
"max_sample_size": -2147483648,
"enabled": true,
"deleted": true,
"last_delivered_at": "2019-08-24T14:15:22Z",
"report_prompt_guidance": "string",
"trigger_threshold": 10,
"cooldown_minutes": 60,
"daily_run_cap": 1,
"created_by": 0,
"created_at": "2019-08-24T14:15:22Z"
}

Update llm analytics evaluation reports

CRUD for evaluation report configurations + report run history.

Required API key scopes

llm_analytics:write

Path parameters

  • id
    string

Request parameters

  • evaluation
    string
  • frequency
  • rrule
    string
  • starts_at
    stringnull
  • timezone_name
    string
  • delivery_targets
  • max_sample_size
    integer
  • enabled
    boolean
  • deleted
    boolean
  • report_prompt_guidance
    string
  • trigger_threshold
    integernull
  • cooldown_minutes
    integer
  • daily_run_cap
    integer

Response


Example request

PATCH /api/environments/:project_id/llm_analytics/evaluation_reports/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/evaluation_reports/:id/\
-d evaluation="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"evaluation": "8b4883eb-9190-4e70-bfb9-71682af8a50b",
"frequency": "scheduled",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone_name": "string",
"next_delivery_date": "2019-08-24T14:15:22Z",
"delivery_targets": null,
"max_sample_size": -2147483648,
"enabled": true,
"deleted": true,
"last_delivered_at": "2019-08-24T14:15:22Z",
"report_prompt_guidance": "string",
"trigger_threshold": 10,
"cooldown_minutes": 60,
"daily_run_cap": 1,
"created_by": 0,
"created_at": "2019-08-24T14:15:22Z"
}

Update llm analytics evaluation reports

CRUD for evaluation report configurations + report run history.

Required API key scopes

llm_analytics:write

Path parameters

  • id
    string

Request parameters

  • evaluation
    string
  • frequency
  • rrule
    string
  • starts_at
    stringnull
  • timezone_name
    string
  • delivery_targets
  • max_sample_size
    integer
  • enabled
    boolean
  • deleted
    boolean
  • report_prompt_guidance
    string
  • trigger_threshold
    integernull
  • cooldown_minutes
    integer
  • daily_run_cap
    integer

Response


Example request

PATCH /api/environments/:project_id/llm_analytics/evaluation_reports/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/llm_analytics/evaluation_reports/:id/\
-d evaluation="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"evaluation": "8b4883eb-9190-4e70-bfb9-71682af8a50b",
"frequency": "scheduled",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone_name": "string",
"next_delivery_date": "2019-08-24T14:15:22Z",
"delivery_targets": null,
"max_sample_size": -2147483648,
"enabled": true,
"deleted": true,
"last_delivered_at": "2019-08-24T14:15:22Z",
"report_prompt_guidance": "string",
"trigger_threshold": 10,
"cooldown_minutes": 60,
"daily_run_cap": 1,
"created_by": 0,
"created_at": "2019-08-24T14:15:22Z"
}

Community questions

Questions about this page? or post a community question.