:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(llma): steer eval tooling to team provider keys over trial credits (#66274)
Carlos Marchal6708e404c749
diff --git a/products/ai_observability/backend/api/evaluation_config.py b/products/ai_observability/backend/api/evaluation_config.pyindex 55487ab4bae4..95a7272b3e9d 100644--- a/products/ai_observability/backend/api/evaluation_config.py+++ b/products/ai_observability/backend/api/evaluation_config.py@@ -22,12 +22,12 @@ from .provider_keys import LLMProviderKeySerializerclass EvaluationConfigSerializer(serializers.ModelSerializer):trial_evals_remaining = serializers.IntegerField(read_only=True,- help_text="Number of trial evaluation runs remaining before the team must supply its own provider key.",+ help_text="Trial runs remaining — a getting-started affordance only; evals should use the team's own provider key.",)active_provider_key = LLMProviderKeySerializer(read_only=True,allow_null=True,- help_text="Provider key currently used to run llm_judge evaluations. Null when the team is on trial credits.",+ help_text="Provider key used to run llm_judge evals; null if none configured yet.",)class Meta:@@ -50,10 +50,10 @@ class EvaluationConfigSerializer(serializers.ModelSerializer):]extra_kwargs = {"trial_eval_limit": {- "help_text": "Maximum number of llm_judge runs the team may execute on PostHog trial credits.",+ "help_text": "Cap on trial runs — a getting-started affordance only, not for ongoing evals (use the team's own key).",},"trial_evals_used": {- "help_text": "Number of llm_judge runs already consumed against the trial credit pool.",+ "help_text": "Trial runs consumed (getting-started affordance only).",},"created_at": {"help_text": "Timestamp when the evaluation config row was created."},"updated_at": {"help_text": "Timestamp when the evaluation config row was last modified."},diff --git a/products/ai_observability/backend/api/evaluations.py b/products/ai_observability/backend/api/evaluations.pyindex 33cb5e7acf7c..bbd1c5430389 100644--- a/products/ai_observability/backend/api/evaluations.py+++ b/products/ai_observability/backend/api/evaluations.py@@ -115,7 +115,11 @@ class ModelConfigurationSerializer(serializers.Serializer):provider = serializers.ChoiceField(choices=LLMProvider.choices)model = serializers.CharField(max_length=100)- provider_key_id = serializers.UUIDField(required=False, allow_null=True)+ provider_key_id = serializers.UUIDField(+ required=False,+ allow_null=True,+ help_text="Team provider key to run this eval with (same provider as `provider`). Leave null only for brief pre-key testing; real evals should set it.",+ )provider_key_name = serializers.SerializerMethodField(read_only=True)def get_provider_key_name(self, obj: LLMModelConfiguration) -> str | None:diff --git a/products/ai_observability/backend/api/models.py b/products/ai_observability/backend/api/models.pyindex b9f2739edafa..ef9c5f3ef6a9 100644--- a/products/ai_observability/backend/api/models.py+++ b/products/ai_observability/backend/api/models.py@@ -21,7 +21,7 @@ class LLMModelInfoSerializer(serializers.Serializer):help_text="Provider-specific model identifier (e.g. 'gpt-4o-mini', 'claude-3-5-sonnet-20241022').")posthog_available = serializers.BooleanField(- help_text="Whether this model is available on PostHog's trial credits without bringing a provider key."+ help_text="True if the model can run without a provider key — for getting-started testing only; real evals should use the team's own key.")diff --git a/products/ai_observability/frontend/generated/api.schemas.ts b/products/ai_observability/frontend/generated/api.schemas.tsindex eaf6f62a0330..5d3d1ddd6fba 100644--- a/products/ai_observability/frontend/generated/api.schemas.ts+++ b/products/ai_observability/frontend/generated/api.schemas.ts@@ -413,7 +413,10 @@ export interface ModelConfigurationApi {provider: LLMProviderEnumApi/** @maxLength 100 */model: string- /** @nullable */+ /**+ * Team provider key to run this eval with (same provider as `provider`). Leave null only for brief pre-key testing; real evals should set it.+ * @nullable+ */provider_key_id?: string | null/** @nullable */readonly provider_key_name: string | null@@ -865,13 +868,13 @@ export interface LLMProviderKeyApi {}export interface EvaluationConfigApi {- /** Maximum number of llm_judge runs the team may execute on PostHog trial credits. */+ /** Cap on trial runs — a getting-started affordance only, not for ongoing evals (use the team's own key). */readonly trial_eval_limit: number- /** Number of llm_judge runs already consumed against the trial credit pool. */+ /** Trial runs consumed (getting-started affordance only). */readonly trial_evals_used: number- /** Number of trial evaluation runs remaining before the team must supply its own provider key. */+ /** Trial runs remaining — a getting-started affordance only; evals should use the team's own provider key. */readonly trial_evals_remaining: number- /** Provider key currently used to run llm_judge evaluations. Null when the team is on trial credits. */+ /** Provider key used to run llm_judge evals; null if none configured yet. */readonly active_provider_key: LLMProviderKeyApi | null/** Timestamp when the evaluation config row was created. */readonly created_at: string@@ -1143,7 +1146,7 @@ export interface EvaluationSummaryResponseApi {export interface LLMModelInfoApi {/** Provider-specific model identifier (e.g. 'gpt-4o-mini', 'claude-3-5-sonnet-20241022'). */id: string- /** Whether this model is available on PostHog's trial credits without bringing a provider key. */+ /** True if the model can run without a provider key — for getting-started testing only; real evals should use the team's own key. */posthog_available: boolean}diff --git a/products/ai_observability/frontend/generated/api.zod.ts b/products/ai_observability/frontend/generated/api.zod.tsindex 5c8860073875..d0dd858057c6 100644--- a/products/ai_observability/frontend/generated/api.zod.ts+++ b/products/ai_observability/frontend/generated/api.zod.ts@@ -214,7 +214,12 @@ export const EvaluationsCreateBody = /* @__PURE__ */ zod.object({'\* `openai` - Openai\n\* `anthropic` - Anthropic\n\* `gemini` - Gemini\n\* `openrouter` - Openrouter\n\* `fireworks` - Fireworks\n\* `azure_openai` - Azure OpenAI\n\* `together_ai` - Together AI'),model: zod.string().max(evaluationsCreateBodyModelConfigurationOneModelMax),- provider_key_id: zod.uuid().nullish(),+ provider_key_id: zod+ .uuid()+ .nullish()+ .describe(+ 'Team provider key to run this eval with (same provider as `provider`). Leave null only for brief pre-key testing; real evals should set it.'+ ),provider_key_name: zod.string().nullable(),}).describe('Nested serializer for model configuration.'),@@ -336,7 +341,12 @@ export const EvaluationsUpdateBody = /* @__PURE__ */ zod.object({'\* `openai` - Openai\n\* `anthropic` - Anthropic\n\* `gemini` - Gemini\n\* `openrouter` - Openrouter\n\* `fireworks` - Fireworks\n\* `azure_openai` - Azure OpenAI\n\* `together_ai` - Together AI'),model: zod.string().max(evaluationsUpdateBodyModelConfigurationOneModelMax),- provider_key_id: zod.uuid().nullish(),+ provider_key_id: zod+ .uuid()+ .nullish()+ .describe(+ 'Team provider key to run this eval with (same provider as `provider`). Leave null only for brief pre-key testing; real evals should set it.'+ ),provider_key_name: zod.string().nullable(),}).describe('Nested serializer for model configuration.'),@@ -460,7 +470,12 @@ export const EvaluationsPartialUpdateBody = /* @__PURE__ */ zod.object({'\* `openai` - Openai\n\* `anthropic` - Anthropic\n\* `gemini` - Gemini\n\* `openrouter` - Openrouter\n\* `fireworks` - Fireworks\n\* `azure_openai` - Azure OpenAI\n\* `together_ai` - Together AI'),model: zod.string().max(evaluationsPartialUpdateBodyModelConfigurationOneModelMax),- provider_key_id: zod.uuid().nullish(),+ provider_key_id: zod+ .uuid()+ .nullish()+ .describe(+ 'Team provider key to run this eval with (same provider as `provider`). Leave null only for brief pre-key testing; real evals should set it.'+ ),provider_key_name: zod.string().nullable(),}).describe('Nested serializer for model configuration.'),diff --git a/products/ai_observability/mcp/tools.yaml b/products/ai_observability/mcp/tools.yamlindex 4e874c188b51..6b28448a134e 100644--- a/products/ai_observability/mcp/tools.yaml+++ b/products/ai_observability/mcp/tools.yaml@@ -182,10 +182,9 @@ tools:idempotent: truetitle: Get evaluation configdescription: >- Retrieve the team's evaluation configuration, including the active LLM provider key used to run llm_judge- evaluations and remaining trial credits. Call this before creating an llm_judge evaluation to verify the- team has either trial credits available or an active provider key configured — without one, llm_judge runs- will fail. Returns trial limits, the active provider key (or null if on trial credits), and timestamps.+ Retrieve the team's evaluation config and active provider key. Call before creating an llm_judge eval to+ confirm a provider key is configured — evals should run on the team's own key. Returns the active key and+ timestamps.llma-evaluation-config-set-active-key:operation: llm_analytics_evaluation_config_set_active_key_createenabled: true@@ -212,11 +211,11 @@ tools:idempotent: falsetitle: Create evaluationdescription: >- Create a new AI observability evaluation. For 'llm_judge' type, provide evaluation_config.prompt and- model_configuration (provider + model). For 'hog' type, provide evaluation_config.source (Hog code returning- a boolean). For 'sentiment' type, use output_type='sentiment', omit model_configuration, and optionally set- evaluation_config.source='user_messages'. When enabled, the evaluation runs automatically on new- $ai_generation events. Results appear as '$ai_evaluation' events.+ Create an evaluation. 'llm_judge': set evaluation_config.prompt and model_configuration (provider + model ++ provider_key_id from llma-provider-key-list, preferring a provider the team already has a key for). 'hog':+ evaluation_config.source (Hog returning a boolean). 'sentiment': output_type='sentiment', omit+ model_configuration, optional evaluation_config.source='user_messages'. When enabled, runs on new+ $ai_generation events; results are '$ai_evaluation' events.llma-evaluation-delete:operation: evaluations_destroyenabled: true@@ -255,12 +254,10 @@ tools:idempotent: truetitle: List supported llm_judge modelsdescription: >- List the provider+model combinations supported for llm_judge evaluations. Pass a `provider` query parameter- (one of openai, anthropic, gemini, openrouter, fireworks, azure_openai) and optionally `key_id` to scope the- list to deployments reachable with a specific provider key (mainly relevant for azure_openai). Each entry- returns the model id and whether it is available on PostHog trial credits. Call this before creating an- llm_judge evaluation when the user has not specified a model, so a valid provider+model combination is- chosen.+ List provider+model combinations supported for llm_judge. Pass `provider` (openai, anthropic, gemini,+ openrouter, fireworks, azure_openai); optional `key_id` scopes to a key's reachable deployments (mainly+ azure_openai). Call before creating an llm_judge eval to pick a valid combo — prefer a provider the team+ already has a key for (see llma-provider-key-list).llma-evaluation-list:operation: evaluations_listenabled: truediff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex bb2b6ca348bf..75037d038385 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -4151,7 +4151,7 @@}},"llma-evaluation-config-get": {- "description": "Retrieve the team's evaluation configuration, including the active LLM provider key used to run llm_judge evaluations and remaining trial credits. Call this before creating an llm_judge evaluation to verify the team has either trial credits available or an active provider key configured — without one, llm_judge runs will fail. Returns trial limits, the active provider key (or null if on trial credits), and timestamps.",+ "description": "Retrieve the team's evaluation config and active provider key. Call before creating an llm_judge eval to confirm a provider key is configured — evals should run on the team's own key. Returns the active key and timestamps.","category": "AI observability","feature": "llm_analytics","summary": "Get evaluation config",@@ -4179,7 +4179,7 @@}},"llma-evaluation-create": {- "description": "Create a new AI observability evaluation. For 'llm_judge' type, provide evaluation_config.prompt and model_configuration (provider + model). For 'hog' type, provide evaluation_config.source (Hog code returning a boolean). For 'sentiment' type, use output_type='sentiment', omit model_configuration, and optionally set evaluation_config.source='user_messages'. When enabled, the evaluation runs automatically on new $ai_generation events. Results appear as '$ai_evaluation' events.",+ "description": "Create an evaluation. 'llm_judge': set evaluation_config.prompt and model_configuration (provider + model + provider_key_id from llma-provider-key-list, preferring a provider the team already has a key for). 'hog': evaluation_config.source (Hog returning a boolean). 'sentiment': output_type='sentiment', omit model_configuration, optional evaluation_config.source='user_messages'. When enabled, runs on new $ai_generation events; results are '$ai_evaluation' events.","category": "AI observability","feature": "llm_analytics","summary": "Create evaluation",@@ -4221,7 +4221,7 @@}},"llma-evaluation-judge-models": {- "description": "List the provider+model combinations supported for llm_judge evaluations. Pass a `provider` query parameter (one of openai, anthropic, gemini, openrouter, fireworks, azure_openai) and optionally `key_id` to scope the list to deployments reachable with a specific provider key (mainly relevant for azure_openai). Each entry returns the model id and whether it is available on PostHog trial credits. Call this before creating an llm_judge evaluation when the user has not specified a model, so a valid provider+model combination is chosen.",+ "description": "List provider+model combinations supported for llm_judge. Pass `provider` (openai, anthropic, gemini, openrouter, fireworks, azure_openai); optional `key_id` scopes to a key's reachable deployments (mainly azure_openai). Call before creating an llm_judge eval to pick a valid combo — prefer a provider the team already has a key for (see llma-provider-key-list).","category": "AI observability","feature": "llm_analytics","summary": "List supported llm_judge models",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex eb48266aa4cd..efa2dafdde73 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -4447,7 +4447,7 @@}},"llma-evaluation-config-get": {- "description": "Retrieve the team's evaluation configuration, including the active LLM provider key used to run llm_judge evaluations and remaining trial credits. Call this before creating an llm_judge evaluation to verify the team has either trial credits available or an active provider key configured — without one, llm_judge runs will fail. Returns trial limits, the active provider key (or null if on trial credits), and timestamps.",+ "description": "Retrieve the team's evaluation config and active provider key. Call before creating an llm_judge eval to confirm a provider key is configured — evals should run on the team's own key. Returns the active key and timestamps.","category": "AI observability","feature": "llm_analytics","summary": "Get evaluation config",@@ -4475,7 +4475,7 @@}},"llma-evaluation-create": {- "description": "Create a new AI observability evaluation. For 'llm_judge' type, provide evaluation_config.prompt and model_configuration (provider + model). For 'hog' type, provide evaluation_config.source (Hog code returning a boolean). For 'sentiment' type, use output_type='sentiment', omit model_configuration, and optionally set evaluation_config.source='user_messages'. When enabled, the evaluation runs automatically on new $ai_generation events. Results appear as '$ai_evaluation' events.",+ "description": "Create an evaluation. 'llm_judge': set evaluation_config.prompt and model_configuration (provider + model + provider_key_id from llma-provider-key-list, preferring a provider the team already has a key for). 'hog': evaluation_config.source (Hog returning a boolean). 'sentiment': output_type='sentiment', omit model_configuration, optional evaluation_config.source='user_messages'. When enabled, runs on new $ai_generation events; results are '$ai_evaluation' events.","category": "AI observability","feature": "llm_analytics","summary": "Create evaluation",@@ -4517,7 +4517,7 @@}},"llma-evaluation-judge-models": {- "description": "List the provider+model combinations supported for llm_judge evaluations. Pass a `provider` query parameter (one of openai, anthropic, gemini, openrouter, fireworks, azure_openai) and optionally `key_id` to scope the list to deployments reachable with a specific provider key (mainly relevant for azure_openai). Each entry returns the model id and whether it is available on PostHog trial credits. Call this before creating an llm_judge evaluation when the user has not specified a model, so a valid provider+model combination is chosen.",+ "description": "List provider+model combinations supported for llm_judge. Pass `provider` (openai, anthropic, gemini, openrouter, fireworks, azure_openai); optional `key_id` scopes to a key's reachable deployments (mainly azure_openai). Call before creating an llm_judge eval to pick a valid combo — prefer a provider the team already has a key for (see llma-provider-key-list).","category": "AI observability","feature": "llm_analytics","summary": "List supported llm_judge models",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 529663f2d634..c14d893180f2 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -20497,7 +20497,10 @@ export namespace Schemas {provider: LLMProviderEnum;/** @maxLength 100 */model: string;- /** @nullable */+ /**+ * Team provider key to run this eval with (same provider as `provider`). Leave null only for brief pre-key testing; real evals should set it.+ * @nullable+ */provider_key_id?: string | null;/** @nullable */readonly provider_key_name: string | null;@@ -20592,13 +20595,13 @@ export namespace Schemas {}export interface EvaluationConfig {- /** Maximum number of llm_judge runs the team may execute on PostHog trial credits. */+ /** Cap on trial runs — a getting-started affordance only, not for ongoing evals (use the team's own key). */readonly trial_eval_limit: number;- /** Number of llm_judge runs already consumed against the trial credit pool. */+ /** Trial runs consumed (getting-started affordance only). */readonly trial_evals_used: number;- /** Number of trial evaluation runs remaining before the team must supply its own provider key. */+ /** Trial runs remaining — a getting-started affordance only; evals should use the team's own provider key. */readonly trial_evals_remaining: number;- /** Provider key currently used to run llm_judge evaluations. Null when the team is on trial credits. */+ /** Provider key used to run llm_judge evals; null if none configured yet. */readonly active_provider_key: LLMProviderKey | null;/** Timestamp when the evaluation config row was created. */readonly created_at: string;@@ -27584,7 +27587,7 @@ export namespace Schemas {export interface LLMModelInfo {/** Provider-specific model identifier (e.g. 'gpt-4o-mini', 'claude-3-5-sonnet-20241022'). */id: string;- /** Whether this model is available on PostHog's trial credits without bringing a provider key. */+ /** True if the model can run without a provider key — for getting-started testing only; real evals should use the team's own key. */posthog_available: boolean;}diff --git a/services/mcp/src/generated/ai_observability/api.ts b/services/mcp/src/generated/ai_observability/api.tsindex dd3aa97efdc5..badacf64fc49 100644--- a/services/mcp/src/generated/ai_observability/api.ts+++ b/services/mcp/src/generated/ai_observability/api.ts@@ -235,7 +235,12 @@ export const EvaluationsCreateBody = /* @__PURE__ */ zod.object({'* `openai` - Openai\n* `anthropic` - Anthropic\n* `gemini` - Gemini\n* `openrouter` - Openrouter\n* `fireworks` - Fireworks\n* `azure_openai` - Azure OpenAI\n* `together_ai` - Together AI'),model: zod.string().max(evaluationsCreateBodyModelConfigurationOneModelMax),- provider_key_id: zod.uuid().nullish(),+ provider_key_id: zod+ .uuid()+ .nullish()+ .describe(+ 'Team provider key to run this eval with (same provider as `provider`). Leave null only for brief pre-key testing; real evals should set it.'+ ),provider_key_name: zod.string().nullish(),}).describe('Nested serializer for model configuration.'),@@ -377,7 +382,12 @@ export const EvaluationsPartialUpdateBody = /* @__PURE__ */ zod.object({'* `openai` - Openai\n* `anthropic` - Anthropic\n* `gemini` - Gemini\n* `openrouter` - Openrouter\n* `fireworks` - Fireworks\n* `azure_openai` - Azure OpenAI\n* `together_ai` - Together AI'),model: zod.string().max(evaluationsPartialUpdateBodyModelConfigurationOneModelMax),- provider_key_id: zod.uuid().nullish(),+ provider_key_id: zod+ .uuid()+ .nullish()+ .describe(+ 'Team provider key to run this eval with (same provider as `provider`). Leave null only for brief pre-key testing; real evals should set it.'+ ),provider_key_name: zod.string().nullish(),}).describe('Nested serializer for model configuration.'),diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-create.jsonindex 6ba584f9e216..689b7ec8d0cd 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-create.json@@ -122,7 +122,8 @@{"type": "null"}- ]+ ],+ "description": "Team provider key to run this eval with (same provider as `provider`). Leave null only for brief pre-key testing; real evals should set it."},"provider_key_name": {"anyOf": [diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-update.jsonindex f3a35c1a8b64..9ebb7c6d55f3 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-update.json@@ -126,7 +126,8 @@{"type": "null"}- ]+ ],+ "description": "Team provider key to run this eval with (same provider as `provider`). Leave null only for brief pre-key testing; real evals should set it."},"provider_key_name": {"anyOf": [