@iblai/iblai-api 4.6.2-dev1-ai-plus → 4.6.2-dev2-ai
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +696 -1667
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +696 -1666
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +696 -1667
- package/dist/index.umd.js.map +1 -1
- package/dist/types/index.d.ts +8 -39
- package/dist/types/models/BaseFinanceResponse.d.ts +37 -0
- package/dist/types/models/ComparisonInfo.d.ts +29 -0
- package/dist/types/models/FinanceDetailsResponse.d.ts +13 -0
- package/dist/types/models/FinanceFilters.d.ts +15 -0
- package/dist/types/models/MetricInfo.d.ts +5 -0
- package/dist/types/models/OvertimeData.d.ts +13 -0
- package/dist/types/models/PeriodInfo.d.ts +21 -0
- package/dist/types/services/AiAnalyticsService.d.ts +230 -0
- package/dist/types/services/AnalyticsService.d.ts +233 -0
- package/package.json +1 -1
- package/src/core/OpenAPI.ts +1 -1
- package/src/index.ts +8 -39
- package/src/models/BaseFinanceResponse.ts +42 -0
- package/src/models/ComparisonInfo.ts +34 -0
- package/src/models/FinanceDetailsResponse.ts +18 -0
- package/src/models/FinanceFilters.ts +20 -0
- package/src/models/{WebexWebhook.ts → MetricInfo.ts} +4 -3
- package/src/models/OvertimeData.ts +18 -0
- package/src/models/PeriodInfo.ts +26 -0
- package/src/services/AiAnalyticsService.ts +5305 -5000
- package/src/services/AnalyticsService.ts +314 -0
- package/dist/types/models/Bot.d.ts +0 -15
- package/dist/types/models/BotCommand.d.ts +0 -6
- package/dist/types/models/BotCreate.d.ts +0 -12
- package/dist/types/models/DataSet.d.ts +0 -21
- package/dist/types/models/DataSetCreate.d.ts +0 -12
- package/dist/types/models/DataSetStatusEnum.d.ts +0 -12
- package/dist/types/models/DiscordConfig.d.ts +0 -7
- package/dist/types/models/DiscordUserConfig.d.ts +0 -10
- package/dist/types/models/DiscordWebhook.d.ts +0 -6
- package/dist/types/models/PaginatedDataSetList.d.ts +0 -7
- package/dist/types/models/PaginatedTrainingList.d.ts +0 -7
- package/dist/types/models/PatchedBotCommand.d.ts +0 -6
- package/dist/types/models/PatchedBotCreate.d.ts +0 -12
- package/dist/types/models/PatchedDataSet.d.ts +0 -21
- package/dist/types/models/PatchedDiscordConfig.d.ts +0 -7
- package/dist/types/models/PatchedDiscordUserConfig.d.ts +0 -10
- package/dist/types/models/PatchedSlackConfig.d.ts +0 -8
- package/dist/types/models/PatchedSlackUserConfig.d.ts +0 -17
- package/dist/types/models/PatchedTeamsConfig.d.ts +0 -7
- package/dist/types/models/PatchedTrainingCreate.d.ts +0 -31
- package/dist/types/models/PatchedWebexConfig.d.ts +0 -10
- package/dist/types/models/PatchedWhatsappConfig.d.ts +0 -11
- package/dist/types/models/PatchedWhatsappUserConfig.d.ts +0 -10
- package/dist/types/models/Provider05cEnum.d.ts +0 -14
- package/dist/types/models/Provider63aEnum.d.ts +0 -6
- package/dist/types/models/SlackConfig.d.ts +0 -8
- package/dist/types/models/SlackUserConfig.d.ts +0 -17
- package/dist/types/models/SlackWebhook.d.ts +0 -6
- package/dist/types/models/TeamsConfig.d.ts +0 -7
- package/dist/types/models/TeamsWebhook.d.ts +0 -17
- package/dist/types/models/Training.d.ts +0 -41
- package/dist/types/models/TrainingCreate.d.ts +0 -31
- package/dist/types/models/WebexConfig.d.ts +0 -10
- package/dist/types/models/WebexWebhook.d.ts +0 -4
- package/dist/types/models/WhatAppWebHook.d.ts +0 -3
- package/dist/types/models/WhatsappConfig.d.ts +0 -11
- package/dist/types/models/WhatsappUserConfig.d.ts +0 -10
- package/dist/types/services/AiBotService.d.ts +0 -642
- package/dist/types/services/AiFinetuningService.d.ts +0 -232
- package/src/models/Bot.ts +0 -20
- package/src/models/BotCommand.ts +0 -11
- package/src/models/BotCreate.ts +0 -17
- package/src/models/DataSet.ts +0 -26
- package/src/models/DataSetCreate.ts +0 -17
- package/src/models/DataSetStatusEnum.ts +0 -16
- package/src/models/DiscordConfig.ts +0 -12
- package/src/models/DiscordUserConfig.ts +0 -15
- package/src/models/DiscordWebhook.ts +0 -11
- package/src/models/PaginatedDataSetList.ts +0 -12
- package/src/models/PaginatedTrainingList.ts +0 -12
- package/src/models/PatchedBotCommand.ts +0 -11
- package/src/models/PatchedBotCreate.ts +0 -17
- package/src/models/PatchedDataSet.ts +0 -26
- package/src/models/PatchedDiscordConfig.ts +0 -12
- package/src/models/PatchedDiscordUserConfig.ts +0 -15
- package/src/models/PatchedSlackConfig.ts +0 -13
- package/src/models/PatchedSlackUserConfig.ts +0 -22
- package/src/models/PatchedTeamsConfig.ts +0 -12
- package/src/models/PatchedTrainingCreate.ts +0 -36
- package/src/models/PatchedWebexConfig.ts +0 -15
- package/src/models/PatchedWhatsappConfig.ts +0 -16
- package/src/models/PatchedWhatsappUserConfig.ts +0 -15
- package/src/models/Provider05cEnum.ts +0 -18
- package/src/models/Provider63aEnum.ts +0 -10
- package/src/models/SlackConfig.ts +0 -13
- package/src/models/SlackUserConfig.ts +0 -22
- package/src/models/SlackWebhook.ts +0 -11
- package/src/models/TeamsConfig.ts +0 -12
- package/src/models/TeamsWebhook.ts +0 -22
- package/src/models/Training.ts +0 -46
- package/src/models/TrainingCreate.ts +0 -36
- package/src/models/WebexConfig.ts +0 -15
- package/src/models/WhatAppWebHook.ts +0 -8
- package/src/models/WhatsappConfig.ts +0 -16
- package/src/models/WhatsappUserConfig.ts +0 -15
- package/src/services/AiBotService.ts +0 -1330
- package/src/services/AiFinetuningService.ts +0 -472
|
@@ -5,6 +5,7 @@ import type { AnalyticsOverview } from '../models/AnalyticsOverview';
|
|
|
5
5
|
import type { Average } from '../models/Average';
|
|
6
6
|
import type { AverageOvertime } from '../models/AverageOvertime';
|
|
7
7
|
import type { AvgCourseGradeWithCutoff } from '../models/AvgCourseGradeWithCutoff';
|
|
8
|
+
import type { BaseFinanceResponse } from '../models/BaseFinanceResponse';
|
|
8
9
|
import type { ChatHistoryFilterData } from '../models/ChatHistoryFilterData';
|
|
9
10
|
import type { ConversationMessage } from '../models/ConversationMessage';
|
|
10
11
|
import type { Conversations } from '../models/Conversations';
|
|
@@ -21,6 +22,7 @@ import type { DetailedGradeView } from '../models/DetailedGradeView';
|
|
|
21
22
|
import type { EngagementPerCourse } from '../models/EngagementPerCourse';
|
|
22
23
|
import type { Enrollments } from '../models/Enrollments';
|
|
23
24
|
import type { EnrollmentsPerUser } from '../models/EnrollmentsPerUser';
|
|
25
|
+
import type { FinanceDetailsResponse } from '../models/FinanceDetailsResponse';
|
|
24
26
|
import type { GradingPerUser } from '../models/GradingPerUser';
|
|
25
27
|
import type { GroupList } from '../models/GroupList';
|
|
26
28
|
import type { LearnerInformationAPI } from '../models/LearnerInformationAPI';
|
|
@@ -3977,6 +3979,234 @@ export declare class AiAnalyticsService {
|
|
|
3977
3979
|
*/
|
|
3978
3980
|
startDate?: string;
|
|
3979
3981
|
}): CancelablePromise<GroupList>;
|
|
3982
|
+
/**
|
|
3983
|
+
* Financial Analytics API - Get comprehensive cost metrics with comparison analysis.
|
|
3984
|
+
*
|
|
3985
|
+
* This endpoint provides period-based cost analysis (not cumulative) with support for:
|
|
3986
|
+
* - Multiple time granularities and metrics
|
|
3987
|
+
* - Cross-dimensional filtering
|
|
3988
|
+
* - Percentage change vs comparison periods
|
|
3989
|
+
* - Forward-filled time series
|
|
3990
|
+
*
|
|
3991
|
+
* **Examples:**
|
|
3992
|
+
*
|
|
3993
|
+
* **Basic Weekly Costs:**
|
|
3994
|
+
* ```
|
|
3995
|
+
* GET /api/v2/analytics/financial/?metric=weekly_costs&comparison_days=10
|
|
3996
|
+
* ```
|
|
3997
|
+
*
|
|
3998
|
+
* **Platform & Mentor Filtered:**
|
|
3999
|
+
* ```
|
|
4000
|
+
* # Get total costs for a specific platform and mentor
|
|
4001
|
+
* GET /api/v2/analytics/financial/?metric=total_costs&platform_key=web-app&mentor_unique_id=mentor-123&comparison_days=14
|
|
4002
|
+
* ```
|
|
4003
|
+
*
|
|
4004
|
+
* **Monthly Costs by Provider:**
|
|
4005
|
+
* ```
|
|
4006
|
+
* GET /api/v2/analytics/financial/?metric=monthly_costs&provider=openai&granularity=month&comparison_days=30
|
|
4007
|
+
* ```
|
|
4008
|
+
*
|
|
4009
|
+
* **Daily Costs for Specific User:**
|
|
4010
|
+
* ```
|
|
4011
|
+
* GET /api/v2/analytics/financial/?metric=total_costs&username=user-456&granularity=day&start_date=2025-01-15&end_date=2025-01-21&comparison_days=7
|
|
4012
|
+
* ```
|
|
4013
|
+
*
|
|
4014
|
+
*
|
|
4015
|
+
* **Response Structure:**
|
|
4016
|
+
* ```json
|
|
4017
|
+
* {
|
|
4018
|
+
* "metric": "weekly_costs",
|
|
4019
|
+
* "value": 12.47,
|
|
4020
|
+
* "percentage_change": 8.5,
|
|
4021
|
+
* "overtime": [
|
|
4022
|
+
* {"date": "2025-01-06", "value": 2.89},
|
|
4023
|
+
* {"date": "2025-01-13", "value": 3.12}
|
|
4024
|
+
* ],
|
|
4025
|
+
* "period_info": {
|
|
4026
|
+
* "start_date": "2025-01-01",
|
|
4027
|
+
* "end_date": "2025-01-31",
|
|
4028
|
+
* "period_days": 31
|
|
4029
|
+
* },
|
|
4030
|
+
* "comparison_info": {
|
|
4031
|
+
* "previous_period_value": 11.50,
|
|
4032
|
+
* ...
|
|
4033
|
+
* }
|
|
4034
|
+
* }
|
|
4035
|
+
* ```
|
|
4036
|
+
* @returns BaseFinanceResponse Successful financial metrics response with period-based cost data
|
|
4037
|
+
* @throws ApiError
|
|
4038
|
+
*/
|
|
4039
|
+
static analyticsFinancialRetrieve({ metric, allTime, comparisonDays, endDate, fillMethod, granularity, llmModel, mentorUniqueId, platformKey, provider, showOvertime, startDate, username, }: {
|
|
4040
|
+
/**
|
|
4041
|
+
* Type of financial metric to retrieve
|
|
4042
|
+
*
|
|
4043
|
+
* * `total_costs` - Total costs for selected timeframe
|
|
4044
|
+
* * `weekly_costs` - Costs for current/selected week
|
|
4045
|
+
* * `monthly_costs` - Costs for current/selected month
|
|
4046
|
+
*/
|
|
4047
|
+
metric: 'total_costs' | 'weekly_costs' | 'monthly_costs';
|
|
4048
|
+
/**
|
|
4049
|
+
* calculate from platform inception (ignores date filters)
|
|
4050
|
+
*/
|
|
4051
|
+
allTime?: boolean;
|
|
4052
|
+
/**
|
|
4053
|
+
* Number of days for comparison period to calculate percentage change (e.g., 10 for 10-day comparison)
|
|
4054
|
+
*/
|
|
4055
|
+
comparisonDays?: number;
|
|
4056
|
+
/**
|
|
4057
|
+
* End date for analysis (YYYY-MM-DD). Defaults to today.
|
|
4058
|
+
*/
|
|
4059
|
+
endDate?: string;
|
|
4060
|
+
/**
|
|
4061
|
+
* Method for filling missing time periods in overtime data
|
|
4062
|
+
*
|
|
4063
|
+
* * `zero` - Fill missing periods with zero
|
|
4064
|
+
* * `previous` - Fill missing periods with previous value
|
|
4065
|
+
*/
|
|
4066
|
+
fillMethod?: 'zero' | 'previous';
|
|
4067
|
+
/**
|
|
4068
|
+
* Time granularity for overtime series data
|
|
4069
|
+
*
|
|
4070
|
+
* * `day` - Daily data points
|
|
4071
|
+
* * `week` - Weekly data points
|
|
4072
|
+
* * `month` - Monthly data points
|
|
4073
|
+
*/
|
|
4074
|
+
granularity?: 'day' | 'week' | 'month';
|
|
4075
|
+
/**
|
|
4076
|
+
* Filter by specific LLM model (e.g., gpt-4o, claude-3-5-sonnet)
|
|
4077
|
+
*/
|
|
4078
|
+
llmModel?: string;
|
|
4079
|
+
/**
|
|
4080
|
+
* Filter by specific mentor ID
|
|
4081
|
+
*/
|
|
4082
|
+
mentorUniqueId?: string;
|
|
4083
|
+
/**
|
|
4084
|
+
* Filter by specific platform key
|
|
4085
|
+
*/
|
|
4086
|
+
platformKey?: string;
|
|
4087
|
+
/**
|
|
4088
|
+
* Filter by AI provider
|
|
4089
|
+
*
|
|
4090
|
+
* * `openai` - OpenAI
|
|
4091
|
+
* * `anthropic` - Anthropic
|
|
4092
|
+
* * `azure` - Azure
|
|
4093
|
+
* * `google` - Google
|
|
4094
|
+
* * `meta` - Meta
|
|
4095
|
+
* * `other` - Other
|
|
4096
|
+
*/
|
|
4097
|
+
provider?: 'openai' | 'anthropic' | 'azure' | 'google' | 'meta' | 'other';
|
|
4098
|
+
/**
|
|
4099
|
+
* Whether to include overtime series data in response
|
|
4100
|
+
*/
|
|
4101
|
+
showOvertime?: boolean;
|
|
4102
|
+
/**
|
|
4103
|
+
* Start date for analysis (YYYY-MM-DD). Defaults to 30 days ago.
|
|
4104
|
+
*/
|
|
4105
|
+
startDate?: string;
|
|
4106
|
+
/**
|
|
4107
|
+
* Filter by specific username - returns costs for this user only
|
|
4108
|
+
*/
|
|
4109
|
+
username?: string;
|
|
4110
|
+
}): CancelablePromise<BaseFinanceResponse>;
|
|
4111
|
+
/**
|
|
4112
|
+
* Financial Details Analytics API – paginated cost tables with flexible grouping.
|
|
4113
|
+
*
|
|
4114
|
+
* This endpoint returns tabular cost metrics aggregated by the dimension
|
|
4115
|
+
* specified via the `group_by` query parameter. One or more KPI columns
|
|
4116
|
+
* can be requested through the comma-separated `metrics` list while
|
|
4117
|
+
* typical filters (date range, provider, platform_key, user, etc.) narrow the
|
|
4118
|
+
* dataset. Results are paginated with `page` / `limit`.
|
|
4119
|
+
*
|
|
4120
|
+
* **Required query parameters**
|
|
4121
|
+
* - group_by – provider | llm_model | username | user_id | date | session_id
|
|
4122
|
+
* - metrics – csv list of KPI names, e.g. total_cost, sessions, cost_per_session
|
|
4123
|
+
*
|
|
4124
|
+
* **Shared optional filters**
|
|
4125
|
+
* - start_date, end_date – ISO yyyy-mm-dd (ignored when all_time=true)
|
|
4126
|
+
* - platform_key – tenant isolation
|
|
4127
|
+
* - mentor_unique_id – filter to one mentor
|
|
4128
|
+
* - username / user_id – filter to a learner
|
|
4129
|
+
* - provider / llm_model – filter to LLM provider / model
|
|
4130
|
+
* - all_time – true → lifetime totals
|
|
4131
|
+
* - page (default 1), limit (default 50)
|
|
4132
|
+
*
|
|
4133
|
+
* **Examples**
|
|
4134
|
+
* --------
|
|
4135
|
+
* 1. Cost by provider for the last week
|
|
4136
|
+
* ```
|
|
4137
|
+
* GET /api/v2/analytics/financial/details?
|
|
4138
|
+
* group_by=provider&
|
|
4139
|
+
* metrics=total_cost&
|
|
4140
|
+
* start_date=2025-01-01&
|
|
4141
|
+
* end_date=2025-01-07&
|
|
4142
|
+
* page=1&limit=10
|
|
4143
|
+
* ```
|
|
4144
|
+
*
|
|
4145
|
+
* 2. Lifetime cost per user with extra KPIs
|
|
4146
|
+
* ```
|
|
4147
|
+
* GET /api/v2/analytics/financial/details?
|
|
4148
|
+
* group_by=username&
|
|
4149
|
+
* metrics=total_cost,sessions,cost_per_session&
|
|
4150
|
+
* all_time=true&page=1&limit=50
|
|
4151
|
+
* ```
|
|
4152
|
+
* 3. Cost by LLM model with tenant filter
|
|
4153
|
+
* ```
|
|
4154
|
+
* GET /api/v2/analytics/financial/details?
|
|
4155
|
+
* group_by=llm_model&
|
|
4156
|
+
* metrics=total_cost&
|
|
4157
|
+
* platform_key=web-app&
|
|
4158
|
+
* start_date=2025-01-01&end_date=2025-01-31
|
|
4159
|
+
* ```
|
|
4160
|
+
* Response structure
|
|
4161
|
+
* -------------------
|
|
4162
|
+
* ```
|
|
4163
|
+
* {
|
|
4164
|
+
* "page": 1,
|
|
4165
|
+
* "limit": 10,
|
|
4166
|
+
* "total_pages": 1,
|
|
4167
|
+
* "total_records": 3,
|
|
4168
|
+
* "rows": [
|
|
4169
|
+
* {"provider": "openai", "total_cost": 2.5},
|
|
4170
|
+
* {"provider": "anthropic", "total_cost": 1.0},
|
|
4171
|
+
* {"provider": "azure", "total_cost": 0.5}
|
|
4172
|
+
* ],
|
|
4173
|
+
* "metrics": [
|
|
4174
|
+
* {
|
|
4175
|
+
* "name": "total_cost",
|
|
4176
|
+
* "unit": "$",
|
|
4177
|
+
* "description": "Cost for this entity in period"
|
|
4178
|
+
* }
|
|
4179
|
+
* ],
|
|
4180
|
+
* "total_cost": 4.0 // optional grand-total when available
|
|
4181
|
+
* }
|
|
4182
|
+
* ``
|
|
4183
|
+
* @returns FinanceDetailsResponse
|
|
4184
|
+
* @throws ApiError
|
|
4185
|
+
*/
|
|
4186
|
+
static analyticsFinancialDetailsRetrieve({ groupBy, allTime, endDate, limit, llmModel, mentorUniqueId, metrics, page, platformKey, provider, startDate, username, }: {
|
|
4187
|
+
/**
|
|
4188
|
+
* Dimension to group by
|
|
4189
|
+
*
|
|
4190
|
+
* * `provider` - Group by provider
|
|
4191
|
+
* * `llm_model` - Group by LLM model
|
|
4192
|
+
* * `username` - Group by username
|
|
4193
|
+
*/
|
|
4194
|
+
groupBy: 'provider' | 'llm_model' | 'username';
|
|
4195
|
+
allTime?: boolean;
|
|
4196
|
+
endDate?: string;
|
|
4197
|
+
limit?: number;
|
|
4198
|
+
llmModel?: string;
|
|
4199
|
+
mentorUniqueId?: string;
|
|
4200
|
+
/**
|
|
4201
|
+
* Comma-separated list of metrics (e.g. total_cost,sessions, last_active)
|
|
4202
|
+
*/
|
|
4203
|
+
metrics?: string;
|
|
4204
|
+
page?: number;
|
|
4205
|
+
platformKey?: string;
|
|
4206
|
+
provider?: string;
|
|
4207
|
+
startDate?: string;
|
|
4208
|
+
username?: string;
|
|
4209
|
+
}): CancelablePromise<FinanceDetailsResponse>;
|
|
3980
4210
|
/**
|
|
3981
4211
|
* Update time spent tracking data from client-side events.
|
|
3982
4212
|
*
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import type { BaseFinanceResponse } from '../models/BaseFinanceResponse';
|
|
2
|
+
import type { FinanceDetailsResponse } from '../models/FinanceDetailsResponse';
|
|
3
|
+
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
4
|
+
export declare class AnalyticsService {
|
|
5
|
+
/**
|
|
6
|
+
* Financial Analytics API - Get comprehensive cost metrics with comparison analysis.
|
|
7
|
+
*
|
|
8
|
+
* This endpoint provides period-based cost analysis (not cumulative) with support for:
|
|
9
|
+
* - Multiple time granularities and metrics
|
|
10
|
+
* - Cross-dimensional filtering
|
|
11
|
+
* - Percentage change vs comparison periods
|
|
12
|
+
* - Forward-filled time series
|
|
13
|
+
*
|
|
14
|
+
* **Examples:**
|
|
15
|
+
*
|
|
16
|
+
* **Basic Weekly Costs:**
|
|
17
|
+
* ```
|
|
18
|
+
* GET /api/v2/analytics/financial/?metric=weekly_costs&comparison_days=10
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* **Platform & Mentor Filtered:**
|
|
22
|
+
* ```
|
|
23
|
+
* # Get total costs for a specific platform and mentor
|
|
24
|
+
* GET /api/v2/analytics/financial/?metric=total_costs&platform_key=web-app&mentor_unique_id=mentor-123&comparison_days=14
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* **Monthly Costs by Provider:**
|
|
28
|
+
* ```
|
|
29
|
+
* GET /api/v2/analytics/financial/?metric=monthly_costs&provider=openai&granularity=month&comparison_days=30
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* **Daily Costs for Specific User:**
|
|
33
|
+
* ```
|
|
34
|
+
* GET /api/v2/analytics/financial/?metric=total_costs&username=user-456&granularity=day&start_date=2025-01-15&end_date=2025-01-21&comparison_days=7
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
*
|
|
38
|
+
* **Response Structure:**
|
|
39
|
+
* ```json
|
|
40
|
+
* {
|
|
41
|
+
* "metric": "weekly_costs",
|
|
42
|
+
* "value": 12.47,
|
|
43
|
+
* "percentage_change": 8.5,
|
|
44
|
+
* "overtime": [
|
|
45
|
+
* {"date": "2025-01-06", "value": 2.89},
|
|
46
|
+
* {"date": "2025-01-13", "value": 3.12}
|
|
47
|
+
* ],
|
|
48
|
+
* "period_info": {
|
|
49
|
+
* "start_date": "2025-01-01",
|
|
50
|
+
* "end_date": "2025-01-31",
|
|
51
|
+
* "period_days": 31
|
|
52
|
+
* },
|
|
53
|
+
* "comparison_info": {
|
|
54
|
+
* "previous_period_value": 11.50,
|
|
55
|
+
* ...
|
|
56
|
+
* }
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
* @returns BaseFinanceResponse Successful financial metrics response with period-based cost data
|
|
60
|
+
* @throws ApiError
|
|
61
|
+
*/
|
|
62
|
+
static analyticsFinancialRetrieve({ metric, allTime, comparisonDays, endDate, fillMethod, granularity, llmModel, mentorUniqueId, platformKey, provider, showOvertime, startDate, username, }: {
|
|
63
|
+
/**
|
|
64
|
+
* Type of financial metric to retrieve
|
|
65
|
+
*
|
|
66
|
+
* * `total_costs` - Total costs for selected timeframe
|
|
67
|
+
* * `weekly_costs` - Costs for current/selected week
|
|
68
|
+
* * `monthly_costs` - Costs for current/selected month
|
|
69
|
+
*/
|
|
70
|
+
metric: 'total_costs' | 'weekly_costs' | 'monthly_costs';
|
|
71
|
+
/**
|
|
72
|
+
* calculate from platform inception (ignores date filters)
|
|
73
|
+
*/
|
|
74
|
+
allTime?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Number of days for comparison period to calculate percentage change (e.g., 10 for 10-day comparison)
|
|
77
|
+
*/
|
|
78
|
+
comparisonDays?: number;
|
|
79
|
+
/**
|
|
80
|
+
* End date for analysis (YYYY-MM-DD). Defaults to today.
|
|
81
|
+
*/
|
|
82
|
+
endDate?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Method for filling missing time periods in overtime data
|
|
85
|
+
*
|
|
86
|
+
* * `zero` - Fill missing periods with zero
|
|
87
|
+
* * `previous` - Fill missing periods with previous value
|
|
88
|
+
*/
|
|
89
|
+
fillMethod?: 'zero' | 'previous';
|
|
90
|
+
/**
|
|
91
|
+
* Time granularity for overtime series data
|
|
92
|
+
*
|
|
93
|
+
* * `day` - Daily data points
|
|
94
|
+
* * `week` - Weekly data points
|
|
95
|
+
* * `month` - Monthly data points
|
|
96
|
+
*/
|
|
97
|
+
granularity?: 'day' | 'week' | 'month';
|
|
98
|
+
/**
|
|
99
|
+
* Filter by specific LLM model (e.g., gpt-4o, claude-3-5-sonnet)
|
|
100
|
+
*/
|
|
101
|
+
llmModel?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Filter by specific mentor ID
|
|
104
|
+
*/
|
|
105
|
+
mentorUniqueId?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Filter by specific platform key
|
|
108
|
+
*/
|
|
109
|
+
platformKey?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Filter by AI provider
|
|
112
|
+
*
|
|
113
|
+
* * `openai` - OpenAI
|
|
114
|
+
* * `anthropic` - Anthropic
|
|
115
|
+
* * `azure` - Azure
|
|
116
|
+
* * `google` - Google
|
|
117
|
+
* * `meta` - Meta
|
|
118
|
+
* * `other` - Other
|
|
119
|
+
*/
|
|
120
|
+
provider?: 'openai' | 'anthropic' | 'azure' | 'google' | 'meta' | 'other';
|
|
121
|
+
/**
|
|
122
|
+
* Whether to include overtime series data in response
|
|
123
|
+
*/
|
|
124
|
+
showOvertime?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Start date for analysis (YYYY-MM-DD). Defaults to 30 days ago.
|
|
127
|
+
*/
|
|
128
|
+
startDate?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Filter by specific username - returns costs for this user only
|
|
131
|
+
*/
|
|
132
|
+
username?: string;
|
|
133
|
+
}): CancelablePromise<BaseFinanceResponse>;
|
|
134
|
+
/**
|
|
135
|
+
* Financial Details Analytics API – paginated cost tables with flexible grouping.
|
|
136
|
+
*
|
|
137
|
+
* This endpoint returns tabular cost metrics aggregated by the dimension
|
|
138
|
+
* specified via the `group_by` query parameter. One or more KPI columns
|
|
139
|
+
* can be requested through the comma-separated `metrics` list while
|
|
140
|
+
* typical filters (date range, provider, platform_key, user, etc.) narrow the
|
|
141
|
+
* dataset. Results are paginated with `page` / `limit`.
|
|
142
|
+
*
|
|
143
|
+
* **Required query parameters**
|
|
144
|
+
* - group_by – provider | llm_model | username | user_id | date | session_id
|
|
145
|
+
* - metrics – csv list of KPI names, e.g. total_cost, sessions, cost_per_session
|
|
146
|
+
*
|
|
147
|
+
* **Shared optional filters**
|
|
148
|
+
* - start_date, end_date – ISO yyyy-mm-dd (ignored when all_time=true)
|
|
149
|
+
* - platform_key – tenant isolation
|
|
150
|
+
* - mentor_unique_id – filter to one mentor
|
|
151
|
+
* - username / user_id – filter to a learner
|
|
152
|
+
* - provider / llm_model – filter to LLM provider / model
|
|
153
|
+
* - all_time – true → lifetime totals
|
|
154
|
+
* - page (default 1), limit (default 50)
|
|
155
|
+
*
|
|
156
|
+
* **Examples**
|
|
157
|
+
* --------
|
|
158
|
+
* 1. Cost by provider for the last week
|
|
159
|
+
* ```
|
|
160
|
+
* GET /api/v2/analytics/financial/details?
|
|
161
|
+
* group_by=provider&
|
|
162
|
+
* metrics=total_cost&
|
|
163
|
+
* start_date=2025-01-01&
|
|
164
|
+
* end_date=2025-01-07&
|
|
165
|
+
* page=1&limit=10
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* 2. Lifetime cost per user with extra KPIs
|
|
169
|
+
* ```
|
|
170
|
+
* GET /api/v2/analytics/financial/details?
|
|
171
|
+
* group_by=username&
|
|
172
|
+
* metrics=total_cost,sessions,cost_per_session&
|
|
173
|
+
* all_time=true&page=1&limit=50
|
|
174
|
+
* ```
|
|
175
|
+
* 3. Cost by LLM model with tenant filter
|
|
176
|
+
* ```
|
|
177
|
+
* GET /api/v2/analytics/financial/details?
|
|
178
|
+
* group_by=llm_model&
|
|
179
|
+
* metrics=total_cost&
|
|
180
|
+
* platform_key=web-app&
|
|
181
|
+
* start_date=2025-01-01&end_date=2025-01-31
|
|
182
|
+
* ```
|
|
183
|
+
* Response structure
|
|
184
|
+
* -------------------
|
|
185
|
+
* ```
|
|
186
|
+
* {
|
|
187
|
+
* "page": 1,
|
|
188
|
+
* "limit": 10,
|
|
189
|
+
* "total_pages": 1,
|
|
190
|
+
* "total_records": 3,
|
|
191
|
+
* "rows": [
|
|
192
|
+
* {"provider": "openai", "total_cost": 2.5},
|
|
193
|
+
* {"provider": "anthropic", "total_cost": 1.0},
|
|
194
|
+
* {"provider": "azure", "total_cost": 0.5}
|
|
195
|
+
* ],
|
|
196
|
+
* "metrics": [
|
|
197
|
+
* {
|
|
198
|
+
* "name": "total_cost",
|
|
199
|
+
* "unit": "$",
|
|
200
|
+
* "description": "Cost for this entity in period"
|
|
201
|
+
* }
|
|
202
|
+
* ],
|
|
203
|
+
* "total_cost": 4.0 // optional grand-total when available
|
|
204
|
+
* }
|
|
205
|
+
* ``
|
|
206
|
+
* @returns FinanceDetailsResponse
|
|
207
|
+
* @throws ApiError
|
|
208
|
+
*/
|
|
209
|
+
static analyticsFinancialDetailsRetrieve({ groupBy, allTime, endDate, limit, llmModel, mentorUniqueId, metrics, page, platformKey, provider, startDate, username, }: {
|
|
210
|
+
/**
|
|
211
|
+
* Dimension to group by
|
|
212
|
+
*
|
|
213
|
+
* * `provider` - Group by provider
|
|
214
|
+
* * `llm_model` - Group by LLM model
|
|
215
|
+
* * `username` - Group by username
|
|
216
|
+
*/
|
|
217
|
+
groupBy: 'provider' | 'llm_model' | 'username';
|
|
218
|
+
allTime?: boolean;
|
|
219
|
+
endDate?: string;
|
|
220
|
+
limit?: number;
|
|
221
|
+
llmModel?: string;
|
|
222
|
+
mentorUniqueId?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Comma-separated list of metrics (e.g. total_cost,sessions, last_active)
|
|
225
|
+
*/
|
|
226
|
+
metrics?: string;
|
|
227
|
+
page?: number;
|
|
228
|
+
platformKey?: string;
|
|
229
|
+
provider?: string;
|
|
230
|
+
startDate?: string;
|
|
231
|
+
username?: string;
|
|
232
|
+
}): CancelablePromise<FinanceDetailsResponse>;
|
|
233
|
+
}
|
package/package.json
CHANGED
package/src/core/OpenAPI.ts
CHANGED