@openrouter/sdk 1.2.4 → 1.2.6
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/esm/funcs/analyticsGetUserActivity.d.ts +1 -1
- package/esm/funcs/analyticsGetUserActivity.js +3 -1
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/activityitem.d.ts +4 -0
- package/esm/models/activityitem.js +2 -0
- package/esm/models/generationresponse.d.ts +4 -0
- package/esm/models/generationresponse.js +2 -0
- package/esm/models/index.d.ts +4 -0
- package/esm/models/index.js +4 -0
- package/esm/models/operations/getuseractivity.d.ts +23 -0
- package/esm/models/operations/getuseractivity.js +12 -0
- package/esm/models/operations/queryanalytics.d.ts +2 -2
- package/esm/models/publicendpoint.d.ts +4 -0
- package/esm/models/publicendpoint.js +2 -0
- package/esm/models/speechinputreference.d.ts +13 -0
- package/esm/models/speechinputreference.js +16 -0
- package/esm/models/speechinputreferenceaudio.d.ts +21 -0
- package/esm/models/speechinputreferenceaudio.js +20 -0
- package/esm/models/speechinputreferenceaudioinput.d.ts +23 -0
- package/esm/models/speechinputreferenceaudioinput.js +14 -0
- package/esm/models/speechinputreferencetext.d.ts +20 -0
- package/esm/models/speechinputreferencetext.js +14 -0
- package/esm/models/speechrequest.d.ts +6 -0
- package/esm/models/speechrequest.js +3 -0
- package/esm/sdk/analytics.d.ts +1 -1
- package/esm/sdk/analytics.js +1 -1
- package/jsr.json +1 -1
- package/package.json +5 -5
|
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
|
|
|
13
13
|
* Get user activity grouped by endpoint
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
|
-
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
16
|
+
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. Pass `workspace_id` to scope the response to a single workspace. Pass `group_by=workspace` to split each row per workspace and include `workspace_id` on every item; by default rows are aggregated across workspaces and `workspace_id` is not returned. Activity recorded before workspace resolution existed is permanently attributed to the account default workspace (no backfill is possible). [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
17
|
*/
|
|
18
18
|
export declare function analyticsGetUserActivity(client: OpenRouterCore, request?: operations.GetUserActivityRequest | undefined, options?: RequestOptions): APIPromise<Result<models.ActivityResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
19
|
//# sourceMappingURL=analyticsGetUserActivity.d.ts.map
|
|
@@ -17,7 +17,7 @@ import { APIPromise } from "../types/async.js";
|
|
|
17
17
|
* Get user activity grouped by endpoint
|
|
18
18
|
*
|
|
19
19
|
* @remarks
|
|
20
|
-
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
20
|
+
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. Pass `workspace_id` to scope the response to a single workspace. Pass `group_by=workspace` to split each row per workspace and include `workspace_id` on every item; by default rows are aggregated across workspaces and `workspace_id` is not returned. Activity recorded before workspace resolution existed is permanently attributed to the account default workspace (no backfill is possible). [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
21
21
|
*/
|
|
22
22
|
export function analyticsGetUserActivity(client, request, options) {
|
|
23
23
|
return new APIPromise($do(client, request, options));
|
|
@@ -33,7 +33,9 @@ async function $do(client, request, options) {
|
|
|
33
33
|
const query = encodeFormQuery({
|
|
34
34
|
"api_key_hash": payload?.api_key_hash,
|
|
35
35
|
"date": payload?.date,
|
|
36
|
+
"group_by": payload?.group_by,
|
|
36
37
|
"user_id": payload?.user_id,
|
|
38
|
+
"workspace_id": payload?.workspace_id,
|
|
37
39
|
});
|
|
38
40
|
const headers = new Headers(compactMap({
|
|
39
41
|
Accept: "application/json",
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
49
49
|
export declare const SDK_METADATA: {
|
|
50
50
|
readonly language: "typescript";
|
|
51
51
|
readonly openapiDocVersion: "1.0.0";
|
|
52
|
-
readonly sdkVersion: "1.2.
|
|
52
|
+
readonly sdkVersion: "1.2.6";
|
|
53
53
|
readonly genVersion: "2.914.0";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.2.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.2.6 2.914.0 1.0.0 @openrouter/sdk";
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
|
|
|
26
26
|
export const SDK_METADATA = {
|
|
27
27
|
language: "typescript",
|
|
28
28
|
openapiDocVersion: "1.0.0",
|
|
29
|
-
sdkVersion: "1.2.
|
|
29
|
+
sdkVersion: "1.2.6",
|
|
30
30
|
genVersion: "2.914.0",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 1.2.6 2.914.0 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -46,6 +46,10 @@ export type ActivityItem = {
|
|
|
46
46
|
* Total cost in USD (OpenRouter credits spent)
|
|
47
47
|
*/
|
|
48
48
|
usage: number;
|
|
49
|
+
/**
|
|
50
|
+
* ID of the workspace this activity is attributed to. Only present when `group_by=workspace` is passed; the response is then split per workspace. Activity recorded before workspace resolution existed is attributed to the account default workspace.
|
|
51
|
+
*/
|
|
52
|
+
workspaceId?: string | undefined;
|
|
49
53
|
};
|
|
50
54
|
/** @internal */
|
|
51
55
|
export declare const ActivityItem$inboundSchema: z.ZodType<ActivityItem, unknown>;
|
|
@@ -19,6 +19,7 @@ export const ActivityItem$inboundSchema = z
|
|
|
19
19
|
reasoning_tokens: z.int(),
|
|
20
20
|
requests: z.int(),
|
|
21
21
|
usage: z.number(),
|
|
22
|
+
workspace_id: z.string().optional(),
|
|
22
23
|
}).transform((v) => {
|
|
23
24
|
return remap$(v, {
|
|
24
25
|
"byok_usage_inference": "byokUsageInference",
|
|
@@ -28,6 +29,7 @@ export const ActivityItem$inboundSchema = z
|
|
|
28
29
|
"prompt_tokens": "promptTokens",
|
|
29
30
|
"provider_name": "providerName",
|
|
30
31
|
"reasoning_tokens": "reasoningTokens",
|
|
32
|
+
"workspace_id": "workspaceId",
|
|
31
33
|
});
|
|
32
34
|
});
|
|
33
35
|
export function activityItemFromJSON(jsonString) {
|
|
@@ -211,6 +211,10 @@ export type GenerationResponseData = {
|
|
|
211
211
|
* The resolved web search engine used for this generation (e.g. exa, firecrawl, parallel)
|
|
212
212
|
*/
|
|
213
213
|
webSearchEngine: string | null;
|
|
214
|
+
/**
|
|
215
|
+
* ID of the workspace this generation is attributed to. Null for accounts without workspaces. Generations created before workspace resolution existed are attributed to the account default workspace.
|
|
216
|
+
*/
|
|
217
|
+
workspaceId: string | null;
|
|
214
218
|
};
|
|
215
219
|
/**
|
|
216
220
|
* Generation response
|
|
@@ -78,6 +78,7 @@ export const GenerationResponseData$inboundSchema = z.object({
|
|
|
78
78
|
usage: z.number(),
|
|
79
79
|
user_agent: z.nullable(z.string()),
|
|
80
80
|
web_search_engine: z.nullable(z.string()),
|
|
81
|
+
workspace_id: z.nullable(z.string()),
|
|
81
82
|
}).transform((v) => {
|
|
82
83
|
return remap$(v, {
|
|
83
84
|
"api_type": "apiType",
|
|
@@ -116,6 +117,7 @@ export const GenerationResponseData$inboundSchema = z.object({
|
|
|
116
117
|
"upstream_inference_cost": "upstreamInferenceCost",
|
|
117
118
|
"user_agent": "userAgent",
|
|
118
119
|
"web_search_engine": "webSearchEngine",
|
|
120
|
+
"workspace_id": "workspaceId",
|
|
119
121
|
});
|
|
120
122
|
});
|
|
121
123
|
export function generationResponseDataFromJSON(jsonString) {
|
package/esm/models/index.d.ts
CHANGED
|
@@ -495,6 +495,10 @@ export * from "./shellservertoolconfig.js";
|
|
|
495
495
|
export * from "./shellservertoolengine.js";
|
|
496
496
|
export * from "./shellservertoolenvironment.js";
|
|
497
497
|
export * from "./shellservertoolopenrouter.js";
|
|
498
|
+
export * from "./speechinputreference.js";
|
|
499
|
+
export * from "./speechinputreferenceaudio.js";
|
|
500
|
+
export * from "./speechinputreferenceaudioinput.js";
|
|
501
|
+
export * from "./speechinputreferencetext.js";
|
|
498
502
|
export * from "./speechrequest.js";
|
|
499
503
|
export * from "./stopservertoolswhencondition.js";
|
|
500
504
|
export * from "./stopservertoolswhenfinishreasonis.js";
|
package/esm/models/index.js
CHANGED
|
@@ -499,6 +499,10 @@ export * from "./shellservertoolconfig.js";
|
|
|
499
499
|
export * from "./shellservertoolengine.js";
|
|
500
500
|
export * from "./shellservertoolenvironment.js";
|
|
501
501
|
export * from "./shellservertoolopenrouter.js";
|
|
502
|
+
export * from "./speechinputreference.js";
|
|
503
|
+
export * from "./speechinputreferenceaudio.js";
|
|
504
|
+
export * from "./speechinputreferenceaudioinput.js";
|
|
505
|
+
export * from "./speechinputreferencetext.js";
|
|
502
506
|
export * from "./speechrequest.js";
|
|
503
507
|
export * from "./stopservertoolswhencondition.js";
|
|
504
508
|
export * from "./stopservertoolswhenfinishreasonis.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
2
3
|
export type GetUserActivityGlobals = {
|
|
3
4
|
/**
|
|
4
5
|
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
@@ -20,6 +21,16 @@ export type GetUserActivityGlobals = {
|
|
|
20
21
|
*/
|
|
21
22
|
appCategories?: string | undefined;
|
|
22
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Set to 'workspace' to split each row per workspace and include `workspace_id` on every item. Omitted by default, in which case rows are aggregated across workspaces (by date, model, and endpoint) and `workspace_id` is not returned — preserving the historical response shape.
|
|
26
|
+
*/
|
|
27
|
+
export declare const GroupBy: {
|
|
28
|
+
readonly Workspace: "workspace";
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Set to 'workspace' to split each row per workspace and include `workspace_id` on every item. Omitted by default, in which case rows are aggregated across workspaces (by date, model, and endpoint) and `workspace_id` is not returned — preserving the historical response shape.
|
|
32
|
+
*/
|
|
33
|
+
export type GroupBy = ClosedEnum<typeof GroupBy>;
|
|
23
34
|
export type GetUserActivityRequest = {
|
|
24
35
|
/**
|
|
25
36
|
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
@@ -52,8 +63,18 @@ export type GetUserActivityRequest = {
|
|
|
52
63
|
* Filter by org member user ID. Only applicable for organization accounts.
|
|
53
64
|
*/
|
|
54
65
|
userId?: string | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Set to 'workspace' to split each row per workspace and include `workspace_id` on every item. Omitted by default, in which case rows are aggregated across workspaces (by date, model, and endpoint) and `workspace_id` is not returned — preserving the historical response shape.
|
|
68
|
+
*/
|
|
69
|
+
groupBy?: GroupBy | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Filter by workspace ID (UUID). Returns only activity attributed to that workspace. The workspace must belong to the authenticated account.
|
|
72
|
+
*/
|
|
73
|
+
workspaceId?: string | undefined;
|
|
55
74
|
};
|
|
56
75
|
/** @internal */
|
|
76
|
+
export declare const GroupBy$outboundSchema: z.ZodEnum<typeof GroupBy>;
|
|
77
|
+
/** @internal */
|
|
57
78
|
export type GetUserActivityRequest$Outbound = {
|
|
58
79
|
"HTTP-Referer"?: string | undefined;
|
|
59
80
|
appTitle?: string | undefined;
|
|
@@ -61,6 +82,8 @@ export type GetUserActivityRequest$Outbound = {
|
|
|
61
82
|
date?: string | undefined;
|
|
62
83
|
api_key_hash?: string | undefined;
|
|
63
84
|
user_id?: string | undefined;
|
|
85
|
+
group_by?: string | undefined;
|
|
86
|
+
workspace_id?: string | undefined;
|
|
64
87
|
};
|
|
65
88
|
/** @internal */
|
|
66
89
|
export declare const GetUserActivityRequest$outboundSchema: z.ZodType<GetUserActivityRequest$Outbound, GetUserActivityRequest>;
|
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
/**
|
|
8
|
+
* Set to 'workspace' to split each row per workspace and include `workspace_id` on every item. Omitted by default, in which case rows are aggregated across workspaces (by date, model, and endpoint) and `workspace_id` is not returned — preserving the historical response shape.
|
|
9
|
+
*/
|
|
10
|
+
export const GroupBy = {
|
|
11
|
+
Workspace: "workspace",
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const GroupBy$outboundSchema = z.enum(GroupBy);
|
|
7
15
|
/** @internal */
|
|
8
16
|
export const GetUserActivityRequest$outboundSchema = z.object({
|
|
9
17
|
httpReferer: z.string().optional(),
|
|
@@ -12,11 +20,15 @@ export const GetUserActivityRequest$outboundSchema = z.object({
|
|
|
12
20
|
date: z.string().optional(),
|
|
13
21
|
apiKeyHash: z.string().optional(),
|
|
14
22
|
userId: z.string().optional(),
|
|
23
|
+
groupBy: GroupBy$outboundSchema.optional(),
|
|
24
|
+
workspaceId: z.string().optional(),
|
|
15
25
|
}).transform((v) => {
|
|
16
26
|
return remap$(v, {
|
|
17
27
|
httpReferer: "HTTP-Referer",
|
|
18
28
|
apiKeyHash: "api_key_hash",
|
|
19
29
|
userId: "user_id",
|
|
30
|
+
groupBy: "group_by",
|
|
31
|
+
workspaceId: "workspace_id",
|
|
20
32
|
});
|
|
21
33
|
});
|
|
22
34
|
export function getUserActivityRequestToJSON(getUserActivityRequest) {
|
|
@@ -68,7 +68,7 @@ export type ClassifierFilters = {
|
|
|
68
68
|
};
|
|
69
69
|
export type Value2 = string | number;
|
|
70
70
|
/**
|
|
71
|
-
* Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. "user_abc123"), not the display name; `workspace` — workspace UUID, not the workspace name; `app` — numeric app ID, not the app title; `model` — permaslug (e.g. "openai/gpt-4o"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned.
|
|
71
|
+
* Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. "user_abc123"), not the display name; `workspace` — workspace UUID, not the workspace name (filtering or grouping by the account default workspace also covers activity recorded before workspace resolution existed, which is attributed to that default workspace); `app` — numeric app ID, not the app title; `model` — permaslug (e.g. "openai/gpt-4o"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned.
|
|
72
72
|
*/
|
|
73
73
|
export type Value1 = string | number | Array<string | number>;
|
|
74
74
|
export type Filter = {
|
|
@@ -81,7 +81,7 @@ export type Filter = {
|
|
|
81
81
|
*/
|
|
82
82
|
operator: string;
|
|
83
83
|
/**
|
|
84
|
-
* Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. "user_abc123"), not the display name; `workspace` — workspace UUID, not the workspace name; `app` — numeric app ID, not the app title; `model` — permaslug (e.g. "openai/gpt-4o"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned.
|
|
84
|
+
* Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. "user_abc123"), not the display name; `workspace` — workspace UUID, not the workspace name (filtering or grouping by the account default workspace also covers activity recorded before workspace resolution existed, which is attributed to that default workspace); `app` — numeric app ID, not the app title; `model` — permaslug (e.g. "openai/gpt-4o"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned.
|
|
85
85
|
*/
|
|
86
86
|
value: string | number | Array<string | number>;
|
|
87
87
|
};
|
|
@@ -96,6 +96,10 @@ export type PublicEndpoint = {
|
|
|
96
96
|
status?: EndpointStatus | undefined;
|
|
97
97
|
supportedParameters: Array<Parameter>;
|
|
98
98
|
supportsImplicitCaching: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Whether this TTS endpoint accepts inline reference audio (`input_references`) for stateless voice cloning. Requests carrying reference audio are only routed to endpoints where this is true.
|
|
101
|
+
*/
|
|
102
|
+
supportsVoiceCloning: boolean;
|
|
99
103
|
tag: string;
|
|
100
104
|
throughputLast30m: PercentileStats | null;
|
|
101
105
|
/**
|
|
@@ -60,6 +60,7 @@ export const PublicEndpoint$inboundSchema = z.object({
|
|
|
60
60
|
status: EndpointStatus$inboundSchema.optional(),
|
|
61
61
|
supported_parameters: z.array(Parameter$inboundSchema),
|
|
62
62
|
supports_implicit_caching: z.boolean(),
|
|
63
|
+
supports_voice_cloning: z.boolean().default(false),
|
|
63
64
|
tag: z.string(),
|
|
64
65
|
throughput_last_30m: z.nullable(PercentileStats$inboundSchema),
|
|
65
66
|
uptime_last_1d: z.nullable(z.number()),
|
|
@@ -76,6 +77,7 @@ export const PublicEndpoint$inboundSchema = z.object({
|
|
|
76
77
|
"provider_name": "providerName",
|
|
77
78
|
"supported_parameters": "supportedParameters",
|
|
78
79
|
"supports_implicit_caching": "supportsImplicitCaching",
|
|
80
|
+
"supports_voice_cloning": "supportsVoiceCloning",
|
|
79
81
|
"throughput_last_30m": "throughputLast30m",
|
|
80
82
|
"uptime_last_1d": "uptimeLast1d",
|
|
81
83
|
"uptime_last_30m": "uptimeLast30m",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { SpeechInputReferenceAudio, SpeechInputReferenceAudio$Outbound } from "./speechinputreferenceaudio.js";
|
|
3
|
+
import { SpeechInputReferenceText, SpeechInputReferenceText$Outbound } from "./speechinputreferencetext.js";
|
|
4
|
+
/**
|
|
5
|
+
* Reference content part for stateless voice cloning
|
|
6
|
+
*/
|
|
7
|
+
export type SpeechInputReference = SpeechInputReferenceAudio | SpeechInputReferenceText;
|
|
8
|
+
/** @internal */
|
|
9
|
+
export type SpeechInputReference$Outbound = SpeechInputReferenceAudio$Outbound | SpeechInputReferenceText$Outbound;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare const SpeechInputReference$outboundSchema: z.ZodType<SpeechInputReference$Outbound, SpeechInputReference>;
|
|
12
|
+
export declare function speechInputReferenceToJSON(speechInputReference: SpeechInputReference): string;
|
|
13
|
+
//# sourceMappingURL=speechinputreference.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 25b19e4fa954
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { SpeechInputReferenceAudio$outboundSchema, } from "./speechinputreferenceaudio.js";
|
|
7
|
+
import { SpeechInputReferenceText$outboundSchema, } from "./speechinputreferencetext.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const SpeechInputReference$outboundSchema = z.union([
|
|
10
|
+
SpeechInputReferenceAudio$outboundSchema,
|
|
11
|
+
SpeechInputReferenceText$outboundSchema,
|
|
12
|
+
]);
|
|
13
|
+
export function speechInputReferenceToJSON(speechInputReference) {
|
|
14
|
+
return JSON.stringify(SpeechInputReference$outboundSchema.parse(speechInputReference));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=speechinputreference.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { SpeechInputReferenceAudioInput, SpeechInputReferenceAudioInput$Outbound } from "./speechinputreferenceaudioinput.js";
|
|
3
|
+
/**
|
|
4
|
+
* Reference audio input for stateless voice cloning
|
|
5
|
+
*/
|
|
6
|
+
export type SpeechInputReferenceAudio = {
|
|
7
|
+
/**
|
|
8
|
+
* Reference audio input object
|
|
9
|
+
*/
|
|
10
|
+
inputAudio: SpeechInputReferenceAudioInput;
|
|
11
|
+
type: "input_audio";
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export type SpeechInputReferenceAudio$Outbound = {
|
|
15
|
+
input_audio: SpeechInputReferenceAudioInput$Outbound;
|
|
16
|
+
type: "input_audio";
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const SpeechInputReferenceAudio$outboundSchema: z.ZodType<SpeechInputReferenceAudio$Outbound, SpeechInputReferenceAudio>;
|
|
20
|
+
export declare function speechInputReferenceAudioToJSON(speechInputReferenceAudio: SpeechInputReferenceAudio): string;
|
|
21
|
+
//# sourceMappingURL=speechinputreferenceaudio.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: d7299510c0e7
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { SpeechInputReferenceAudioInput$outboundSchema, } from "./speechinputreferenceaudioinput.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const SpeechInputReferenceAudio$outboundSchema = z.object({
|
|
10
|
+
inputAudio: SpeechInputReferenceAudioInput$outboundSchema,
|
|
11
|
+
type: z.literal("input_audio"),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return remap$(v, {
|
|
14
|
+
inputAudio: "input_audio",
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
export function speechInputReferenceAudioToJSON(speechInputReferenceAudio) {
|
|
18
|
+
return JSON.stringify(SpeechInputReferenceAudio$outboundSchema.parse(speechInputReferenceAudio));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=speechinputreferenceaudio.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* Reference audio input object
|
|
4
|
+
*/
|
|
5
|
+
export type SpeechInputReferenceAudioInput = {
|
|
6
|
+
/**
|
|
7
|
+
* Base64-encoded reference audio (optionally a data URI). Supported audio formats are provider-specific. Limited to 20 MiB of base64 (15 MiB of decoded audio).
|
|
8
|
+
*/
|
|
9
|
+
data: string;
|
|
10
|
+
/**
|
|
11
|
+
* Audio format of the reference audio (e.g., wav, mp3). Optional; most providers detect the format from the audio bytes.
|
|
12
|
+
*/
|
|
13
|
+
format?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
/** @internal */
|
|
16
|
+
export type SpeechInputReferenceAudioInput$Outbound = {
|
|
17
|
+
data: string;
|
|
18
|
+
format?: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
/** @internal */
|
|
21
|
+
export declare const SpeechInputReferenceAudioInput$outboundSchema: z.ZodType<SpeechInputReferenceAudioInput$Outbound, SpeechInputReferenceAudioInput>;
|
|
22
|
+
export declare function speechInputReferenceAudioInputToJSON(speechInputReferenceAudioInput: SpeechInputReferenceAudioInput): string;
|
|
23
|
+
//# sourceMappingURL=speechinputreferenceaudioinput.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 7f6147039895
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const SpeechInputReferenceAudioInput$outboundSchema = z.object({
|
|
8
|
+
data: z.string(),
|
|
9
|
+
format: z.string().optional(),
|
|
10
|
+
});
|
|
11
|
+
export function speechInputReferenceAudioInputToJSON(speechInputReferenceAudioInput) {
|
|
12
|
+
return JSON.stringify(SpeechInputReferenceAudioInput$outboundSchema.parse(speechInputReferenceAudioInput));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=speechinputreferenceaudioinput.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* Transcript of the accompanying reference audio
|
|
4
|
+
*/
|
|
5
|
+
export type SpeechInputReferenceText = {
|
|
6
|
+
/**
|
|
7
|
+
* Transcript of the accompanying reference audio.
|
|
8
|
+
*/
|
|
9
|
+
text: string;
|
|
10
|
+
type: "text";
|
|
11
|
+
};
|
|
12
|
+
/** @internal */
|
|
13
|
+
export type SpeechInputReferenceText$Outbound = {
|
|
14
|
+
text: string;
|
|
15
|
+
type: "text";
|
|
16
|
+
};
|
|
17
|
+
/** @internal */
|
|
18
|
+
export declare const SpeechInputReferenceText$outboundSchema: z.ZodType<SpeechInputReferenceText$Outbound, SpeechInputReferenceText>;
|
|
19
|
+
export declare function speechInputReferenceTextToJSON(speechInputReferenceText: SpeechInputReferenceText): string;
|
|
20
|
+
//# sourceMappingURL=speechinputreferencetext.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 88f12d1ebfa6
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const SpeechInputReferenceText$outboundSchema = z.object({
|
|
8
|
+
text: z.string(),
|
|
9
|
+
type: z.literal("text"),
|
|
10
|
+
});
|
|
11
|
+
export function speechInputReferenceTextToJSON(speechInputReferenceText) {
|
|
12
|
+
return JSON.stringify(SpeechInputReferenceText$outboundSchema.parse(speechInputReferenceText));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=speechinputreferencetext.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { OpenEnum } from "../types/enums.js";
|
|
3
3
|
import { ProviderOptions, ProviderOptions$Outbound } from "./provideroptions.js";
|
|
4
|
+
import { SpeechInputReference, SpeechInputReference$Outbound } from "./speechinputreference.js";
|
|
4
5
|
/**
|
|
5
6
|
* Provider-specific passthrough configuration
|
|
6
7
|
*/
|
|
@@ -29,6 +30,10 @@ export type SpeechRequest = {
|
|
|
29
30
|
* Text to synthesize
|
|
30
31
|
*/
|
|
31
32
|
input: string;
|
|
33
|
+
/**
|
|
34
|
+
* Reference content for stateless voice cloning: one `input_audio` part carrying the voice sample, optionally accompanied by one `text` part with its transcript. Only routed to endpoints that support voice cloning.
|
|
35
|
+
*/
|
|
36
|
+
inputReferences?: Array<SpeechInputReference> | undefined;
|
|
32
37
|
/**
|
|
33
38
|
* TTS model identifier
|
|
34
39
|
*/
|
|
@@ -62,6 +67,7 @@ export declare const SpeechRequestResponseFormat$outboundSchema: z.ZodType<strin
|
|
|
62
67
|
/** @internal */
|
|
63
68
|
export type SpeechRequest$Outbound = {
|
|
64
69
|
input: string;
|
|
70
|
+
input_references?: Array<SpeechInputReference$Outbound> | undefined;
|
|
65
71
|
model: string;
|
|
66
72
|
provider?: SpeechRequestProvider$Outbound | undefined;
|
|
67
73
|
response_format: string;
|
|
@@ -6,6 +6,7 @@ import * as z from "zod/v4";
|
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import * as openEnums from "../types/enums.js";
|
|
8
8
|
import { ProviderOptions$outboundSchema, } from "./provideroptions.js";
|
|
9
|
+
import { SpeechInputReference$outboundSchema, } from "./speechinputreference.js";
|
|
9
10
|
/**
|
|
10
11
|
* Audio output format
|
|
11
12
|
*/
|
|
@@ -25,6 +26,7 @@ export const SpeechRequestResponseFormat$outboundSchema = openEnums.outboundSche
|
|
|
25
26
|
/** @internal */
|
|
26
27
|
export const SpeechRequest$outboundSchema = z.object({
|
|
27
28
|
input: z.string(),
|
|
29
|
+
inputReferences: z.array(SpeechInputReference$outboundSchema).optional(),
|
|
28
30
|
model: z.string(),
|
|
29
31
|
provider: z.lazy(() => SpeechRequestProvider$outboundSchema).optional(),
|
|
30
32
|
responseFormat: SpeechRequestResponseFormat$outboundSchema.default("pcm"),
|
|
@@ -32,6 +34,7 @@ export const SpeechRequest$outboundSchema = z.object({
|
|
|
32
34
|
voice: z.string().optional(),
|
|
33
35
|
}).transform((v) => {
|
|
34
36
|
return remap$(v, {
|
|
37
|
+
inputReferences: "input_references",
|
|
35
38
|
responseFormat: "response_format",
|
|
36
39
|
});
|
|
37
40
|
});
|
package/esm/sdk/analytics.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class Analytics extends ClientSDK {
|
|
|
6
6
|
* Get user activity grouped by endpoint
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
|
-
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
9
|
+
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. Pass `workspace_id` to scope the response to a single workspace. Pass `group_by=workspace` to split each row per workspace and include `workspace_id` on every item; by default rows are aggregated across workspaces and `workspace_id` is not returned. Activity recorded before workspace resolution existed is permanently attributed to the account default workspace (no backfill is possible). [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
10
10
|
*/
|
|
11
11
|
getUserActivity(request?: operations.GetUserActivityRequest | undefined, options?: RequestOptions): Promise<models.ActivityResponse>;
|
|
12
12
|
}
|
package/esm/sdk/analytics.js
CHANGED
|
@@ -10,7 +10,7 @@ export class Analytics extends ClientSDK {
|
|
|
10
10
|
* Get user activity grouped by endpoint
|
|
11
11
|
*
|
|
12
12
|
* @remarks
|
|
13
|
-
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
13
|
+
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. Pass `workspace_id` to scope the response to a single workspace. Pass `group_by=workspace` to split each row per workspace and include `workspace_id` on every item; by default rows are aggregated across workspaces and `workspace_id` is not returned. Activity recorded before workspace resolution existed is permanently attributed to the account default workspace (no backfill is possible). [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
14
14
|
*/
|
|
15
15
|
async getUserActivity(request, options) {
|
|
16
16
|
return unwrapAsync(analyticsGetUserActivity(this, request, options));
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
+
"compile": "tsc",
|
|
76
77
|
"postinstall": "node scripts/check-types.js || true",
|
|
78
|
+
"test:e2e": "vitest --run --project e2e",
|
|
79
|
+
"test:watch": "vitest --watch --project unit",
|
|
77
80
|
"typecheck": "tsc --noEmit",
|
|
78
|
-
"typecheck:transit": "exit 0",
|
|
79
|
-
"compile": "tsc",
|
|
80
81
|
"prepare": "npm run build",
|
|
81
82
|
"test": "vitest --run --project unit",
|
|
82
|
-
"test:e2e": "vitest --run --project e2e",
|
|
83
83
|
"test:transit": "exit 0",
|
|
84
|
-
"
|
|
84
|
+
"typecheck:transit": "exit 0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|