llm-cost-monitor-sdk 1.0.0 → 1.1.0

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.
Files changed (107) hide show
  1. package/README.md +132 -100
  2. package/dist/apis/AlertsApi.d.ts +1 -1
  3. package/dist/apis/AlertsApi.js +1 -1
  4. package/dist/apis/EventsApi.d.ts +1 -1
  5. package/dist/apis/EventsApi.js +1 -1
  6. package/dist/apis/MetricsApi.d.ts +24 -2
  7. package/dist/apis/MetricsApi.js +44 -2
  8. package/dist/apis/PricingApi.d.ts +1 -1
  9. package/dist/apis/PricingApi.js +1 -1
  10. package/dist/esm/apis/AlertsApi.d.ts +1 -1
  11. package/dist/esm/apis/AlertsApi.js +1 -1
  12. package/dist/esm/apis/EventsApi.d.ts +1 -1
  13. package/dist/esm/apis/EventsApi.js +1 -1
  14. package/dist/esm/apis/MetricsApi.d.ts +24 -2
  15. package/dist/esm/apis/MetricsApi.js +44 -2
  16. package/dist/esm/apis/PricingApi.d.ts +1 -1
  17. package/dist/esm/apis/PricingApi.js +1 -1
  18. package/dist/esm/models/Alert.d.ts +1 -1
  19. package/dist/esm/models/Alert.js +1 -1
  20. package/dist/esm/models/CostBreakdown.d.ts +44 -0
  21. package/dist/esm/models/CostBreakdown.js +45 -0
  22. package/dist/esm/models/CreateAlertRequest.d.ts +1 -1
  23. package/dist/esm/models/CreateAlertRequest.js +1 -1
  24. package/dist/esm/models/CreateEventRequest.d.ts +21 -2
  25. package/dist/esm/models/CreateEventRequest.js +13 -1
  26. package/dist/esm/models/ErrorResponse.d.ts +1 -1
  27. package/dist/esm/models/ErrorResponse.js +1 -1
  28. package/dist/esm/models/ErrorResponseError.d.ts +15 -2
  29. package/dist/esm/models/ErrorResponseError.js +13 -1
  30. package/dist/esm/models/Event.d.ts +4 -9
  31. package/dist/esm/models/Event.js +4 -5
  32. package/dist/esm/models/EventListResponse.d.ts +4 -15
  33. package/dist/esm/models/EventListResponse.js +4 -7
  34. package/dist/esm/models/EventResponse.d.ts +8 -1
  35. package/dist/esm/models/EventResponse.js +4 -1
  36. package/dist/esm/models/MetricPoint.d.ts +1 -1
  37. package/dist/esm/models/MetricPoint.js +1 -1
  38. package/dist/esm/models/MetricsResponse.d.ts +8 -1
  39. package/dist/esm/models/MetricsResponse.js +4 -1
  40. package/dist/esm/models/ModelPricing.d.ts +1 -1
  41. package/dist/esm/models/ModelPricing.js +1 -1
  42. package/dist/esm/models/PaginationMeta.d.ts +50 -0
  43. package/dist/esm/models/PaginationMeta.js +47 -0
  44. package/dist/esm/models/UsageRecord.d.ts +62 -0
  45. package/dist/esm/models/UsageRecord.js +51 -0
  46. package/dist/esm/models/UsageSummary.d.ts +108 -0
  47. package/dist/esm/models/UsageSummary.js +72 -0
  48. package/dist/esm/models/index.d.ts +4 -0
  49. package/dist/esm/models/index.js +4 -0
  50. package/dist/esm/runtime.d.ts +1 -1
  51. package/dist/esm/runtime.js +1 -1
  52. package/dist/models/Alert.d.ts +1 -1
  53. package/dist/models/Alert.js +1 -1
  54. package/dist/models/CostBreakdown.d.ts +44 -0
  55. package/dist/models/CostBreakdown.js +52 -0
  56. package/dist/models/CreateAlertRequest.d.ts +1 -1
  57. package/dist/models/CreateAlertRequest.js +1 -1
  58. package/dist/models/CreateEventRequest.d.ts +21 -2
  59. package/dist/models/CreateEventRequest.js +14 -1
  60. package/dist/models/ErrorResponse.d.ts +1 -1
  61. package/dist/models/ErrorResponse.js +1 -1
  62. package/dist/models/ErrorResponseError.d.ts +15 -2
  63. package/dist/models/ErrorResponseError.js +14 -1
  64. package/dist/models/Event.d.ts +4 -9
  65. package/dist/models/Event.js +4 -5
  66. package/dist/models/EventListResponse.d.ts +4 -15
  67. package/dist/models/EventListResponse.js +4 -7
  68. package/dist/models/EventResponse.d.ts +8 -1
  69. package/dist/models/EventResponse.js +4 -1
  70. package/dist/models/MetricPoint.d.ts +1 -1
  71. package/dist/models/MetricPoint.js +1 -1
  72. package/dist/models/MetricsResponse.d.ts +8 -1
  73. package/dist/models/MetricsResponse.js +4 -1
  74. package/dist/models/ModelPricing.d.ts +1 -1
  75. package/dist/models/ModelPricing.js +1 -1
  76. package/dist/models/PaginationMeta.d.ts +50 -0
  77. package/dist/models/PaginationMeta.js +54 -0
  78. package/dist/models/UsageRecord.d.ts +62 -0
  79. package/dist/models/UsageRecord.js +58 -0
  80. package/dist/models/UsageSummary.d.ts +108 -0
  81. package/dist/models/UsageSummary.js +80 -0
  82. package/dist/models/index.d.ts +4 -0
  83. package/dist/models/index.js +4 -0
  84. package/dist/runtime.d.ts +1 -1
  85. package/dist/runtime.js +1 -1
  86. package/package.json +13 -20
  87. package/src/apis/AlertsApi.ts +1 -1
  88. package/src/apis/EventsApi.ts +1 -1
  89. package/src/apis/MetricsApi.ts +56 -1
  90. package/src/apis/PricingApi.ts +1 -1
  91. package/src/models/Alert.ts +1 -1
  92. package/src/models/CostBreakdown.ts +81 -0
  93. package/src/models/CreateAlertRequest.ts +1 -1
  94. package/src/models/CreateEventRequest.ts +24 -2
  95. package/src/models/ErrorResponse.ts +1 -1
  96. package/src/models/ErrorResponseError.ts +18 -2
  97. package/src/models/Event.ts +13 -13
  98. package/src/models/EventListResponse.ts +12 -21
  99. package/src/models/EventResponse.ts +17 -1
  100. package/src/models/MetricPoint.ts +1 -1
  101. package/src/models/MetricsResponse.ts +16 -1
  102. package/src/models/ModelPricing.ts +1 -1
  103. package/src/models/PaginationMeta.ts +89 -0
  104. package/src/models/UsageRecord.ts +105 -0
  105. package/src/models/UsageSummary.ts +173 -0
  106. package/src/models/index.ts +4 -0
  107. package/src/runtime.ts +1 -1
