@openrouter/sdk 1.4.20 → 1.4.22

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.
@@ -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.20";
53
+ readonly sdkVersion: "1.4.22";
54
54
  readonly genVersion: "2.914.0";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.4.20 2.914.0 1.0.0 @openrouter/sdk";
55
+ readonly userAgent: "speakeasy-sdk/typescript 1.4.22 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.20",
32
+ sdkVersion: "1.4.22",
33
33
  genVersion: "2.914.0",
34
- userAgent: "speakeasy-sdk/typescript 1.4.20 2.914.0 1.0.0 @openrouter/sdk",
34
+ userAgent: "speakeasy-sdk/typescript 1.4.22 2.914.0 1.0.0 @openrouter/sdk",
35
35
  };
36
36
  //# sourceMappingURL=config.js.map
@@ -2,9 +2,17 @@ import * as z from "zod/v4";
2
2
  import { ProviderName } from "./providername.js";
3
3
  export type BatchProviderPreferencesOnly = ProviderName | string;
4
4
  /**
5
- * Batch provider routing preferences. Only `provider.only` is supported.
5
+ * Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported.
6
6
  */
7
7
  export type BatchProviderPreferences = {
8
+ /**
9
+ * Whether to allow backup providers to serve requests
10
+ *
11
+ * @remarks
12
+ * - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
13
+ * - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
14
+ */
15
+ allowFallbacks?: boolean | null | undefined;
8
16
  /**
9
17
  * List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
10
18
  */
@@ -17,6 +25,7 @@ export declare const BatchProviderPreferencesOnly$outboundSchema: z.ZodType<Batc
17
25
  export declare function batchProviderPreferencesOnlyToJSON(batchProviderPreferencesOnly: BatchProviderPreferencesOnly): string;
18
26
  /** @internal */
19
27
  export type BatchProviderPreferences$Outbound = {
28
+ allow_fallbacks?: boolean | null | undefined;
20
29
  only?: Array<string | string> | null | undefined;
21
30
  };
22
31
  /** @internal */
@@ -3,6 +3,7 @@
3
3
  * @generated-id: 250964898edb
4
4
  */
5
5
  import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
6
7
  import { ProviderName$outboundSchema } from "./providername.js";
7
8
  /** @internal */
8
9
  export const BatchProviderPreferencesOnly$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
@@ -11,8 +12,13 @@ export function batchProviderPreferencesOnlyToJSON(batchProviderPreferencesOnly)
11
12
  }
12
13
  /** @internal */
13
14
  export const BatchProviderPreferences$outboundSchema = z.object({
15
+ allowFallbacks: z.nullable(z.boolean()).optional(),
14
16
  only: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()])))
15
17
  .optional(),
18
+ }).transform((v) => {
19
+ return remap$(v, {
20
+ allowFallbacks: "allow_fallbacks",
21
+ });
16
22
  });
17
23
  export function batchProviderPreferencesToJSON(batchProviderPreferences) {
18
24
  return JSON.stringify(BatchProviderPreferences$outboundSchema.parse(batchProviderPreferences));
@@ -29,7 +29,7 @@ export type BatchSubmitBody = {
29
29
  endpoint: Endpoint;
30
30
  model: string;
31
31
  /**
32
- * Batch provider routing preferences. Only `provider.only` is supported.
32
+ * Batch provider routing preferences. Only `provider.only` and `provider.allow_fallbacks` are supported.
33
33
  */
34
34
  provider?: BatchProviderPreferences | null | undefined;
35
35
  requests: Array<RequestT>;
@@ -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
- * Provider-specific passthrough configuration
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 configuration
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
- * Provider-specific passthrough configuration
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 configuration
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>;
@@ -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
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.4.20",
5
+ "version": "1.4.22",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "1.4.20",
3
+ "version": "1.4.22",
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
- "provenance": true,
25
- "access": "public"
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
- "prepare": "npm run build",
76
+ "test": "vitest --run --project unit",
78
77
  "test:transit": "exit 0",
79
- "test:watch": "vitest --watch --project unit",
78
+ "typecheck": "tsc --noEmit",
79
+ "typecheck:transit": "exit 0",
80
80
  "compile": "tsc && node scripts/unbarrel-imports.js",
81
- "test": "vitest --run --project unit",
82
81
  "test:e2e": "vitest --run --project e2e",
83
- "typecheck": "tsc --noEmit",
84
- "typecheck:transit": "exit 0"
82
+ "test:watch": "vitest --watch --project unit",
83
+ "postinstall": "node scripts/check-types.js || true",
84
+ "prepare": "npm run build"
85
85
  },
86
86
  "peerDependencies": {
87
87