@openrouter/sdk 1.4.20 → 1.4.21
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/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/operations/createaudiotranscriptionsmultipart.d.ts +1 -1
- package/esm/models/speechrequest.d.ts +40 -2
- package/esm/models/speechrequest.js +21 -0
- package/esm/models/sttrequest.d.ts +40 -2
- package/esm/models/sttrequest.js +21 -0
- package/jsr.json +1 -1
- package/package.json +8 -8
package/esm/lib/config.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
50
50
|
export declare const SDK_METADATA: {
|
|
51
51
|
readonly language: "typescript";
|
|
52
52
|
readonly openapiDocVersion: "1.0.0";
|
|
53
|
-
readonly sdkVersion: "1.4.
|
|
53
|
+
readonly sdkVersion: "1.4.21";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.4.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.4.21 2.914.0 1.0.0 @openrouter/sdk";
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
|
|
|
29
29
|
export const SDK_METADATA = {
|
|
30
30
|
language: "typescript",
|
|
31
31
|
openapiDocVersion: "1.0.0",
|
|
32
|
-
sdkVersion: "1.4.
|
|
32
|
+
sdkVersion: "1.4.21",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.4.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.4.21 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -63,7 +63,7 @@ export type CreateAudioTranscriptionsMultipartRequestBody = {
|
|
|
63
63
|
*/
|
|
64
64
|
model: string;
|
|
65
65
|
/**
|
|
66
|
-
* JSON-encoded provider preferences object, the same shape as the JSON body field: { "options": { "<provider-slug>": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.
|
|
66
|
+
* JSON-encoded provider preferences object, the same shape as the JSON body field: { "zdr": true, "data_collection": "deny", "options": { "<provider-slug>": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.
|
|
67
67
|
*/
|
|
68
68
|
provider?: string | undefined;
|
|
69
69
|
/**
|
|
@@ -4,13 +4,47 @@ import { ProviderOptions, ProviderOptions$Outbound } from "./provideroptions.js"
|
|
|
4
4
|
import { SpeechInputReference, SpeechInputReference$Outbound } from "./speechinputreference.js";
|
|
5
5
|
import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* - allow: (default) allow providers which store user data non-transiently and may train on it
|
|
11
|
+
*
|
|
12
|
+
* - deny: use only providers which do not collect user data.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SpeechRequestDataCollection: {
|
|
15
|
+
readonly Deny: "deny";
|
|
16
|
+
readonly Allow: "allow";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* - allow: (default) allow providers which store user data non-transiently and may train on it
|
|
23
|
+
*
|
|
24
|
+
* - deny: use only providers which do not collect user data.
|
|
25
|
+
*/
|
|
26
|
+
export type SpeechRequestDataCollection = OpenEnum<typeof SpeechRequestDataCollection>;
|
|
27
|
+
/**
|
|
28
|
+
* Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
8
29
|
*/
|
|
9
30
|
export type SpeechRequestProvider = {
|
|
31
|
+
/**
|
|
32
|
+
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* - allow: (default) allow providers which store user data non-transiently and may train on it
|
|
36
|
+
*
|
|
37
|
+
* - deny: use only providers which do not collect user data.
|
|
38
|
+
*/
|
|
39
|
+
dataCollection?: SpeechRequestDataCollection | null | undefined;
|
|
10
40
|
/**
|
|
11
41
|
* Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.
|
|
12
42
|
*/
|
|
13
43
|
options?: ProviderOptions | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
|
|
46
|
+
*/
|
|
47
|
+
zdr?: boolean | null | undefined;
|
|
14
48
|
};
|
|
15
49
|
/**
|
|
16
50
|
* Audio output format
|
|
@@ -40,7 +74,7 @@ export type SpeechRequest = {
|
|
|
40
74
|
*/
|
|
41
75
|
model: string;
|
|
42
76
|
/**
|
|
43
|
-
* Provider-specific passthrough
|
|
77
|
+
* Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
44
78
|
*/
|
|
45
79
|
provider?: SpeechRequestProvider | undefined;
|
|
46
80
|
/**
|
|
@@ -69,8 +103,12 @@ export type SpeechRequest = {
|
|
|
69
103
|
voice?: string | undefined;
|
|
70
104
|
};
|
|
71
105
|
/** @internal */
|
|
106
|
+
export declare const SpeechRequestDataCollection$outboundSchema: z.ZodType<string, SpeechRequestDataCollection>;
|
|
107
|
+
/** @internal */
|
|
72
108
|
export type SpeechRequestProvider$Outbound = {
|
|
109
|
+
data_collection?: string | null | undefined;
|
|
73
110
|
options?: ProviderOptions$Outbound | undefined;
|
|
111
|
+
zdr?: boolean | null | undefined;
|
|
74
112
|
};
|
|
75
113
|
/** @internal */
|
|
76
114
|
export declare const SpeechRequestProvider$outboundSchema: z.ZodType<SpeechRequestProvider$Outbound, SpeechRequestProvider>;
|
|
@@ -8,6 +8,18 @@ import * as openEnums from "../types/enums.js";
|
|
|
8
8
|
import { ProviderOptions$outboundSchema, } from "./provideroptions.js";
|
|
9
9
|
import { SpeechInputReference$outboundSchema, } from "./speechinputreference.js";
|
|
10
10
|
import { TraceConfig$outboundSchema, } from "./traceconfig.js";
|
|
11
|
+
/**
|
|
12
|
+
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* - allow: (default) allow providers which store user data non-transiently and may train on it
|
|
16
|
+
*
|
|
17
|
+
* - deny: use only providers which do not collect user data.
|
|
18
|
+
*/
|
|
19
|
+
export const SpeechRequestDataCollection = {
|
|
20
|
+
Deny: "deny",
|
|
21
|
+
Allow: "allow",
|
|
22
|
+
};
|
|
11
23
|
/**
|
|
12
24
|
* Audio output format
|
|
13
25
|
*/
|
|
@@ -16,8 +28,17 @@ export const SpeechRequestResponseFormat = {
|
|
|
16
28
|
Pcm: "pcm",
|
|
17
29
|
};
|
|
18
30
|
/** @internal */
|
|
31
|
+
export const SpeechRequestDataCollection$outboundSchema = openEnums.outboundSchema(SpeechRequestDataCollection);
|
|
32
|
+
/** @internal */
|
|
19
33
|
export const SpeechRequestProvider$outboundSchema = z.object({
|
|
34
|
+
dataCollection: z.nullable(SpeechRequestDataCollection$outboundSchema)
|
|
35
|
+
.optional(),
|
|
20
36
|
options: ProviderOptions$outboundSchema.optional(),
|
|
37
|
+
zdr: z.nullable(z.boolean()).optional(),
|
|
38
|
+
}).transform((v) => {
|
|
39
|
+
return remap$(v, {
|
|
40
|
+
dataCollection: "data_collection",
|
|
41
|
+
});
|
|
21
42
|
});
|
|
22
43
|
export function speechRequestProviderToJSON(speechRequestProvider) {
|
|
23
44
|
return JSON.stringify(SpeechRequestProvider$outboundSchema.parse(speechRequestProvider));
|
|
@@ -5,13 +5,47 @@ import { STTInputAudio, STTInputAudio$Outbound } from "./sttinputaudio.js";
|
|
|
5
5
|
import { STTTimestampGranularity } from "./stttimestampgranularity.js";
|
|
6
6
|
import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* - allow: (default) allow providers which store user data non-transiently and may train on it
|
|
12
|
+
*
|
|
13
|
+
* - deny: use only providers which do not collect user data.
|
|
14
|
+
*/
|
|
15
|
+
export declare const STTRequestDataCollection: {
|
|
16
|
+
readonly Deny: "deny";
|
|
17
|
+
readonly Allow: "allow";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* - allow: (default) allow providers which store user data non-transiently and may train on it
|
|
24
|
+
*
|
|
25
|
+
* - deny: use only providers which do not collect user data.
|
|
26
|
+
*/
|
|
27
|
+
export type STTRequestDataCollection = OpenEnum<typeof STTRequestDataCollection>;
|
|
28
|
+
/**
|
|
29
|
+
* Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
9
30
|
*/
|
|
10
31
|
export type STTRequestProvider = {
|
|
32
|
+
/**
|
|
33
|
+
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* - allow: (default) allow providers which store user data non-transiently and may train on it
|
|
37
|
+
*
|
|
38
|
+
* - deny: use only providers which do not collect user data.
|
|
39
|
+
*/
|
|
40
|
+
dataCollection?: STTRequestDataCollection | null | undefined;
|
|
11
41
|
/**
|
|
12
42
|
* Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.
|
|
13
43
|
*/
|
|
14
44
|
options?: ProviderOptions | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
|
|
47
|
+
*/
|
|
48
|
+
zdr?: boolean | null | undefined;
|
|
15
49
|
};
|
|
16
50
|
/**
|
|
17
51
|
* Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.
|
|
@@ -49,7 +83,7 @@ export type STTRequest = {
|
|
|
49
83
|
*/
|
|
50
84
|
model: string;
|
|
51
85
|
/**
|
|
52
|
-
* Provider-specific passthrough
|
|
86
|
+
* Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options
|
|
53
87
|
*/
|
|
54
88
|
provider?: STTRequestProvider | undefined;
|
|
55
89
|
/**
|
|
@@ -78,8 +112,12 @@ export type STTRequest = {
|
|
|
78
112
|
user?: string | undefined;
|
|
79
113
|
};
|
|
80
114
|
/** @internal */
|
|
115
|
+
export declare const STTRequestDataCollection$outboundSchema: z.ZodType<string, STTRequestDataCollection>;
|
|
116
|
+
/** @internal */
|
|
81
117
|
export type STTRequestProvider$Outbound = {
|
|
118
|
+
data_collection?: string | null | undefined;
|
|
82
119
|
options?: ProviderOptions$Outbound | undefined;
|
|
120
|
+
zdr?: boolean | null | undefined;
|
|
83
121
|
};
|
|
84
122
|
/** @internal */
|
|
85
123
|
export declare const STTRequestProvider$outboundSchema: z.ZodType<STTRequestProvider$Outbound, STTRequestProvider>;
|
package/esm/models/sttrequest.js
CHANGED
|
@@ -9,6 +9,18 @@ import { ProviderOptions$outboundSchema, } from "./provideroptions.js";
|
|
|
9
9
|
import { STTInputAudio$outboundSchema, } from "./sttinputaudio.js";
|
|
10
10
|
import { STTTimestampGranularity$outboundSchema, } from "./stttimestampgranularity.js";
|
|
11
11
|
import { TraceConfig$outboundSchema, } from "./traceconfig.js";
|
|
12
|
+
/**
|
|
13
|
+
* Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* - allow: (default) allow providers which store user data non-transiently and may train on it
|
|
17
|
+
*
|
|
18
|
+
* - deny: use only providers which do not collect user data.
|
|
19
|
+
*/
|
|
20
|
+
export const STTRequestDataCollection = {
|
|
21
|
+
Deny: "deny",
|
|
22
|
+
Allow: "allow",
|
|
23
|
+
};
|
|
12
24
|
/**
|
|
13
25
|
* Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.
|
|
14
26
|
*/
|
|
@@ -17,8 +29,17 @@ export const STTRequestResponseFormat = {
|
|
|
17
29
|
VerboseJson: "verbose_json",
|
|
18
30
|
};
|
|
19
31
|
/** @internal */
|
|
32
|
+
export const STTRequestDataCollection$outboundSchema = openEnums.outboundSchema(STTRequestDataCollection);
|
|
33
|
+
/** @internal */
|
|
20
34
|
export const STTRequestProvider$outboundSchema = z.object({
|
|
35
|
+
dataCollection: z.nullable(STTRequestDataCollection$outboundSchema)
|
|
36
|
+
.optional(),
|
|
21
37
|
options: ProviderOptions$outboundSchema.optional(),
|
|
38
|
+
zdr: z.nullable(z.boolean()).optional(),
|
|
39
|
+
}).transform((v) => {
|
|
40
|
+
return remap$(v, {
|
|
41
|
+
dataCollection: "data_collection",
|
|
42
|
+
});
|
|
22
43
|
});
|
|
23
44
|
export function sttRequestProviderToJSON(sttRequestProvider) {
|
|
24
45
|
return JSON.stringify(STTRequestProvider$outboundSchema.parse(sttRequestProvider));
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.21",
|
|
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": [
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"packageManager": "pnpm@10.22.0",
|
|
23
23
|
"publishConfig": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"access": "public",
|
|
25
|
+
"provenance": true
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
28
|
"main": "./esm/index.js",
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc && node scripts/unbarrel-imports.js",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"postinstall": "node scripts/check-types.js || true",
|
|
77
76
|
"prepare": "npm run build",
|
|
77
|
+
"test": "vitest --run --project unit",
|
|
78
78
|
"test:transit": "exit 0",
|
|
79
|
-
"
|
|
79
|
+
"typecheck": "tsc --noEmit",
|
|
80
|
+
"typecheck:transit": "exit 0",
|
|
80
81
|
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
81
|
-
"test": "vitest --run --project unit",
|
|
82
82
|
"test:e2e": "vitest --run --project e2e",
|
|
83
|
-
"
|
|
84
|
-
"
|
|
83
|
+
"test:watch": "vitest --watch --project unit",
|
|
84
|
+
"postinstall": "node scripts/check-types.js || true"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|