package/README.md CHANGED
@@ -1,139 +1,171 @@
1
- # @llmcost/sdk@v1.0.0
1
+ # LLM Cost Monitor - TypeScript SDK
2
2
 
3
- A TypeScript SDK client for the localhost API.
3
+ Official TypeScript/JavaScript SDK for [LLM Cost Monitor](https://github.com/check-ai/llm-cost-monitor).
4
4
 
5
- ## Usage
6
-
7
- First, install the SDK from npm.
5
+ ## Installation
8
6
 
9
7
  ```bash
10
- npm install @llmcost/sdk --save
8
+ npm install llm-cost-monitor-sdk
9
+ # or
10
+ pnpm add llm-cost-monitor-sdk
11
+ # or
12
+ bun add llm-cost-monitor-sdk
11
13
  ```
12
14
 
13
- Next, try it out.
14
-
15
-
16
- ```ts
17
- import {
18
- Configuration,
19
- AlertsApi,
20
- } from '@llmcost/sdk';
21
- import type { CreateAlertOperationRequest } from '@llmcost/sdk';
22
-
23
- async function example() {
24
- console.log("🚀 Testing @llmcost/sdk SDK...");
25
- const config = new Configuration({
26
- // To configure API key authorization: ApiKeyAuth
27
- apiKey: "YOUR API KEY",
28
- });
29
- const api = new AlertsApi(config);
30
-
31
- const body = {
32
- // CreateAlertRequest
33
- createAlertRequest: {"threshold":100.0,"window_interval":"24h"},
34
- } satisfies CreateAlertOperationRequest;
35
-
36
- try {
37
- const data = await api.createAlert(body);
38
- console.log(data);
39
- } catch (error) {
40
- console.error(error);
41
- }
42
- }
43
-
44
- // Run the test
45
- example().catch(console.error);
15
+ ## Quick Start
16
+
17
+ ```typescript
18
+ import { Configuration, EventsApi } from "llm-cost-monitor-sdk";
19
+
20
+ const config = new Configuration({
21
+ basePath: "http://localhost:8080",
22
+ headers: {
23
+ Authorization: "Bearer YOUR_API_KEY",
24
+ },
25
+ });
26
+
27
+ const events = new EventsApi(config);
28
+
29
+ // Track an LLM usage event
30
+ const response = await events.createEvent({
31
+ createEventRequest: {
32
+ traceId: "unique-request-id",
33
+ provider: "openai",
34
+ model: "gpt-4o",
35
+ inputTokens: 1200,
36
+ outputTokens: 350,
37
+ feature: "chat",
38
+ userId: "user_123",
39
+ },
40
+ });
41
+
42
+ console.log(`Cost: $${response.costUsd}`);
46
43
  ```
47
44
 
45
+ ## Authentication
46
+
47
+ All API requests require an API key passed in the `Authorization` header:
48
+
49
+ ```typescript
50
+ const config = new Configuration({
51
+ basePath: process.env.LLM_COST_MONITOR_URL,
52
+ headers: {
53
+ Authorization: `Bearer ${process.env.LLM_COST_MONITOR_API_KEY}`,
54
+ },
55
+ });
56
+ ```
48
57
 
49
- ## Documentation
58
+ ## API Reference
50
59
 
51
- ### API Endpoints
60
+ ### Events API
52
61
 
53
- All URIs are relative to *http://localhost:8080*
62
+ ```typescript
63
+ import { EventsApi } from "llm-cost-monitor-sdk";
54
64
 
55
- | Class | Method | HTTP request | Description
56
- | ----- | ------ | ------------ | -------------
57
- *AlertsApi* | [**createAlert**](docs/AlertsApi.md#createalertoperation) | **POST** /v1/alerts | Create budget alert
58
- *AlertsApi* | [**deleteAlert**](docs/AlertsApi.md#deletealert) | **DELETE** /v1/alerts/{id} | Delete alert
59
- *AlertsApi* | [**listAlerts**](docs/AlertsApi.md#listalerts) | **GET** /v1/alerts | List budget alerts
60
- *EventsApi* | [**createEvent**](docs/EventsApi.md#createeventoperation) | **POST** /v1/events | Track LLM usage event
61
- *EventsApi* | [**listEvents**](docs/EventsApi.md#listevents) | **GET** /v1/events | List LLM usage events
62
- *MetricsApi* | [**getMetrics**](docs/MetricsApi.md#getmetrics) | **GET** /v1/metrics | Get aggregated metrics
63
- *PricingApi* | [**listPricing**](docs/PricingApi.md#listpricing) | **GET** /v1/pricing | List model pricing
65
+ const events = new EventsApi(config);
64
66
 
67
+ // Create event
68
+ const result = await events.createEvent({
69
+ createEventRequest: {
70
+ traceId: "req_abc123",
71
+ provider: "openai",
72
+ model: "gpt-4o",
73
+ inputTokens: 1200,
74
+ outputTokens: 350,
75
+ },
76
+ });
65
77
 
66
- ### Models
78
+ // List events
79
+ const eventList = await events.listEvents({
80
+ limit: 50,
81
+ from: new Date("2026-01-01"),
82
+ });
83
+ ```
67
84
 
68
- - [Alert](docs/Alert.md)
69
- - [CreateAlertRequest](docs/CreateAlertRequest.md)
70
- - [CreateEventRequest](docs/CreateEventRequest.md)
71
- - [ErrorResponse](docs/ErrorResponse.md)
72
- - [ErrorResponseError](docs/ErrorResponseError.md)
73
- - [Event](docs/Event.md)
74
- - [EventListResponse](docs/EventListResponse.md)
75
- - [EventResponse](docs/EventResponse.md)
76
- - [MetricPoint](docs/MetricPoint.md)
77
- - [MetricsResponse](docs/MetricsResponse.md)
78
- - [ModelPricing](docs/ModelPricing.md)
85
+ ### Metrics API
79
86
 
80
- ### Authorization
87
+ ```typescript
88
+ import { MetricsApi } from "llm-cost-monitor-sdk";
81
89
 
90
+ const metrics = new MetricsApi(config);
82
91
 
83
- Authentication schemes defined for the API:
84
- <a id="ApiKeyAuth"></a>
85
- #### ApiKeyAuth
92
+ // Get aggregated metrics
93
+ const data = await metrics.getMetrics({
94
+ period: "hour",
95
+ from: new Date("2026-01-01"),
96
+ });
86
97
 
98
+ // Get usage summary
99
+ const usage = await metrics.getUsage({
100
+ period: "month",
101
+ });
102
+ ```
87
103
 
88
- - **Type**: API key
89
- - **API key parameter name**: `Authorization`
90
- - **Location**: HTTP header
104
+ ### Alerts API
91
105
 
92
- ## About
106
+ ```typescript
107
+ import { AlertsApi } from "llm-cost-monitor-sdk";
93
108
 
94
- This TypeScript SDK client supports the [Fetch API](https://fetch.spec.whatwg.org/)
95
- and is automatically generated by the
96
- [OpenAPI Generator](https://openapi-generator.tech) project:
109
+ const alerts = new AlertsApi(config);
97
110
 
98
- - API version: `v1.0.0`
99
- - Package version: `v1.0.0`
100
- - Generator version: `7.18.0`
101
- - Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
111
+ // Create alert
112
+ await alerts.createAlert({
113
+ createAlertRequest: {
114
+ threshold: 100.0,
115
+ windowInterval: "24h",
116
+ },
117
+ });
102
118
 
103
- The generated npm module supports the following:
119
+ // List alerts
120
+ const alertList = await alerts.listAlerts();
104
121
 
105
- - Environments
106
- * Node.js
107
- * Webpack
108
- * Browserify
109
- - Language levels
110
- * ES5 - you must have a Promises/A+ library installed
111
- * ES6
112
- - Module systems
113
- * CommonJS
114
- * ES6 module system
122
+ // Delete alert
123
+ await alerts.deleteAlert({ id: "alert-uuid" });
124
+ ```
115
125
 
126
+ ### Pricing API
116
127
 
117
- ## Development
128
+ ```typescript
129
+ import { PricingApi } from "llm-cost-monitor-sdk";
118
130
 
119
- ### Building
131
+ const pricing = new PricingApi(config);
120
132
 
121
- To build the TypeScript source code, you need to have Node.js and npm installed.
122
- After cloning the repository, navigate to the project directory and run:
133
+ // List all pricing
134
+ const prices = await pricing.listPricing({});
123
135
 
124
- ```bash
125
- npm install
126
- npm run build
136
+ // Filter by provider
137
+ const openaiPrices = await pricing.listPricing({
138
+ provider: "openai",
139
+ });
127
140
  ```
128
141
 
129
- ### Publishing
142
+ ## Error Handling
143
+
144
+ ```typescript
145
+ import { ResponseError } from "llm-cost-monitor-sdk";
146
+
147
+ try {
148
+ await events.createEvent({ ... });
149
+ } catch (error) {
150
+ if (error instanceof ResponseError) {
151
+ const body = await error.response.json();
152
+ console.error(`Error ${body.error.code}: ${body.error.message}`);
153
+
154
+ // Handle specific errors
155
+ if (error.response.status === 402) {
156
+ console.error("Budget limit exceeded!");
157
+ }
158
+ }
159
+ }
160
+ ```
130
161
 
131
- Once you've built the package, you can publish it to npm:
162
+ ## Environment Variables
132
163
 
133
164
  ```bash
134
- npm publish
165
+ LLM_COST_MONITOR_URL=http://localhost:8080
166
+ LLM_COST_MONITOR_API_KEY=your-api-key
135
167
  ```
136
168
 
137
169
  ## License
138
170
 
139
- [MIT](https://opensource.org/licenses/MIT)
171
+ MIT
@@ -2,7 +2,7 @@
2
2
  * LLM Cost Monitor API
3
3
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
4
4
  *
5
- * The version of the OpenAPI document: v1.0.0
5
+ * The version of the OpenAPI document: 1.0.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -5,7 +5,7 @@
5
5
  * LLM Cost Monitor API
6
6
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
7
7
  *
8
- * The version of the OpenAPI document: v1.0.0
8
+ * The version of the OpenAPI document: 1.0.0
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -2,7 +2,7 @@
2
2
  * LLM Cost Monitor API
3
3
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
4
4
  *
5
- * The version of the OpenAPI document: v1.0.0
5
+ * The version of the OpenAPI document: 1.0.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -5,7 +5,7 @@
5
5
  * LLM Cost Monitor API
6
6
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
7
7
  *
8
- * The version of the OpenAPI document: v1.0.0
8
+ * The version of the OpenAPI document: 1.0.0
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -2,7 +2,7 @@
2
2
  * LLM Cost Monitor API
3
3
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
4
4
  *
5
- * The version of the OpenAPI document: v1.0.0
5
+ * The version of the OpenAPI document: 1.0.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -10,13 +10,16 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { MetricsResponse } from '../models/index';
13
+ import type { MetricsResponse, UsageSummary } from '../models/index';
14
14
  export interface GetMetricsRequest {
15
15
  period: GetMetricsPeriodEnum;
16
16
  from?: Date;
17
17
  to?: Date;
18
18
  groupBy?: GetMetricsGroupByEnum;
19
19
  }
20
+ export interface GetUsageRequest {
21
+ period?: GetUsagePeriodEnum;
22
+ }
20
23
  /**
21
24
  *
22
25
  */
@@ -31,6 +34,16 @@ export declare class MetricsApi extends runtime.BaseAPI {
31
34
  * Get aggregated metrics
32
35
  */
33
36
  getMetrics(requestParameters: GetMetricsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MetricsResponse>;
37
+ /**
38
+ * Returns usage summary with cost breakdown for the current period.
39
+ * Get usage summary
40
+ */
41
+ getUsageRaw(requestParameters: GetUsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UsageSummary>>;
42
+ /**
43
+ * Returns usage summary with cost breakdown for the current period.
44
+ * Get usage summary
45
+ */
46
+ getUsage(requestParameters?: GetUsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UsageSummary>;
34
47
  }
35
48
  /**
36
49
  * @export
@@ -50,3 +63,12 @@ export declare const GetMetricsGroupByEnum: {
50
63
  readonly UserId: "user_id";
51
64
  };
52
65
  export type GetMetricsGroupByEnum = typeof GetMetricsGroupByEnum[keyof typeof GetMetricsGroupByEnum];
66
+ /**
67
+ * @export
68
+ */
69
+ export declare const GetUsagePeriodEnum: {
70
+ readonly Day: "day";
71
+ readonly Week: "week";
72
+ readonly Month: "month";
73
+ };
74
+ export type GetUsagePeriodEnum = typeof GetUsagePeriodEnum[keyof typeof GetUsagePeriodEnum];
@@ -5,7 +5,7 @@
5
5
  * LLM Cost Monitor API
6
6
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
7
7
  *
8
- * The version of the OpenAPI document: v1.0.0
8
+ * The version of the OpenAPI document: 1.0.0
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -22,7 +22,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  });
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.GetMetricsGroupByEnum = exports.GetMetricsPeriodEnum = exports.MetricsApi = void 0;
25
+ exports.GetUsagePeriodEnum = exports.GetMetricsGroupByEnum = exports.GetMetricsPeriodEnum = exports.MetricsApi = void 0;
26
26
  const runtime = require("../runtime");
27
27
  const index_1 = require("../models/index");
28
28
  /**
@@ -75,6 +75,40 @@ class MetricsApi extends runtime.BaseAPI {
75
75
  return yield response.value();
76
76
  });
77
77
  }
78
+ /**
79
+ * Returns usage summary with cost breakdown for the current period.
80
+ * Get usage summary
81
+ */
82
+ getUsageRaw(requestParameters, initOverrides) {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ const queryParameters = {};
85
+ if (requestParameters['period'] != null) {
86
+ queryParameters['period'] = requestParameters['period'];
87
+ }
88
+ const headerParameters = {};
89
+ if (this.configuration && this.configuration.apiKey) {
90
+ headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
91
+ }
92
+ let urlPath = `/v1/usage`;
93
+ const response = yield this.request({
94
+ path: urlPath,
95
+ method: 'GET',
96
+ headers: headerParameters,
97
+ query: queryParameters,
98
+ }, initOverrides);
99
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.UsageSummaryFromJSON)(jsonValue));
100
+ });
101
+ }
102
+ /**
103
+ * Returns usage summary with cost breakdown for the current period.
104
+ * Get usage summary
105
+ */
106
+ getUsage() {
107
+ return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
108
+ const response = yield this.getUsageRaw(requestParameters, initOverrides);
109
+ return yield response.value();
110
+ });
111
+ }
78
112
  }
79
113
  exports.MetricsApi = MetricsApi;
80
114
  /**
@@ -93,3 +127,11 @@ exports.GetMetricsGroupByEnum = {
93
127
  Feature: 'feature',
94
128
  UserId: 'user_id'
95
129
  };
130
+ /**
131
+ * @export
132
+ */
133
+ exports.GetUsagePeriodEnum = {
134
+ Day: 'day',
135
+ Week: 'week',
136
+ Month: 'month'
137
+ };
@@ -2,7 +2,7 @@
2
2
  * LLM Cost Monitor API
3
3
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
4
4
  *
5
- * The version of the OpenAPI document: v1.0.0
5
+ * The version of the OpenAPI document: 1.0.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -5,7 +5,7 @@
5
5
  * LLM Cost Monitor API
6
6
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
7
7
  *
8
- * The version of the OpenAPI document: v1.0.0
8
+ * The version of the OpenAPI document: 1.0.0
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -2,7 +2,7 @@
2
2
  * LLM Cost Monitor API
3
3
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
4
4
  *
5
- * The version of the OpenAPI document: v1.0.0
5
+ * The version of the OpenAPI document: 1.0.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -4,7 +4,7 @@
4
4
  * LLM Cost Monitor API
5
5
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
6
6
  *
7
- * The version of the OpenAPI document: v1.0.0
7
+ * The version of the OpenAPI document: 1.0.0
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -2,7 +2,7 @@
2
2
  * LLM Cost Monitor API
3
3
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
4
4
  *
5
- * The version of the OpenAPI document: v1.0.0
5
+ * The version of the OpenAPI document: 1.0.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -4,7 +4,7 @@
4
4
  * LLM Cost Monitor API
5
5
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
6
6
  *
7
- * The version of the OpenAPI document: v1.0.0
7
+ * The version of the OpenAPI document: 1.0.0
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -2,7 +2,7 @@
2
2
  * LLM Cost Monitor API
3
3
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
4
4
  *
5
- * The version of the OpenAPI document: v1.0.0
5
+ * The version of the OpenAPI document: 1.0.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -10,13 +10,16 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { MetricsResponse } from '../models/index';
13
+ import type { MetricsResponse, UsageSummary } from '../models/index';
14
14
  export interface GetMetricsRequest {
15
15
  period: GetMetricsPeriodEnum;
16
16
  from?: Date;
17
17
  to?: Date;
18
18
  groupBy?: GetMetricsGroupByEnum;
19
19
  }
20
+ export interface GetUsageRequest {
21
+ period?: GetUsagePeriodEnum;
22
+ }
20
23
  /**
21
24
  *
22
25
  */
@@ -31,6 +34,16 @@ export declare class MetricsApi extends runtime.BaseAPI {
31
34
  * Get aggregated metrics
32
35
  */
33
36
  getMetrics(requestParameters: GetMetricsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MetricsResponse>;
37
+ /**
38
+ * Returns usage summary with cost breakdown for the current period.
39
+ * Get usage summary
40
+ */
41
+ getUsageRaw(requestParameters: GetUsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UsageSummary>>;
42
+ /**
43
+ * Returns usage summary with cost breakdown for the current period.
44
+ * Get usage summary
45
+ */
46
+ getUsage(requestParameters?: GetUsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UsageSummary>;
34
47
  }
35
48
  /**
36
49
  * @export
@@ -50,3 +63,12 @@ export declare const GetMetricsGroupByEnum: {
50
63
  readonly UserId: "user_id";
51
64
  };
52
65
  export type GetMetricsGroupByEnum = typeof GetMetricsGroupByEnum[keyof typeof GetMetricsGroupByEnum];
66
+ /**
67
+ * @export
68
+ */
69
+ export declare const GetUsagePeriodEnum: {
70
+ readonly Day: "day";
71
+ readonly Week: "week";
72
+ readonly Month: "month";
73
+ };
74
+ export type GetUsagePeriodEnum = typeof GetUsagePeriodEnum[keyof typeof GetUsagePeriodEnum];
@@ -4,7 +4,7 @@
4
4
  * LLM Cost Monitor API
5
5
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
6
6
  *
7
- * The version of the OpenAPI document: v1.0.0
7
+ * The version of the OpenAPI document: 1.0.0
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -21,7 +21,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
21
  });
22
22
  };
23
23
  import * as runtime from '../runtime';
24
- import { MetricsResponseFromJSON, } from '../models/index';
24
+ import { MetricsResponseFromJSON, UsageSummaryFromJSON, } from '../models/index';
25
25
  /**
26
26
  *
27
27
  */
@@ -72,6 +72,40 @@ export class MetricsApi extends runtime.BaseAPI {
72
72
  return yield response.value();
73
73
  });
74
74
  }
75
+ /**
76
+ * Returns usage summary with cost breakdown for the current period.
77
+ * Get usage summary
78
+ */
79
+ getUsageRaw(requestParameters, initOverrides) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const queryParameters = {};
82
+ if (requestParameters['period'] != null) {
83
+ queryParameters['period'] = requestParameters['period'];
84
+ }
85
+ const headerParameters = {};
86
+ if (this.configuration && this.configuration.apiKey) {
87
+ headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
88
+ }
89
+ let urlPath = `/v1/usage`;
90
+ const response = yield this.request({
91
+ path: urlPath,
92
+ method: 'GET',
93
+ headers: headerParameters,
94
+ query: queryParameters,
95
+ }, initOverrides);
96
+ return new runtime.JSONApiResponse(response, (jsonValue) => UsageSummaryFromJSON(jsonValue));
97
+ });
98
+ }
99
+ /**
100
+ * Returns usage summary with cost breakdown for the current period.
101
+ * Get usage summary
102
+ */
103
+ getUsage() {
104
+ return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
105
+ const response = yield this.getUsageRaw(requestParameters, initOverrides);
106
+ return yield response.value();
107
+ });
108
+ }
75
109
  }
