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.
- package/README.md +132 -100
- package/dist/apis/AlertsApi.d.ts +1 -1
- package/dist/apis/AlertsApi.js +1 -1
- package/dist/apis/EventsApi.d.ts +1 -1
- package/dist/apis/EventsApi.js +1 -1
- package/dist/apis/MetricsApi.d.ts +24 -2
- package/dist/apis/MetricsApi.js +44 -2
- package/dist/apis/PricingApi.d.ts +1 -1
- package/dist/apis/PricingApi.js +1 -1
- package/dist/esm/apis/AlertsApi.d.ts +1 -1
- package/dist/esm/apis/AlertsApi.js +1 -1
- package/dist/esm/apis/EventsApi.d.ts +1 -1
- package/dist/esm/apis/EventsApi.js +1 -1
- package/dist/esm/apis/MetricsApi.d.ts +24 -2
- package/dist/esm/apis/MetricsApi.js +44 -2
- package/dist/esm/apis/PricingApi.d.ts +1 -1
- package/dist/esm/apis/PricingApi.js +1 -1
- package/dist/esm/models/Alert.d.ts +1 -1
- package/dist/esm/models/Alert.js +1 -1
- package/dist/esm/models/CostBreakdown.d.ts +44 -0
- package/dist/esm/models/CostBreakdown.js +45 -0
- package/dist/esm/models/CreateAlertRequest.d.ts +1 -1
- package/dist/esm/models/CreateAlertRequest.js +1 -1
- package/dist/esm/models/CreateEventRequest.d.ts +21 -2
- package/dist/esm/models/CreateEventRequest.js +13 -1
- package/dist/esm/models/ErrorResponse.d.ts +1 -1
- package/dist/esm/models/ErrorResponse.js +1 -1
- package/dist/esm/models/ErrorResponseError.d.ts +15 -2
- package/dist/esm/models/ErrorResponseError.js +13 -1
- package/dist/esm/models/Event.d.ts +4 -9
- package/dist/esm/models/Event.js +4 -5
- package/dist/esm/models/EventListResponse.d.ts +4 -15
- package/dist/esm/models/EventListResponse.js +4 -7
- package/dist/esm/models/EventResponse.d.ts +8 -1
- package/dist/esm/models/EventResponse.js +4 -1
- package/dist/esm/models/MetricPoint.d.ts +1 -1
- package/dist/esm/models/MetricPoint.js +1 -1
- package/dist/esm/models/MetricsResponse.d.ts +8 -1
- package/dist/esm/models/MetricsResponse.js +4 -1
- package/dist/esm/models/ModelPricing.d.ts +1 -1
- package/dist/esm/models/ModelPricing.js +1 -1
- package/dist/esm/models/PaginationMeta.d.ts +50 -0
- package/dist/esm/models/PaginationMeta.js +47 -0
- package/dist/esm/models/UsageRecord.d.ts +62 -0
- package/dist/esm/models/UsageRecord.js +51 -0
- package/dist/esm/models/UsageSummary.d.ts +108 -0
- package/dist/esm/models/UsageSummary.js +72 -0
- package/dist/esm/models/index.d.ts +4 -0
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/runtime.d.ts +1 -1
- package/dist/esm/runtime.js +1 -1
- package/dist/models/Alert.d.ts +1 -1
- package/dist/models/Alert.js +1 -1
- package/dist/models/CostBreakdown.d.ts +44 -0
- package/dist/models/CostBreakdown.js +52 -0
- package/dist/models/CreateAlertRequest.d.ts +1 -1
- package/dist/models/CreateAlertRequest.js +1 -1
- package/dist/models/CreateEventRequest.d.ts +21 -2
- package/dist/models/CreateEventRequest.js +14 -1
- package/dist/models/ErrorResponse.d.ts +1 -1
- package/dist/models/ErrorResponse.js +1 -1
- package/dist/models/ErrorResponseError.d.ts +15 -2
- package/dist/models/ErrorResponseError.js +14 -1
- package/dist/models/Event.d.ts +4 -9
- package/dist/models/Event.js +4 -5
- package/dist/models/EventListResponse.d.ts +4 -15
- package/dist/models/EventListResponse.js +4 -7
- package/dist/models/EventResponse.d.ts +8 -1
- package/dist/models/EventResponse.js +4 -1
- package/dist/models/MetricPoint.d.ts +1 -1
- package/dist/models/MetricPoint.js +1 -1
- package/dist/models/MetricsResponse.d.ts +8 -1
- package/dist/models/MetricsResponse.js +4 -1
- package/dist/models/ModelPricing.d.ts +1 -1
- package/dist/models/ModelPricing.js +1 -1
- package/dist/models/PaginationMeta.d.ts +50 -0
- package/dist/models/PaginationMeta.js +54 -0
- package/dist/models/UsageRecord.d.ts +62 -0
- package/dist/models/UsageRecord.js +58 -0
- package/dist/models/UsageSummary.d.ts +108 -0
- package/dist/models/UsageSummary.js +80 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +4 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/package.json +13 -20
- package/src/apis/AlertsApi.ts +1 -1
- package/src/apis/EventsApi.ts +1 -1
- package/src/apis/MetricsApi.ts +56 -1
- package/src/apis/PricingApi.ts +1 -1
- package/src/models/Alert.ts +1 -1
- package/src/models/CostBreakdown.ts +81 -0
- package/src/models/CreateAlertRequest.ts +1 -1
- package/src/models/CreateEventRequest.ts +24 -2
- package/src/models/ErrorResponse.ts +1 -1
- package/src/models/ErrorResponseError.ts +18 -2
- package/src/models/Event.ts +13 -13
- package/src/models/EventListResponse.ts +12 -21
- package/src/models/EventResponse.ts +17 -1
- package/src/models/MetricPoint.ts +1 -1
- package/src/models/MetricsResponse.ts +16 -1
- package/src/models/ModelPricing.ts +1 -1
- package/src/models/PaginationMeta.ts +89 -0
- package/src/models/UsageRecord.ts +105 -0
- package/src/models/UsageSummary.ts +173 -0
- package/src/models/index.ts +4 -0
- package/src/runtime.ts +1 -1
package/README.md
CHANGED
|
@@ -1,139 +1,171 @@
|
|
|
1
|
-
#
|
|
1
|
+
# LLM Cost Monitor - TypeScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official TypeScript/JavaScript SDK for [LLM Cost Monitor](https://github.com/check-ai/llm-cost-monitor).
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
First, install the SDK from npm.
|
|
5
|
+
## Installation
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
|
-
npm install
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
##
|
|
58
|
+
## API Reference
|
|
50
59
|
|
|
51
|
-
### API
|
|
60
|
+
### Events API
|
|
52
61
|
|
|
53
|
-
|
|
62
|
+
```typescript
|
|
63
|
+
import { EventsApi } from "llm-cost-monitor-sdk";
|
|
54
64
|
|
|
55
|
-
|
|
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
|
-
|
|
78
|
+
// List events
|
|
79
|
+
const eventList = await events.listEvents({
|
|
80
|
+
limit: 50,
|
|
81
|
+
from: new Date("2026-01-01"),
|
|
82
|
+
});
|
|
83
|
+
```
|
|
67
84
|
|
|
68
|
-
|
|
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
|
-
|
|
87
|
+
```typescript
|
|
88
|
+
import { MetricsApi } from "llm-cost-monitor-sdk";
|
|
81
89
|
|
|
90
|
+
const metrics = new MetricsApi(config);
|
|
82
91
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
89
|
-
- **API key parameter name**: `Authorization`
|
|
90
|
-
- **Location**: HTTP header
|
|
104
|
+
### Alerts API
|
|
91
105
|
|
|
92
|
-
|
|
106
|
+
```typescript
|
|
107
|
+
import { AlertsApi } from "llm-cost-monitor-sdk";
|
|
93
108
|
|
|
94
|
-
|
|
95
|
-
and is automatically generated by the
|
|
96
|
-
[OpenAPI Generator](https://openapi-generator.tech) project:
|
|
109
|
+
const alerts = new AlertsApi(config);
|
|
97
110
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
111
|
+
// Create alert
|
|
112
|
+
await alerts.createAlert({
|
|
113
|
+
createAlertRequest: {
|
|
114
|
+
threshold: 100.0,
|
|
115
|
+
windowInterval: "24h",
|
|
116
|
+
},
|
|
117
|
+
});
|
|
102
118
|
|
|
103
|
-
|
|
119
|
+
// List alerts
|
|
120
|
+
const alertList = await alerts.listAlerts();
|
|
104
121
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
128
|
+
```typescript
|
|
129
|
+
import { PricingApi } from "llm-cost-monitor-sdk";
|
|
118
130
|
|
|
119
|
-
|
|
131
|
+
const pricing = new PricingApi(config);
|
|
120
132
|
|
|
121
|
-
|
|
122
|
-
|
|
133
|
+
// List all pricing
|
|
134
|
+
const prices = await pricing.listPricing({});
|
|
123
135
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
136
|
+
// Filter by provider
|
|
137
|
+
const openaiPrices = await pricing.listPricing({
|
|
138
|
+
provider: "openai",
|
|
139
|
+
});
|
|
127
140
|
```
|
|
128
141
|
|
|
129
|
-
|
|
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
|
-
|
|
162
|
+
## Environment Variables
|
|
132
163
|
|
|
133
164
|
```bash
|
|
134
|
-
|
|
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
|
-
|
|
171
|
+
MIT
|
package/dist/apis/AlertsApi.d.ts
CHANGED
|
@@ -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:
|
|
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).
|
package/dist/apis/AlertsApi.js
CHANGED
|
@@ -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:
|
|
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).
|
package/dist/apis/EventsApi.d.ts
CHANGED
|
@@ -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:
|
|
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).
|
package/dist/apis/EventsApi.js
CHANGED
|
@@ -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:
|
|
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:
|
|
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];
|
package/dist/apis/MetricsApi.js
CHANGED
|
@@ -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:
|
|
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:
|
|
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).
|
package/dist/apis/PricingApi.js
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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).
|
package/dist/esm/models/Alert.js
CHANGED
|
@@ -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:
|
|
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).
|