Skip to content

Commit 922439a

Browse files
authored
Merge pull request #27 from ZoriHQ/release-please--branches--main--changes--next--components--zorihq
release: 0.21.0
2 parents a6ce067 + 0a0f1f5 commit 922439a

14 files changed

Lines changed: 470 additions & 7 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.20.0"
2+
".": "0.21.0"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 47
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/zorihq%2Fzoriapi-7e1ec42ddb33d95fb98aa302249071c3b5ef4087fb242f57be0928eb8b161354.yml
3-
openapi_spec_hash: fa440c6912192834484897bb1674c60e
4-
config_hash: 3f5e48e491b083b54610789873b94cc6
1+
configured_endpoints: 51
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/zorihq%2Fzoriapi-8a5ed6a51cb2f132ad9eeb1fc36b8bfefa11fd35954f62ef96ee02dc8b1f063d.yml
3+
openapi_spec_hash: 4e7112ed8d36d0cd080a75f90b7dd067
4+
config_hash: 852a355d70ade9bf524e82678f9a094c

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.21.0 (2025-12-06)
4+
5+
Full Changelog: [v0.20.0...v0.21.0](https://github.com/ZoriHQ/typescript-api-sdk/compare/v0.20.0...v0.21.0)
6+
7+
### Features
8+
9+
* **traces:** added llm traces endpoints ([f1074f7](https://github.com/ZoriHQ/typescript-api-sdk/commit/f1074f71a1dd3801c4df41417ebfd981b0c18754))
10+
311
## 0.20.0 (2025-12-06)
412

513
Full Changelog: [v0.19.1...v0.20.0](https://github.com/ZoriHQ/typescript-api-sdk/compare/v0.19.1...v0.20.0)

api.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ Types:
2929
- <code><a href="./src/resources/v1/analytics/analytics.ts">EventsOverTimeDataPoint</a></code>
3030
- <code><a href="./src/resources/v1/analytics/analytics.ts">ExitPagesData</a></code>
3131
- <code><a href="./src/resources/v1/analytics/analytics.ts">ExitPagesResponse</a></code>
32+
- <code><a href="./src/resources/v1/analytics/analytics.ts">LlmCostResponse</a></code>
33+
- <code><a href="./src/resources/v1/analytics/analytics.ts">LlmModelCostData</a></code>
34+
- <code><a href="./src/resources/v1/analytics/analytics.ts">LlmTopModelsCostResponse</a></code>
35+
- <code><a href="./src/resources/v1/analytics/analytics.ts">LlmTraceFilterOptionsResponse</a></code>
36+
- <code><a href="./src/resources/v1/analytics/analytics.ts">LlmTraceItem</a></code>
37+
- <code><a href="./src/resources/v1/analytics/analytics.ts">LlmTracesListResponse</a></code>
3238
- <code><a href="./src/resources/v1/analytics/analytics.ts">ManualIdentifyRequest</a></code>
3339
- <code><a href="./src/resources/v1/analytics/analytics.ts">ManualIdentifyResponse</a></code>
3440
- <code><a href="./src/resources/v1/analytics/analytics.ts">MauResponse</a></code>
@@ -75,6 +81,13 @@ Methods:
7581
- <code title="get /api/v1/analytics/events/filter-options">client.v1.analytics.events.<a href="./src/resources/v1/analytics/events.ts">filterOptions</a>({ ...params }) -> EventFilterOptionsResponse</code>
7682
- <code title="get /api/v1/analytics/events/recent">client.v1.analytics.events.<a href="./src/resources/v1/analytics/events.ts">recent</a>({ ...params }) -> RecentEventsResponse</code>
7783

84+
### Llm
85+
86+
Methods:
87+
88+
- <code title="get /api/v1/analytics/llm/traces">client.v1.analytics.llm.<a href="./src/resources/v1/analytics/llm.ts">traces</a>({ ...params }) -> LlmTracesListResponse</code>
89+
- <code title="get /api/v1/analytics/llm/traces/filter-options">client.v1.analytics.llm.<a href="./src/resources/v1/analytics/llm.ts">tracesFilterOptions</a>({ ...params }) -> LlmTraceFilterOptionsResponse</code>
90+
7891
### Tiles
7992

8093
Methods:
@@ -83,6 +96,8 @@ Methods:
8396
- <code title="get /api/v1/analytics/tiles/dau">client.v1.analytics.tiles.<a href="./src/resources/v1/analytics/tiles.ts">dau</a>({ ...params }) -> DauResponse</code>
8497
- <code title="get /api/v1/analytics/tiles/entry-pages">client.v1.analytics.tiles.<a href="./src/resources/v1/analytics/tiles.ts">entryPages</a>({ ...params }) -> EntryPagesResponse</code>
8598
- <code title="get /api/v1/analytics/tiles/exit-pages">client.v1.analytics.tiles.<a href="./src/resources/v1/analytics/tiles.ts">exitPages</a>({ ...params }) -> ExitPagesResponse</code>
99+
- <code title="get /api/v1/analytics/tiles/llm-cost">client.v1.analytics.tiles.<a href="./src/resources/v1/analytics/tiles.ts">llmCost</a>({ ...params }) -> LlmCostResponse</code>
100+
- <code title="get /api/v1/analytics/tiles/llm-top-models-cost">client.v1.analytics.tiles.<a href="./src/resources/v1/analytics/tiles.ts">llmTopModelsCost</a>({ ...params }) -> LlmTopModelsCostResponse</code>
86101
- <code title="get /api/v1/analytics/tiles/mau">client.v1.analytics.tiles.<a href="./src/resources/v1/analytics/tiles.ts">mau</a>({ ...params }) -> MauResponse</code>
87102
- <code title="get /api/v1/analytics/tiles/pages-per-session">client.v1.analytics.tiles.<a href="./src/resources/v1/analytics/tiles.ts">pagesPerSession</a>({ ...params }) -> PagesPerSessionResponse</code>
88103
- <code title="get /api/v1/analytics/tiles/return-rate">client.v1.analytics.tiles.<a href="./src/resources/v1/analytics/tiles.ts">returnRate</a>({ ...params }) -> ReturnRateResponse</code>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zorihq",
3-
"version": "0.20.0",
3+
"version": "0.21.0",
44
"description": "The official TypeScript library for the Zoriapi API",
55
"author": "Zoriapi <support@zorihq.com>",
66
"types": "dist/index.d.ts",

src/resources/v1/analytics/analytics.ts

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import { APIResource } from '../../../core/resource';
44
import * as EventsAPI from './events';
55
import { EventFilterOptionsParams, EventRecentParams, Events } from './events';
6+
import * as LlmAPI from './llm';
7+
import { Llm, LlmTracesFilterOptionsParams, LlmTracesParams } from './llm';
68
import * as RetentionAPI from './retention';
79
import { Retention, RetentionChurnRateParams, RetentionCohortsParams } from './retention';
810
import * 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';
4044
export 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+
160247
export interface ManualIdentifyRequest {
161248
project_id: string;
162249

@@ -547,6 +634,7 @@ export interface AnalyticsTimelineParams {
547634

548635
Analytics.Visitors = Visitors;
549636
Analytics.Events = Events;
637+
Analytics.Llm = Llm;
550638
Analytics.Tiles = Tiles;
551639
Analytics.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,

src/resources/v1/analytics/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ export {
1616
type EventsOverTimeDataPoint,
1717
type ExitPagesData,
1818
type ExitPagesResponse,
19+
type LlmCostResponse,
20+
type LlmModelCostData,
21+
type LlmTopModelsCostResponse,
22+
type LlmTraceFilterOptionsResponse,
23+
type LlmTraceItem,
24+
type LlmTracesListResponse,
1925
type ManualIdentifyRequest,
2026
type ManualIdentifyResponse,
2127
type MauResponse,
@@ -44,13 +50,16 @@ export {
4450
type AnalyticsTimelineParams,
4551
} from './analytics';
4652
export { Events, type EventFilterOptionsParams, type EventRecentParams } from './events';
53+
export { Llm, type LlmTracesParams, type LlmTracesFilterOptionsParams } from './llm';
4754
export { Retention, type RetentionChurnRateParams, type RetentionCohortsParams } from './retention';
4855
export {
4956
Tiles,
5057
type TileBounceRateParams,
5158
type TileDauParams,
5259
type TileEntryPagesParams,
5360
type TileExitPagesParams,
61+
type TileLlmCostParams,
62+
type TileLlmTopModelsCostParams,
5463
type TileMauParams,
5564
type TilePagesPerSessionParams,
5665
type TileReturnRateParams,

src/resources/v1/analytics/llm.ts

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../../../core/resource';
4+
import * as AnalyticsAPI from './analytics';
5+
import { APIPromise } from '../../../core/api-promise';
6+
import { RequestOptions } from '../../../internal/request-options';
7+
8+
export class Llm extends APIResource {
9+
/**
10+
* Get a paginated list of LLM traces with optional filters (name, user_id,
11+
* session_id, model)
12+
*
13+
* @example
14+
* ```ts
15+
* const llmTracesListResponse =
16+
* await client.v1.analytics.llm.traces({
17+
* project_id: 'project_id',
18+
* time_range: 'last_hour',
19+
* });
20+
* ```
21+
*/
22+
traces(query: LlmTracesParams, options?: RequestOptions): APIPromise<AnalyticsAPI.LlmTracesListResponse> {
23+
return this._client.get('/api/v1/analytics/llm/traces', { query, ...options });
24+
}
25+
26+
/**
27+
* Get unique names, user_ids, session_ids, and models to populate filter dropdowns
28+
*
29+
* @example
30+
* ```ts
31+
* const llmTraceFilterOptionsResponse =
32+
* await client.v1.analytics.llm.tracesFilterOptions({
33+
* project_id: 'project_id',
34+
* time_range: 'last_hour',
35+
* });
36+
* ```
37+
*/
38+
tracesFilterOptions(
39+
query: LlmTracesFilterOptionsParams,
40+
options?: RequestOptions,
41+
): APIPromise<AnalyticsAPI.LlmTraceFilterOptionsResponse> {
42+
return this._client.get('/api/v1/analytics/llm/traces/filter-options', { query, ...options });
43+
}
44+
}
45+
46+
export interface LlmTracesParams {
47+
project_id: string;
48+
49+
time_range: 'last_hour' | 'today' | 'yesterday' | 'last_7_days' | 'last_30_days' | 'last_90_days';
50+
51+
customer_id?: string;
52+
53+
limit?: number;
54+
55+
model?: string;
56+
57+
name?: string;
58+
59+
offset?: number;
60+
61+
referrer?: string;
62+
63+
session_id?: string;
64+
65+
user_id?: string;
66+
67+
utmtag?: string;
68+
69+
utmtagValue?: string;
70+
71+
visitor_id?: string;
72+
}
73+
74+
export interface LlmTracesFilterOptionsParams {
75+
project_id: string;
76+
77+
time_range: 'last_hour' | 'today' | 'yesterday' | 'last_7_days' | 'last_30_days' | 'last_90_days';
78+
79+
customer_id?: string;
80+
81+
limit?: number;
82+
83+
offset?: number;
84+
85+
referrer?: string;
86+
87+
utmtag?: string;
88+
89+
utmtagValue?: string;
90+
91+
visitor_id?: string;
92+
}
93+
94+
export declare namespace Llm {
95+
export {
96+
type LlmTracesParams as LlmTracesParams,
97+
type LlmTracesFilterOptionsParams as LlmTracesFilterOptionsParams,
98+
};
99+
}

0 commit comments

Comments
 (0)