Get prompt analytics
/v1/prompts/{slug}/analyticsGet prompt analytics.
Returns the requests attributed to the prompt in a time window (prompt completions, and other requests sent with x-prompt-slug): count, cost, latency and cache hit rate, in total and per version. Only the prompt's own organization's requests made with a virtual key or a routing config count. Requires membership of the prompt's workspace (organization admins have it). 404 when the prompt does not exist.
Authorization
AuthorizationBearer va_A platform API key (
va_...), created under Settings > API keys. Scoped to an organization or one workspace, with an admin or member role. Used by the management API.
Path parameters
slugstringrequiredthe prompt's slug
Query parameters
organizationstringrequiredslug of the organization that owns it
fromstring<date-time>start of the window (ISO 8601 date-time, inclusive). Default: 30 days before
totostring<date-time>end of the window (ISO 8601 date-time, exclusive). Default: now
Responses
prompt_slugstringSlug of the prompt.
time_window_startstring<date-time>Start of the window, inclusive (ISO 8601).
time_window_endstring<date-time>End of the window, exclusive (ISO 8601).
total_requestsinteger<int64>Requests in the window, across all versions.
total_cost_usdnumber<double>Total cost in USD across all versions. Requests answered from the cache cost 0.
avg_duration_msnumber<double>The mean of the versions' average request durations, in milliseconds: each version counts once, whatever its number of requests. 0 when there were no requests.
p95_duration_msnumber<double>The highest of the versions' 95th-percentile request durations, in milliseconds. Null when there were no requests.
cache_hit_ratenumber<double>The mean of the versions' cache hit rates, from 0 to 1: each version counts once. 0 when there were no requests.
by_versionobject[]Figures per version, highest version first.
Child attributes
version_numberinteger<int32>The prompt version. Null for requests attributed to the prompt without a version.
total_requestsinteger<int64>Requests in the window.
total_cost_usdnumber<double>Total cost in USD. Requests answered from the cache cost 0.
avg_duration_msnumber<double>Average request duration, in milliseconds.
p95_duration_msnumber<double>95th-percentile request duration, in milliseconds.
cache_hit_ratenumber<double>Share of requests answered from the cache (exact or semantic hit), from 0 to 1.