33import { APIResource } from '../../../core/resource' ;
44import * as EventsAPI from './events' ;
55import { EventFilterOptionsParams , EventRecentParams , Events } from './events' ;
6+ import * as LlmAPI from './llm' ;
7+ import { Llm , LlmTracesFilterOptionsParams , LlmTracesParams } from './llm' ;
68import * as RetentionAPI from './retention' ;
79import { Retention , RetentionChurnRateParams , RetentionCohortsParams } from './retention' ;
810import * as TilesAPI from './tiles' ;
@@ -11,6 +13,8 @@ import {
1113 TileDauParams ,
1214 TileEntryPagesParams ,
1315 TileExitPagesParams ,
16+ TileLlmCostParams ,
17+ TileLlmTopModelsCostParams ,
1418 TileMauParams ,
1519 TilePagesPerSessionParams ,
1620 TileReturnRateParams ,
@@ -40,6 +44,7 @@ import { RequestOptions } from '../../../internal/request-options';
4044export class Analytics extends APIResource {
4145 visitors : VisitorsAPI . Visitors = new VisitorsAPI . Visitors ( this . _client ) ;
4246 events : EventsAPI . Events = new EventsAPI . Events ( this . _client ) ;
47+ llm : LlmAPI . Llm = new LlmAPI . Llm ( this . _client ) ;
4348 tiles : TilesAPI . Tiles = new TilesAPI . Tiles ( this . _client ) ;
4449 retention : RetentionAPI . Retention = new RetentionAPI . Retention ( this . _client ) ;
4550
@@ -157,6 +162,88 @@ export interface ExitPagesResponse {
157162 data ?: Array < ExitPagesData > ;
158163}
159164
165+ export interface LlmCostResponse {
166+ cost ?: number ;
167+
168+ previous_cost ?: number ;
169+ }
170+
171+ export interface LlmModelCostData {
172+ cost ?: number ;
173+
174+ model ?: string ;
175+
176+ previous_cost ?: number ;
177+ }
178+
179+ export interface LlmTopModelsCostResponse {
180+ data ?: Array < LlmModelCostData > ;
181+ }
182+
183+ export interface LlmTraceFilterOptionsResponse {
184+ models ?: Array < string > ;
185+
186+ names ?: Array < string > ;
187+
188+ session_ids ?: Array < string > ;
189+
190+ user_ids ?: Array < string > ;
191+ }
192+
193+ export interface LlmTraceItem {
194+ avg_latency_ms ?: number ;
195+
196+ created_at ?: string ;
197+
198+ generation_count ?: number ;
199+
200+ input ?: string ;
201+
202+ input_tokens ?: number ;
203+
204+ metadata ?: string ;
205+
206+ models ?: Array < string > ;
207+
208+ name ?: string ;
209+
210+ output ?: string ;
211+
212+ output_tokens ?: number ;
213+
214+ public ?: boolean ;
215+
216+ release ?: string ;
217+
218+ session_id ?: string ;
219+
220+ tags ?: Array < string > ;
221+
222+ timestamp ?: string ;
223+
224+ total_cost ?: number ;
225+
226+ total_tokens ?: number ;
227+
228+ trace_id ?: string ;
229+
230+ updated_at ?: string ;
231+
232+ user_id ?: string ;
233+
234+ version ?: string ;
235+ }
236+
237+ export interface LlmTracesListResponse {
238+ limit ?: number ;
239+
240+ offset ?: number ;
241+
242+ total ?: number ;
243+
244+ traces ?: Array < LlmTraceItem > ;
245+ }
246+
160247export interface ManualIdentifyRequest {
161248 project_id : string ;
162249
@@ -547,6 +634,7 @@ export interface AnalyticsTimelineParams {
547634
548635Analytics . Visitors = Visitors ;
549636Analytics . Events = Events ;
637+ Analytics . Llm = Llm ;
550638Analytics . Tiles = Tiles ;
551639Analytics . Retention = Retention ;
552640
@@ -566,6 +654,12 @@ export declare namespace Analytics {
566654 type EventsOverTimeDataPoint as EventsOverTimeDataPoint ,
567655 type ExitPagesData as ExitPagesData ,
568656 type ExitPagesResponse as ExitPagesResponse ,
657+ type LlmCostResponse as LlmCostResponse ,
658+ type LlmModelCostData as LlmModelCostData ,
659+ type LlmTopModelsCostResponse as LlmTopModelsCostResponse ,
660+ type LlmTraceFilterOptionsResponse as LlmTraceFilterOptionsResponse ,
661+ type LlmTraceItem as LlmTraceItem ,
662+ type LlmTracesListResponse as LlmTracesListResponse ,
569663 type ManualIdentifyRequest as ManualIdentifyRequest ,
570664 type ManualIdentifyResponse as ManualIdentifyResponse ,
571665 type MauResponse as MauResponse ,
@@ -608,12 +702,20 @@ export declare namespace Analytics {
608702 type EventRecentParams as EventRecentParams ,
609703 } ;
610704
705+ export {
706+ Llm as Llm ,
707+ type LlmTracesParams as LlmTracesParams ,
708+ type LlmTracesFilterOptionsParams as LlmTracesFilterOptionsParams ,
709+ } ;
710+
611711 export {
612712 Tiles as Tiles ,
613713 type TileBounceRateParams as TileBounceRateParams ,
614714 type TileDauParams as TileDauParams ,
615715 type TileEntryPagesParams as TileEntryPagesParams ,
616716 type TileExitPagesParams as TileExitPagesParams ,
717+ type TileLlmCostParams as TileLlmCostParams ,
718+ type TileLlmTopModelsCostParams as TileLlmTopModelsCostParams ,
617719 type TileMauParams as TileMauParams ,
618720 type TilePagesPerSessionParams as TilePagesPerSessionParams ,
619721 type TileReturnRateParams as TileReturnRateParams ,
0 commit comments