@athenaintel/sdk 4.3.2250 → 4.3.2251
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/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/workspaces/client/Client.d.ts +18 -0
- package/dist/cjs/api/resources/workspaces/client/Client.js +86 -0
- package/dist/cjs/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.d.ts +12 -0
- package/dist/cjs/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.js +3 -0
- package/dist/cjs/api/resources/workspaces/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/WorkspaceUsageComputerOut.d.ts +22 -0
- package/dist/cjs/api/types/WorkspaceUsageComputerOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageDayOut.d.ts +14 -0
- package/dist/cjs/api/types/WorkspaceUsageDayOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageResponseOut.d.ts +36 -0
- package/dist/cjs/api/types/WorkspaceUsageResponseOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageTokensOut.d.ts +17 -0
- package/dist/cjs/api/types/WorkspaceUsageTokensOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageUserOut.d.ts +22 -0
- package/dist/cjs/api/types/WorkspaceUsageUserOut.js +3 -0
- package/dist/cjs/api/types/index.d.ts +5 -0
- package/dist/cjs/api/types/index.js +5 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/workspaces/client/Client.d.mts +18 -0
- package/dist/esm/api/resources/workspaces/client/Client.mjs +86 -0
- package/dist/esm/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.d.mts +12 -0
- package/dist/esm/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.mjs +2 -0
- package/dist/esm/api/resources/workspaces/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/WorkspaceUsageComputerOut.d.mts +22 -0
- package/dist/esm/api/types/WorkspaceUsageComputerOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageDayOut.d.mts +14 -0
- package/dist/esm/api/types/WorkspaceUsageDayOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageResponseOut.d.mts +36 -0
- package/dist/esm/api/types/WorkspaceUsageResponseOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageTokensOut.d.mts +17 -0
- package/dist/esm/api/types/WorkspaceUsageTokensOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageUserOut.d.mts +22 -0
- package/dist/esm/api/types/WorkspaceUsageUserOut.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +5 -0
- package/dist/esm/api/types/index.mjs +5 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +66 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@athenaintel/sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "4.3.
|
|
47
|
-
"User-Agent": "@athenaintel/sdk/4.3.
|
|
46
|
+
"X-Fern-SDK-Version": "4.3.2251",
|
|
47
|
+
"User-Agent": "@athenaintel/sdk/4.3.2251",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
"X-Athena-Session-Credential": options === null || options === void 0 ? void 0 : options.sessionCredential,
|
|
@@ -140,4 +140,22 @@ export declare class WorkspacesClient {
|
|
|
140
140
|
*/
|
|
141
141
|
updateToolRegistry(request: AthenaIntelligence.UpdateWorkspaceToolRegistryRequestIn, requestOptions?: WorkspacesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.WorkspaceToolRegistryResponseOut>;
|
|
142
142
|
private __updateToolRegistry;
|
|
143
|
+
/**
|
|
144
|
+
* Aggregate LLM token usage (and cost) for one workspace over the last `days` days: workspace totals plus per-member, per-day and per-Computer breakdowns. Token counters are summed from each session's usage ledger; dry-run (test) sessions are reported separately and excluded from the totals. Requires workspace owner or manager (or Athena admin) permissions — the same gate as the in-app Usage page.
|
|
145
|
+
*
|
|
146
|
+
* @param {AthenaIntelligence.GetUsageWorkspacesRequest} request
|
|
147
|
+
* @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
148
|
+
*
|
|
149
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
150
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
151
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* await client.workspaces.getUsage({
|
|
155
|
+
* workspace_id: "workspace_id",
|
|
156
|
+
* days: 30
|
|
157
|
+
* })
|
|
158
|
+
*/
|
|
159
|
+
getUsage(request: AthenaIntelligence.GetUsageWorkspacesRequest, requestOptions?: WorkspacesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.WorkspaceUsageResponseOut>;
|
|
160
|
+
private __getUsage;
|
|
143
161
|
}
|
|
@@ -654,5 +654,91 @@ class WorkspacesClient {
|
|
|
654
654
|
}
|
|
655
655
|
});
|
|
656
656
|
}
|
|
657
|
+
/**
|
|
658
|
+
* Aggregate LLM token usage (and cost) for one workspace over the last `days` days: workspace totals plus per-member, per-day and per-Computer breakdowns. Token counters are summed from each session's usage ledger; dry-run (test) sessions are reported separately and excluded from the totals. Requires workspace owner or manager (or Athena admin) permissions — the same gate as the in-app Usage page.
|
|
659
|
+
*
|
|
660
|
+
* @param {AthenaIntelligence.GetUsageWorkspacesRequest} request
|
|
661
|
+
* @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
662
|
+
*
|
|
663
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
664
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
665
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* await client.workspaces.getUsage({
|
|
669
|
+
* workspace_id: "workspace_id",
|
|
670
|
+
* days: 30
|
|
671
|
+
* })
|
|
672
|
+
*/
|
|
673
|
+
getUsage(request, requestOptions) {
|
|
674
|
+
return core.HttpResponsePromise.fromPromise(this.__getUsage(request, requestOptions));
|
|
675
|
+
}
|
|
676
|
+
__getUsage(request, requestOptions) {
|
|
677
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
678
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
679
|
+
const { workspace_id: workspaceId, days } = request;
|
|
680
|
+
const _queryParams = {};
|
|
681
|
+
if (days != null) {
|
|
682
|
+
_queryParams.days = days.toString();
|
|
683
|
+
}
|
|
684
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
685
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
686
|
+
"X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
|
|
687
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
688
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
689
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/workspaces/${core.url.encodePathParam(workspaceId)}/usage`),
|
|
690
|
+
method: "GET",
|
|
691
|
+
headers: _headers,
|
|
692
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
693
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
694
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
695
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
696
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
697
|
+
logging: this._options.logging,
|
|
698
|
+
});
|
|
699
|
+
if (_response.ok) {
|
|
700
|
+
return {
|
|
701
|
+
data: _response.body,
|
|
702
|
+
rawResponse: _response.rawResponse,
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
if (_response.error.reason === "status-code") {
|
|
706
|
+
switch (_response.error.statusCode) {
|
|
707
|
+
case 403:
|
|
708
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
709
|
+
case 404:
|
|
710
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
711
|
+
case 422:
|
|
712
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
713
|
+
default:
|
|
714
|
+
throw new errors.AthenaIntelligenceError({
|
|
715
|
+
statusCode: _response.error.statusCode,
|
|
716
|
+
body: _response.error.body,
|
|
717
|
+
rawResponse: _response.rawResponse,
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
switch (_response.error.reason) {
|
|
722
|
+
case "non-json":
|
|
723
|
+
throw new errors.AthenaIntelligenceError({
|
|
724
|
+
statusCode: _response.error.statusCode,
|
|
725
|
+
body: _response.error.rawBody,
|
|
726
|
+
rawResponse: _response.rawResponse,
|
|
727
|
+
});
|
|
728
|
+
case "body-is-null":
|
|
729
|
+
throw new errors.AthenaIntelligenceError({
|
|
730
|
+
statusCode: _response.error.statusCode,
|
|
731
|
+
rawResponse: _response.rawResponse,
|
|
732
|
+
});
|
|
733
|
+
case "timeout":
|
|
734
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/workspaces/{workspace_id}/usage.");
|
|
735
|
+
case "unknown":
|
|
736
|
+
throw new errors.AthenaIntelligenceError({
|
|
737
|
+
message: _response.error.errorMessage,
|
|
738
|
+
rawResponse: _response.rawResponse,
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
}
|
|
657
743
|
}
|
|
658
744
|
exports.WorkspacesClient = WorkspacesClient;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { CreatePresenceTokenWorkspacesRequest } from "./CreatePresenceTokenWorkspacesRequest.js";
|
|
2
2
|
export type { GetConfigurationWorkspacesRequest } from "./GetConfigurationWorkspacesRequest.js";
|
|
3
3
|
export type { GetToolRegistryWorkspacesRequest } from "./GetToolRegistryWorkspacesRequest.js";
|
|
4
|
+
export type { GetUsageWorkspacesRequest } from "./GetUsageWorkspacesRequest.js";
|
|
4
5
|
export type { PresenceResolveRequestIn } from "./PresenceResolveRequestIn.js";
|
|
5
6
|
export type { SearchMembersWorkspacesRequest } from "./SearchMembersWorkspacesRequest.js";
|
|
6
7
|
export type { UpdateWorkspaceConfigurationRequestIn } from "./UpdateWorkspaceConfigurationRequestIn.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Usage attributed to one Computer asset over the window.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceUsageComputerOut {
|
|
6
|
+
/** The Computer asset ID */
|
|
7
|
+
computer_asset_id: string;
|
|
8
|
+
/** Whether the Computer is archived */
|
|
9
|
+
is_archived: boolean;
|
|
10
|
+
/** When the most recent usage session was created */
|
|
11
|
+
last_session_at?: string | null;
|
|
12
|
+
/** Number of successful model calls */
|
|
13
|
+
request_count: number;
|
|
14
|
+
/** Number of usage sessions */
|
|
15
|
+
session_count: number;
|
|
16
|
+
/** The Computer's title */
|
|
17
|
+
title?: string | null;
|
|
18
|
+
/** Token counters behind this Computer's usage */
|
|
19
|
+
tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
20
|
+
/** Total LLM cost in USD */
|
|
21
|
+
total_cost_usd: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Usage of the workspace on one UTC day.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceUsageDayOut {
|
|
6
|
+
/** Date in YYYY-MM-DD format (UTC) */
|
|
7
|
+
date: string;
|
|
8
|
+
/** Number of sessions created on the day */
|
|
9
|
+
session_count: number;
|
|
10
|
+
/** Token counters for the day */
|
|
11
|
+
tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
12
|
+
/** Total LLM cost in USD for the day */
|
|
13
|
+
total_cost_usd: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Aggregated LLM token and cost usage for one workspace.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceUsageResponseOut {
|
|
6
|
+
/** Users with at least one session */
|
|
7
|
+
active_users: number;
|
|
8
|
+
/** Portion of total_cost_usd produced by Computers */
|
|
9
|
+
computer_cost_usd: number;
|
|
10
|
+
/** Number of Computer usage sessions */
|
|
11
|
+
computer_sessions: number;
|
|
12
|
+
/** Portion of tokens produced by Computers' LLM usage (already included in tokens, never additive) */
|
|
13
|
+
computer_tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
14
|
+
/** Per-day breakdown, oldest first */
|
|
15
|
+
daily: AthenaIntelligence.WorkspaceUsageDayOut[];
|
|
16
|
+
/** Length of the reporting window in days */
|
|
17
|
+
days: number;
|
|
18
|
+
/** Cost of dry-run (test) sessions */
|
|
19
|
+
dry_run_cost_usd: number;
|
|
20
|
+
/** Number of dry-run (test) sessions */
|
|
21
|
+
dry_run_sessions: number;
|
|
22
|
+
/** Token counters from dry-run (test) sessions, excluded from tokens */
|
|
23
|
+
dry_run_tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
24
|
+
/** Per-Computer breakdown, highest cost first */
|
|
25
|
+
per_computer: AthenaIntelligence.WorkspaceUsageComputerOut[];
|
|
26
|
+
/** Per-member breakdown, highest cost first */
|
|
27
|
+
per_user: AthenaIntelligence.WorkspaceUsageUserOut[];
|
|
28
|
+
/** Token counters across the workspace's sessions in the window, excluding dry-run (test) sessions */
|
|
29
|
+
tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
30
|
+
/** Total LLM cost in USD */
|
|
31
|
+
total_cost_usd: number;
|
|
32
|
+
/** Number of sessions in the window */
|
|
33
|
+
total_sessions: number;
|
|
34
|
+
/** The workspace ID */
|
|
35
|
+
workspace_id: string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token counters summed from the sessions' LLM usage ledgers.
|
|
3
|
+
*/
|
|
4
|
+
export interface WorkspaceUsageTokensOut {
|
|
5
|
+
/** Input tokens written to the provider's prompt cache */
|
|
6
|
+
cache_creation_input_tokens: number;
|
|
7
|
+
/** Input tokens served from the provider's prompt cache */
|
|
8
|
+
cache_read_input_tokens: number;
|
|
9
|
+
/** Input (prompt) tokens, including cached reads */
|
|
10
|
+
input_tokens: number;
|
|
11
|
+
/** Output (completion) tokens, including reasoning tokens */
|
|
12
|
+
output_tokens: number;
|
|
13
|
+
/** Output tokens spent on reasoning */
|
|
14
|
+
reasoning_output_tokens: number;
|
|
15
|
+
/** Total tokens (input + output) */
|
|
16
|
+
total_tokens: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Usage of one workspace member over the window.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceUsageUserOut {
|
|
6
|
+
/** The user's email */
|
|
7
|
+
email: string;
|
|
8
|
+
/** First name */
|
|
9
|
+
first_name?: string | null;
|
|
10
|
+
/** Last name */
|
|
11
|
+
last_name?: string | null;
|
|
12
|
+
/** When the user's most recent session was created */
|
|
13
|
+
last_session_at?: string | null;
|
|
14
|
+
/** Number of sessions */
|
|
15
|
+
session_count: number;
|
|
16
|
+
/** Token counters across the user's sessions */
|
|
17
|
+
tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
18
|
+
/** Total LLM cost in USD */
|
|
19
|
+
total_cost_usd: number;
|
|
20
|
+
/** The user ID */
|
|
21
|
+
user_id: string;
|
|
22
|
+
}
|
|
@@ -168,4 +168,9 @@ export * from "./WorkspaceMemberSearchResponseOut.js";
|
|
|
168
168
|
export * from "./WorkspaceShareAccess.js";
|
|
169
169
|
export * from "./WorkspaceToolRegistryResponseOut.js";
|
|
170
170
|
export * from "./WorkspaceToolRegistryToolOut.js";
|
|
171
|
+
export * from "./WorkspaceUsageComputerOut.js";
|
|
172
|
+
export * from "./WorkspaceUsageDayOut.js";
|
|
173
|
+
export * from "./WorkspaceUsageResponseOut.js";
|
|
174
|
+
export * from "./WorkspaceUsageTokensOut.js";
|
|
175
|
+
export * from "./WorkspaceUsageUserOut.js";
|
|
171
176
|
export * from "./WrapStrategy.js";
|
|
@@ -184,4 +184,9 @@ __exportStar(require("./WorkspaceMemberSearchResponseOut.js"), exports);
|
|
|
184
184
|
__exportStar(require("./WorkspaceShareAccess.js"), exports);
|
|
185
185
|
__exportStar(require("./WorkspaceToolRegistryResponseOut.js"), exports);
|
|
186
186
|
__exportStar(require("./WorkspaceToolRegistryToolOut.js"), exports);
|
|
187
|
+
__exportStar(require("./WorkspaceUsageComputerOut.js"), exports);
|
|
188
|
+
__exportStar(require("./WorkspaceUsageDayOut.js"), exports);
|
|
189
|
+
__exportStar(require("./WorkspaceUsageResponseOut.js"), exports);
|
|
190
|
+
__exportStar(require("./WorkspaceUsageTokensOut.js"), exports);
|
|
191
|
+
__exportStar(require("./WorkspaceUsageUserOut.js"), exports);
|
|
187
192
|
__exportStar(require("./WrapStrategy.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "4.3.
|
|
1
|
+
export declare const SDK_VERSION = "4.3.2251";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "@athenaintel/sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "4.3.
|
|
10
|
-
"User-Agent": "@athenaintel/sdk/4.3.
|
|
9
|
+
"X-Fern-SDK-Version": "4.3.2251",
|
|
10
|
+
"User-Agent": "@athenaintel/sdk/4.3.2251",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
"X-Athena-Session-Credential": options === null || options === void 0 ? void 0 : options.sessionCredential,
|
|
@@ -140,4 +140,22 @@ export declare class WorkspacesClient {
|
|
|
140
140
|
*/
|
|
141
141
|
updateToolRegistry(request: AthenaIntelligence.UpdateWorkspaceToolRegistryRequestIn, requestOptions?: WorkspacesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.WorkspaceToolRegistryResponseOut>;
|
|
142
142
|
private __updateToolRegistry;
|
|
143
|
+
/**
|
|
144
|
+
* Aggregate LLM token usage (and cost) for one workspace over the last `days` days: workspace totals plus per-member, per-day and per-Computer breakdowns. Token counters are summed from each session's usage ledger; dry-run (test) sessions are reported separately and excluded from the totals. Requires workspace owner or manager (or Athena admin) permissions — the same gate as the in-app Usage page.
|
|
145
|
+
*
|
|
146
|
+
* @param {AthenaIntelligence.GetUsageWorkspacesRequest} request
|
|
147
|
+
* @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
148
|
+
*
|
|
149
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
150
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
151
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* await client.workspaces.getUsage({
|
|
155
|
+
* workspace_id: "workspace_id",
|
|
156
|
+
* days: 30
|
|
157
|
+
* })
|
|
158
|
+
*/
|
|
159
|
+
getUsage(request: AthenaIntelligence.GetUsageWorkspacesRequest, requestOptions?: WorkspacesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.WorkspaceUsageResponseOut>;
|
|
160
|
+
private __getUsage;
|
|
143
161
|
}
|
|
@@ -618,4 +618,90 @@ export class WorkspacesClient {
|
|
|
618
618
|
}
|
|
619
619
|
});
|
|
620
620
|
}
|
|
621
|
+
/**
|
|
622
|
+
* Aggregate LLM token usage (and cost) for one workspace over the last `days` days: workspace totals plus per-member, per-day and per-Computer breakdowns. Token counters are summed from each session's usage ledger; dry-run (test) sessions are reported separately and excluded from the totals. Requires workspace owner or manager (or Athena admin) permissions — the same gate as the in-app Usage page.
|
|
623
|
+
*
|
|
624
|
+
* @param {AthenaIntelligence.GetUsageWorkspacesRequest} request
|
|
625
|
+
* @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
626
|
+
*
|
|
627
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
628
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
629
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
630
|
+
*
|
|
631
|
+
* @example
|
|
632
|
+
* await client.workspaces.getUsage({
|
|
633
|
+
* workspace_id: "workspace_id",
|
|
634
|
+
* days: 30
|
|
635
|
+
* })
|
|
636
|
+
*/
|
|
637
|
+
getUsage(request, requestOptions) {
|
|
638
|
+
return core.HttpResponsePromise.fromPromise(this.__getUsage(request, requestOptions));
|
|
639
|
+
}
|
|
640
|
+
__getUsage(request, requestOptions) {
|
|
641
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
642
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
643
|
+
const { workspace_id: workspaceId, days } = request;
|
|
644
|
+
const _queryParams = {};
|
|
645
|
+
if (days != null) {
|
|
646
|
+
_queryParams.days = days.toString();
|
|
647
|
+
}
|
|
648
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
649
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
650
|
+
"X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
|
|
651
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
652
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
653
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/workspaces/${core.url.encodePathParam(workspaceId)}/usage`),
|
|
654
|
+
method: "GET",
|
|
655
|
+
headers: _headers,
|
|
656
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
657
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
658
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
659
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
660
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
661
|
+
logging: this._options.logging,
|
|
662
|
+
});
|
|
663
|
+
if (_response.ok) {
|
|
664
|
+
return {
|
|
665
|
+
data: _response.body,
|
|
666
|
+
rawResponse: _response.rawResponse,
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
if (_response.error.reason === "status-code") {
|
|
670
|
+
switch (_response.error.statusCode) {
|
|
671
|
+
case 403:
|
|
672
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
673
|
+
case 404:
|
|
674
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
675
|
+
case 422:
|
|
676
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
677
|
+
default:
|
|
678
|
+
throw new errors.AthenaIntelligenceError({
|
|
679
|
+
statusCode: _response.error.statusCode,
|
|
680
|
+
body: _response.error.body,
|
|
681
|
+
rawResponse: _response.rawResponse,
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
switch (_response.error.reason) {
|
|
686
|
+
case "non-json":
|
|
687
|
+
throw new errors.AthenaIntelligenceError({
|
|
688
|
+
statusCode: _response.error.statusCode,
|
|
689
|
+
body: _response.error.rawBody,
|
|
690
|
+
rawResponse: _response.rawResponse,
|
|
691
|
+
});
|
|
692
|
+
case "body-is-null":
|
|
693
|
+
throw new errors.AthenaIntelligenceError({
|
|
694
|
+
statusCode: _response.error.statusCode,
|
|
695
|
+
rawResponse: _response.rawResponse,
|
|
696
|
+
});
|
|
697
|
+
case "timeout":
|
|
698
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/workspaces/{workspace_id}/usage.");
|
|
699
|
+
case "unknown":
|
|
700
|
+
throw new errors.AthenaIntelligenceError({
|
|
701
|
+
message: _response.error.errorMessage,
|
|
702
|
+
rawResponse: _response.rawResponse,
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
}
|
|
621
707
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { CreatePresenceTokenWorkspacesRequest } from "./CreatePresenceTokenWorkspacesRequest.mjs";
|
|
2
2
|
export type { GetConfigurationWorkspacesRequest } from "./GetConfigurationWorkspacesRequest.mjs";
|
|
3
3
|
export type { GetToolRegistryWorkspacesRequest } from "./GetToolRegistryWorkspacesRequest.mjs";
|
|
4
|
+
export type { GetUsageWorkspacesRequest } from "./GetUsageWorkspacesRequest.mjs";
|
|
4
5
|
export type { PresenceResolveRequestIn } from "./PresenceResolveRequestIn.mjs";
|
|
5
6
|
export type { SearchMembersWorkspacesRequest } from "./SearchMembersWorkspacesRequest.mjs";
|
|
6
7
|
export type { UpdateWorkspaceConfigurationRequestIn } from "./UpdateWorkspaceConfigurationRequestIn.mjs";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Usage attributed to one Computer asset over the window.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceUsageComputerOut {
|
|
6
|
+
/** The Computer asset ID */
|
|
7
|
+
computer_asset_id: string;
|
|
8
|
+
/** Whether the Computer is archived */
|
|
9
|
+
is_archived: boolean;
|
|
10
|
+
/** When the most recent usage session was created */
|
|
11
|
+
last_session_at?: string | null;
|
|
12
|
+
/** Number of successful model calls */
|
|
13
|
+
request_count: number;
|
|
14
|
+
/** Number of usage sessions */
|
|
15
|
+
session_count: number;
|
|
16
|
+
/** The Computer's title */
|
|
17
|
+
title?: string | null;
|
|
18
|
+
/** Token counters behind this Computer's usage */
|
|
19
|
+
tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
20
|
+
/** Total LLM cost in USD */
|
|
21
|
+
total_cost_usd: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Usage of the workspace on one UTC day.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceUsageDayOut {
|
|
6
|
+
/** Date in YYYY-MM-DD format (UTC) */
|
|
7
|
+
date: string;
|
|
8
|
+
/** Number of sessions created on the day */
|
|
9
|
+
session_count: number;
|
|
10
|
+
/** Token counters for the day */
|
|
11
|
+
tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
12
|
+
/** Total LLM cost in USD for the day */
|
|
13
|
+
total_cost_usd: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Aggregated LLM token and cost usage for one workspace.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceUsageResponseOut {
|
|
6
|
+
/** Users with at least one session */
|
|
7
|
+
active_users: number;
|
|
8
|
+
/** Portion of total_cost_usd produced by Computers */
|
|
9
|
+
computer_cost_usd: number;
|
|
10
|
+
/** Number of Computer usage sessions */
|
|
11
|
+
computer_sessions: number;
|
|
12
|
+
/** Portion of tokens produced by Computers' LLM usage (already included in tokens, never additive) */
|
|
13
|
+
computer_tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
14
|
+
/** Per-day breakdown, oldest first */
|
|
15
|
+
daily: AthenaIntelligence.WorkspaceUsageDayOut[];
|
|
16
|
+
/** Length of the reporting window in days */
|
|
17
|
+
days: number;
|
|
18
|
+
/** Cost of dry-run (test) sessions */
|
|
19
|
+
dry_run_cost_usd: number;
|
|
20
|
+
/** Number of dry-run (test) sessions */
|
|
21
|
+
dry_run_sessions: number;
|
|
22
|
+
/** Token counters from dry-run (test) sessions, excluded from tokens */
|
|
23
|
+
dry_run_tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
24
|
+
/** Per-Computer breakdown, highest cost first */
|
|
25
|
+
per_computer: AthenaIntelligence.WorkspaceUsageComputerOut[];
|
|
26
|
+
/** Per-member breakdown, highest cost first */
|
|
27
|
+
per_user: AthenaIntelligence.WorkspaceUsageUserOut[];
|
|
28
|
+
/** Token counters across the workspace's sessions in the window, excluding dry-run (test) sessions */
|
|
29
|
+
tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
30
|
+
/** Total LLM cost in USD */
|
|
31
|
+
total_cost_usd: number;
|
|
32
|
+
/** Number of sessions in the window */
|
|
33
|
+
total_sessions: number;
|
|
34
|
+
/** The workspace ID */
|
|
35
|
+
workspace_id: string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token counters summed from the sessions' LLM usage ledgers.
|
|
3
|
+
*/
|
|
4
|
+
export interface WorkspaceUsageTokensOut {
|
|
5
|
+
/** Input tokens written to the provider's prompt cache */
|
|
6
|
+
cache_creation_input_tokens: number;
|
|
7
|
+
/** Input tokens served from the provider's prompt cache */
|
|
8
|
+
cache_read_input_tokens: number;
|
|
9
|
+
/** Input (prompt) tokens, including cached reads */
|
|
10
|
+
input_tokens: number;
|
|
11
|
+
/** Output (completion) tokens, including reasoning tokens */
|
|
12
|
+
output_tokens: number;
|
|
13
|
+
/** Output tokens spent on reasoning */
|
|
14
|
+
reasoning_output_tokens: number;
|
|
15
|
+
/** Total tokens (input + output) */
|
|
16
|
+
total_tokens: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Usage of one workspace member over the window.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceUsageUserOut {
|
|
6
|
+
/** The user's email */
|
|
7
|
+
email: string;
|
|
8
|
+
/** First name */
|
|
9
|
+
first_name?: string | null;
|
|
10
|
+
/** Last name */
|
|
11
|
+
last_name?: string | null;
|
|
12
|
+
/** When the user's most recent session was created */
|
|
13
|
+
last_session_at?: string | null;
|
|
14
|
+
/** Number of sessions */
|
|
15
|
+
session_count: number;
|
|
16
|
+
/** Token counters across the user's sessions */
|
|
17
|
+
tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
18
|
+
/** Total LLM cost in USD */
|
|
19
|
+
total_cost_usd: number;
|
|
20
|
+
/** The user ID */
|
|
21
|
+
user_id: string;
|
|
22
|
+
}
|
|
@@ -168,4 +168,9 @@ export * from "./WorkspaceMemberSearchResponseOut.mjs";
|
|
|
168
168
|
export * from "./WorkspaceShareAccess.mjs";
|
|
169
169
|
export * from "./WorkspaceToolRegistryResponseOut.mjs";
|
|
170
170
|
export * from "./WorkspaceToolRegistryToolOut.mjs";
|
|
171
|
+
export * from "./WorkspaceUsageComputerOut.mjs";
|
|
172
|
+
export * from "./WorkspaceUsageDayOut.mjs";
|
|
173
|
+
export * from "./WorkspaceUsageResponseOut.mjs";
|
|
174
|
+
export * from "./WorkspaceUsageTokensOut.mjs";
|
|
175
|
+
export * from "./WorkspaceUsageUserOut.mjs";
|
|
171
176
|
export * from "./WrapStrategy.mjs";
|
|
@@ -168,4 +168,9 @@ export * from "./WorkspaceMemberSearchResponseOut.mjs";
|
|
|
168
168
|
export * from "./WorkspaceShareAccess.mjs";
|
|
169
169
|
export * from "./WorkspaceToolRegistryResponseOut.mjs";
|
|
170
170
|
export * from "./WorkspaceToolRegistryToolOut.mjs";
|
|
171
|
+
export * from "./WorkspaceUsageComputerOut.mjs";
|
|
172
|
+
export * from "./WorkspaceUsageDayOut.mjs";
|
|
173
|
+
export * from "./WorkspaceUsageResponseOut.mjs";
|
|
174
|
+
export * from "./WorkspaceUsageTokensOut.mjs";
|
|
175
|
+
export * from "./WorkspaceUsageUserOut.mjs";
|
|
171
176
|
export * from "./WrapStrategy.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "4.3.
|
|
1
|
+
export declare const SDK_VERSION = "4.3.2251";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "4.3.
|
|
1
|
+
export const SDK_VERSION = "4.3.2251";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -5847,6 +5847,72 @@ await client.workspaces.updateToolRegistry({
|
|
|
5847
5847
|
</dl>
|
|
5848
5848
|
|
|
5849
5849
|
|
|
5850
|
+
</dd>
|
|
5851
|
+
</dl>
|
|
5852
|
+
</details>
|
|
5853
|
+
|
|
5854
|
+
<details><summary><code>client.workspaces.<a href="/src/api/resources/workspaces/client/Client.ts">getUsage</a>({ ...params }) -> AthenaIntelligence.WorkspaceUsageResponseOut</code></summary>
|
|
5855
|
+
<dl>
|
|
5856
|
+
<dd>
|
|
5857
|
+
|
|
5858
|
+
#### 📝 Description
|
|
5859
|
+
|
|
5860
|
+
<dl>
|
|
5861
|
+
<dd>
|
|
5862
|
+
|
|
5863
|
+
<dl>
|
|
5864
|
+
<dd>
|
|
5865
|
+
|
|
5866
|
+
Aggregate LLM token usage (and cost) for one workspace over the last `days` days: workspace totals plus per-member, per-day and per-Computer breakdowns. Token counters are summed from each session's usage ledger; dry-run (test) sessions are reported separately and excluded from the totals. Requires workspace owner or manager (or Athena admin) permissions — the same gate as the in-app Usage page.
|
|
5867
|
+
</dd>
|
|
5868
|
+
</dl>
|
|
5869
|
+
</dd>
|
|
5870
|
+
</dl>
|
|
5871
|
+
|
|
5872
|
+
#### 🔌 Usage
|
|
5873
|
+
|
|
5874
|
+
<dl>
|
|
5875
|
+
<dd>
|
|
5876
|
+
|
|
5877
|
+
<dl>
|
|
5878
|
+
<dd>
|
|
5879
|
+
|
|
5880
|
+
```typescript
|
|
5881
|
+
await client.workspaces.getUsage({
|
|
5882
|
+
workspace_id: "workspace_id",
|
|
5883
|
+
days: 30
|
|
5884
|
+
});
|
|
5885
|
+
|
|
5886
|
+
```
|
|
5887
|
+
</dd>
|
|
5888
|
+
</dl>
|
|
5889
|
+
</dd>
|
|
5890
|
+
</dl>
|
|
5891
|
+
|
|
5892
|
+
#### ⚙️ Parameters
|
|
5893
|
+
|
|
5894
|
+
<dl>
|
|
5895
|
+
<dd>
|
|
5896
|
+
|
|
5897
|
+
<dl>
|
|
5898
|
+
<dd>
|
|
5899
|
+
|
|
5900
|
+
**request:** `AthenaIntelligence.GetUsageWorkspacesRequest`
|
|
5901
|
+
|
|
5902
|
+
</dd>
|
|
5903
|
+
</dl>
|
|
5904
|
+
|
|
5905
|
+
<dl>
|
|
5906
|
+
<dd>
|
|
5907
|
+
|
|
5908
|
+
**requestOptions:** `WorkspacesClient.RequestOptions`
|
|
5909
|
+
|
|
5910
|
+
</dd>
|
|
5911
|
+
</dl>
|
|
5912
|
+
</dd>
|
|
5913
|
+
</dl>
|
|
5914
|
+
|
|
5915
|
+
|
|
5850
5916
|
</dd>
|
|
5851
5917
|
</dl>
|
|
5852
5918
|
</details>
|