76
110
  /**
77
111
  * @export
@@ -89,3 +123,11 @@ export const GetMetricsGroupByEnum = {
89
123
  Feature: 'feature',
90
124
  UserId: 'user_id'
91
125
  };
126
+ /**
127
+ * @export
128
+ */
129
+ export const GetUsagePeriodEnum = {
130
+ Day: 'day',
131
+ Week: 'week',
132
+ Month: 'month'
133
+ };
@@ -2,7 +2,7 @@
2
2
  * LLM Cost Monitor API
3
3
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
4
4
  *
5
- * The version of the OpenAPI document: v1.0.0
5
+ * The version of the OpenAPI document: 1.0.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -4,7 +4,7 @@
4
4
  * LLM Cost Monitor API
5
5
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
6
6
  *
7
- * The version of the OpenAPI document: v1.0.0
7
+ * The version of the OpenAPI document: 1.0.0
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -2,7 +2,7 @@
2
2
  * LLM Cost Monitor API
3
3
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
4
4
  *
5
- * The version of the OpenAPI document: v1.0.0
5
+ * The version of the OpenAPI document: 1.0.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -4,7 +4,7 @@
4
4
  * LLM Cost Monitor API
5
5
  * Open-source LLM cost observability platform API. Track, aggregate, and analyze LLM usage costs across your applications.
6
6
  *
7
- * The version of the OpenAPI document: v1.0.0
7
+ * The version of the OpenAPI document: 1.0.0
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).