@openrouter/sdk 1.1.15 → 1.1.17

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.
@@ -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.1.15";
52
+ readonly sdkVersion: "1.1.17";
53
53
  readonly genVersion: "2.914.0";
54
- readonly userAgent: "speakeasy-sdk/typescript 1.1.15 2.914.0 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 1.1.17 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.1.15",
29
+ sdkVersion: "1.1.17",
30
30
  genVersion: "2.914.0",
31
- userAgent: "speakeasy-sdk/typescript 1.1.15 2.914.0 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 1.1.17 2.914.0 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -1,13 +1,34 @@
1
1
  import * as z from "zod/v4";
2
+ import { OpenEnum } from "../types/enums.js";
3
+ /**
4
+ * Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Numeric cost_quality_tradeoff takes precedence and retains ceiling behavior.
5
+ */
6
+ export declare const AutoBetaRouterPluginCostTier: {
7
+ readonly Low: "low";
8
+ readonly Medium: "medium";
9
+ readonly High: "high";
10
+ readonly Xhigh: "xhigh";
11
+ readonly Max: "max";
12
+ };
13
+ /**
14
+ * Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Numeric cost_quality_tradeoff takes precedence and retains ceiling behavior.
15
+ */
16
+ export type AutoBetaRouterPluginCostTier = OpenEnum<typeof AutoBetaRouterPluginCostTier>;
2
17
  export type AutoBetaRouterPlugin = {
3
18
  /**
4
19
  * List of model patterns to filter which models the auto-beta-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list.
5
20
  */
6
21
  allowedModels?: Array<string> | undefined;
7
22
  /**
8
- * Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9.
23
+ * Deprecated: Use cost_tier instead. Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9. Numeric cost_quality_tradeoff remains supported, retains ceiling behavior, and takes precedence over cost_tier when both are provided.
24
+ *
25
+ * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
9
26
  */
10
27
  costQualityTradeoff?: number | undefined;
28
+ /**
29
+ * Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Numeric cost_quality_tradeoff takes precedence and retains ceiling behavior.
30
+ */
31
+ costTier?: AutoBetaRouterPluginCostTier | undefined;
11
32
  /**
12
33
  * Set to false to disable the auto-beta-router plugin for this request. Defaults to true.
13
34
  */
@@ -15,9 +36,12 @@ export type AutoBetaRouterPlugin = {
15
36
  id: "auto-beta-router";
16
37
  };
17
38
  /** @internal */
39
+ export declare const AutoBetaRouterPluginCostTier$outboundSchema: z.ZodType<string, AutoBetaRouterPluginCostTier>;
40
+ /** @internal */
18
41
  export type AutoBetaRouterPlugin$Outbound = {
19
42
  allowed_models?: Array<string> | undefined;
20
43
  cost_quality_tradeoff?: number | undefined;
44
+ cost_tier?: string | undefined;
21
45
  enabled?: boolean | undefined;
22
46
  id: "auto-beta-router";
23
47
  };
@@ -4,16 +4,31 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
+ import * as openEnums from "../types/enums.js";
8
+ /**
9
+ * Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Numeric cost_quality_tradeoff takes precedence and retains ceiling behavior.
10
+ */
11
+ export const AutoBetaRouterPluginCostTier = {
12
+ Low: "low",
13
+ Medium: "medium",
14
+ High: "high",
15
+ Xhigh: "xhigh",
16
+ Max: "max",
17
+ };
18
+ /** @internal */
19
+ export const AutoBetaRouterPluginCostTier$outboundSchema = openEnums.outboundSchema(AutoBetaRouterPluginCostTier);
7
20
  /** @internal */
8
21
  export const AutoBetaRouterPlugin$outboundSchema = z.object({
9
22
  allowedModels: z.array(z.string()).optional(),
10
23
  costQualityTradeoff: z.int().optional(),
24
+ costTier: AutoBetaRouterPluginCostTier$outboundSchema.optional(),
11
25
  enabled: z.boolean().optional(),
12
26
  id: z.literal("auto-beta-router"),
13
27
  }).transform((v) => {
14
28
  return remap$(v, {
15
29
  allowedModels: "allowed_models",
16
30
  costQualityTradeoff: "cost_quality_tradeoff",
31
+ costTier: "cost_tier",
17
32
  });
18
33
  });
19
34
  export function autoBetaRouterPluginToJSON(autoBetaRouterPlugin) {
@@ -1,13 +1,34 @@
1
1
  import * as z from "zod/v4";
2
+ import { OpenEnum } from "../types/enums.js";
3
+ /**
4
+ * Shorthand for cost_quality_tradeoff. Higher tiers spend more on better models: low = 9, medium = 7, high = 5, xhigh = 3, and max = 1. Numeric cost_quality_tradeoff takes precedence when both are provided.
5
+ */
6
+ export declare const AutoRouterPluginCostTier: {
7
+ readonly Low: "low";
8
+ readonly Medium: "medium";
9
+ readonly High: "high";
10
+ readonly Xhigh: "xhigh";
11
+ readonly Max: "max";
12
+ };
13
+ /**
14
+ * Shorthand for cost_quality_tradeoff. Higher tiers spend more on better models: low = 9, medium = 7, high = 5, xhigh = 3, and max = 1. Numeric cost_quality_tradeoff takes precedence when both are provided.
15
+ */
16
+ export type AutoRouterPluginCostTier = OpenEnum<typeof AutoRouterPluginCostTier>;
2
17
  export type AutoRouterPlugin = {
3
18
  /**
4
19
  * List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list.
5
20
  */
6
21
  allowedModels?: Array<string> | undefined;
7
22
  /**
8
- * Controls cost vs. quality routing tradeoff (0–10). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7.
23
+ * Deprecated: Use cost_tier instead. Controls cost vs. quality routing tradeoff (0–10). 0 = pure quality (best model regardless of cost), 10 = maximize for cost (cheapest model wins). Intermediate values blend quality and cost signals continuously. Defaults to 7. Numeric cost_quality_tradeoff remains supported and takes precedence over cost_tier when both are provided.
24
+ *
25
+ * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
9
26
  */
10
27
  costQualityTradeoff?: number | undefined;
28
+ /**
29
+ * Shorthand for cost_quality_tradeoff. Higher tiers spend more on better models: low = 9, medium = 7, high = 5, xhigh = 3, and max = 1. Numeric cost_quality_tradeoff takes precedence when both are provided.
30
+ */
31
+ costTier?: AutoRouterPluginCostTier | undefined;
11
32
  /**
12
33
  * Set to false to disable the auto-router plugin for this request. Defaults to true.
13
34
  */
@@ -19,9 +40,12 @@ export type AutoRouterPlugin = {
19
40
  pinModel?: boolean | undefined;
20
41
  };
21
42
  /** @internal */
43
+ export declare const AutoRouterPluginCostTier$outboundSchema: z.ZodType<string, AutoRouterPluginCostTier>;
44
+ /** @internal */
22
45
  export type AutoRouterPlugin$Outbound = {
23
46
  allowed_models?: Array<string> | undefined;
24
47
  cost_quality_tradeoff?: number | undefined;
48
+ cost_tier?: string | undefined;
25
49
  enabled?: boolean | undefined;
26
50
  id: "auto-router";
27
51
  pin_model?: boolean | undefined;
@@ -4,10 +4,24 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
+ import * as openEnums from "../types/enums.js";
8
+ /**
9
+ * Shorthand for cost_quality_tradeoff. Higher tiers spend more on better models: low = 9, medium = 7, high = 5, xhigh = 3, and max = 1. Numeric cost_quality_tradeoff takes precedence when both are provided.
10
+ */
11
+ export const AutoRouterPluginCostTier = {
12
+ Low: "low",
13
+ Medium: "medium",
14
+ High: "high",
15
+ Xhigh: "xhigh",
16
+ Max: "max",
17
+ };
18
+ /** @internal */
19
+ export const AutoRouterPluginCostTier$outboundSchema = openEnums.outboundSchema(AutoRouterPluginCostTier);
7
20
  /** @internal */
8
21
  export const AutoRouterPlugin$outboundSchema = z.object({
9
22
  allowedModels: z.array(z.string()).optional(),
10
23
  costQualityTradeoff: z.int().optional(),
24
+ costTier: AutoRouterPluginCostTier$outboundSchema.optional(),
11
25
  enabled: z.boolean().optional(),
12
26
  id: z.literal("auto-router"),
13
27
  pinModel: z.boolean().optional(),
@@ -15,6 +29,7 @@ export const AutoRouterPlugin$outboundSchema = z.object({
15
29
  return remap$(v, {
16
30
  allowedModels: "allowed_models",
17
31
  costQualityTradeoff: "cost_quality_tradeoff",
32
+ costTier: "cost_tier",
18
33
  pinModel: "pin_model",
19
34
  });
20
35
  });
@@ -23,6 +23,18 @@ export type CreateGuardrailRequest = {
23
23
  * Description of the guardrail
24
24
  */
25
25
  description?: string | null | undefined;
26
+ /**
27
+ * Whether this guardrail allows free endpoints that publish prompts.
28
+ */
29
+ enableFreeModelPublication?: boolean | null | undefined;
30
+ /**
31
+ * Whether this guardrail allows free endpoints that train on request data.
32
+ */
33
+ enableFreeModelTraining?: boolean | null | undefined;
34
+ /**
35
+ * Whether this guardrail allows paid endpoints that train on request data.
36
+ */
37
+ enablePaidModelTraining?: boolean | null | undefined;
26
38
  /**
27
39
  * Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.
28
40
  *
@@ -85,6 +97,9 @@ export type CreateGuardrailRequest$Outbound = {
85
97
  content_filter_builtins?: Array<ContentFilterBuiltinEntryInput$Outbound> | null | undefined;
86
98
  content_filters?: Array<ContentFilterEntry$Outbound> | null | undefined;
87
99
  description?: string | null | undefined;
100
+ enable_free_model_publication?: boolean | null | undefined;
101
+ enable_free_model_training?: boolean | null | undefined;
102
+ enable_paid_model_training?: boolean | null | undefined;
88
103
  enforce_zdr?: boolean | null | undefined;
89
104
  enforce_zdr_anthropic?: boolean | null | undefined;
90
105
  enforce_zdr_google?: boolean | null | undefined;
@@ -15,6 +15,9 @@ export const CreateGuardrailRequest$outboundSchema = z.object({
15
15
  contentFilters: z.nullable(z.array(ContentFilterEntry$outboundSchema))
16
16
  .optional(),
17
17
  description: z.nullable(z.string()).optional(),
18
+ enableFreeModelPublication: z.nullable(z.boolean()).optional(),
19
+ enableFreeModelTraining: z.nullable(z.boolean()).optional(),
20
+ enablePaidModelTraining: z.nullable(z.boolean()).optional(),
18
21
  enforceZdr: z.nullable(z.boolean()).optional(),
19
22
  enforceZdrAnthropic: z.nullable(z.boolean()).optional(),
20
23
  enforceZdrGoogle: z.nullable(z.boolean()).optional(),
@@ -34,6 +37,9 @@ export const CreateGuardrailRequest$outboundSchema = z.object({
34
37
  allowedProviders: "allowed_providers",
35
38
  contentFilterBuiltins: "content_filter_builtins",
36
39
  contentFilters: "content_filters",
40
+ enableFreeModelPublication: "enable_free_model_publication",
41
+ enableFreeModelTraining: "enable_free_model_training",
42
+ enablePaidModelTraining: "enable_paid_model_training",
37
43
  enforceZdr: "enforce_zdr",
38
44
  enforceZdrAnthropic: "enforce_zdr_anthropic",
39
45
  enforceZdrGoogle: "enforce_zdr_google",
@@ -29,6 +29,18 @@ export type Guardrail = {
29
29
  * Description of the guardrail
30
30
  */
31
31
  description?: string | null | undefined;
32
+ /**
33
+ * Whether this guardrail allows free endpoints that publish prompts.
34
+ */
35
+ enableFreeModelPublication?: boolean | null | undefined;
36
+ /**
37
+ * Whether this guardrail allows free endpoints that train on request data.
38
+ */
39
+ enableFreeModelTraining?: boolean | null | undefined;
40
+ /**
41
+ * Whether this guardrail allows paid endpoints that train on request data.
42
+ */
43
+ enablePaidModelTraining?: boolean | null | undefined;
32
44
  /**
33
45
  * Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.
34
46
  *
@@ -17,6 +17,9 @@ export const Guardrail$inboundSchema = z.object({
17
17
  .optional(),
18
18
  created_at: z.string(),
19
19
  description: z.nullable(z.string()).optional(),
20
+ enable_free_model_publication: z.nullable(z.boolean()).optional(),
21
+ enable_free_model_training: z.nullable(z.boolean()).optional(),
22
+ enable_paid_model_training: z.nullable(z.boolean()).optional(),
20
23
  enforce_zdr: z.nullable(z.boolean()).optional(),
21
24
  enforce_zdr_anthropic: z.nullable(z.boolean()).optional(),
22
25
  enforce_zdr_google: z.nullable(z.boolean()).optional(),
@@ -39,6 +42,9 @@ export const Guardrail$inboundSchema = z.object({
39
42
  "content_filter_builtins": "contentFilterBuiltins",
40
43
  "content_filters": "contentFilters",
41
44
  "created_at": "createdAt",
45
+ "enable_free_model_publication": "enableFreeModelPublication",
46
+ "enable_free_model_training": "enableFreeModelTraining",
47
+ "enable_paid_model_training": "enablePaidModelTraining",
42
48
  "enforce_zdr": "enforceZdr",
43
49
  "enforce_zdr_anthropic": "enforceZdrAnthropic",
44
50
  "enforce_zdr_google": "enforceZdrGoogle",
@@ -23,6 +23,18 @@ export type UpdateGuardrailRequest = {
23
23
  * New description for the guardrail
24
24
  */
25
25
  description?: string | null | undefined;
26
+ /**
27
+ * Whether this guardrail allows free endpoints that publish prompts.
28
+ */
29
+ enableFreeModelPublication?: boolean | null | undefined;
30
+ /**
31
+ * Whether this guardrail allows free endpoints that train on request data.
32
+ */
33
+ enableFreeModelTraining?: boolean | null | undefined;
34
+ /**
35
+ * Whether this guardrail allows paid endpoints that train on request data.
36
+ */
37
+ enablePaidModelTraining?: boolean | null | undefined;
26
38
  /**
27
39
  * Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.
28
40
  *
@@ -81,6 +93,9 @@ export type UpdateGuardrailRequest$Outbound = {
81
93
  content_filter_builtins?: Array<ContentFilterBuiltinEntryInput$Outbound> | null | undefined;
82
94
  content_filters?: Array<ContentFilterEntry$Outbound> | null | undefined;
83
95
  description?: string | null | undefined;
96
+ enable_free_model_publication?: boolean | null | undefined;
97
+ enable_free_model_training?: boolean | null | undefined;
98
+ enable_paid_model_training?: boolean | null | undefined;
84
99
  enforce_zdr?: boolean | null | undefined;
85
100
  enforce_zdr_anthropic?: boolean | null | undefined;
86
101
  enforce_zdr_google?: boolean | null | undefined;
@@ -15,6 +15,9 @@ export const UpdateGuardrailRequest$outboundSchema = z.object({
15
15
  contentFilters: z.nullable(z.array(ContentFilterEntry$outboundSchema))
16
16
  .optional(),
17
17
  description: z.nullable(z.string()).optional(),
18
+ enableFreeModelPublication: z.nullable(z.boolean()).optional(),
19
+ enableFreeModelTraining: z.nullable(z.boolean()).optional(),
20
+ enablePaidModelTraining: z.nullable(z.boolean()).optional(),
18
21
  enforceZdr: z.nullable(z.boolean()).optional(),
19
22
  enforceZdrAnthropic: z.nullable(z.boolean()).optional(),
20
23
  enforceZdrGoogle: z.nullable(z.boolean()).optional(),
@@ -33,6 +36,9 @@ export const UpdateGuardrailRequest$outboundSchema = z.object({
33
36
  allowedProviders: "allowed_providers",
34
37
  contentFilterBuiltins: "content_filter_builtins",
35
38
  contentFilters: "content_filters",
39
+ enableFreeModelPublication: "enable_free_model_publication",
40
+ enableFreeModelTraining: "enable_free_model_training",
41
+ enablePaidModelTraining: "enable_paid_model_training",
36
42
  enforceZdr: "enforce_zdr",
37
43
  enforceZdrAnthropic: "enforce_zdr_anthropic",
38
44
  enforceZdrGoogle: "enforce_zdr_google",
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.1.15",
5
+ "version": "1.1.17",
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.1.15",
3
+ "version": "1.1.17",
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",
75
75
  "prepublishOnly": "npm run build",
76
- "test:e2e": "vitest --run --project e2e",
77
- "test:watch": "vitest --watch --project unit",
76
+ "postinstall": "node scripts/check-types.js || true",
78
77
  "prepare": "npm run build",
79
78
  "test": "vitest --run --project unit",
79
+ "test:e2e": "vitest --run --project e2e",
80
80
  "test:transit": "exit 0",
81
- "typecheck": "tsc --noEmit",
82
- "typecheck:transit": "exit 0",
81
+ "test:watch": "vitest --watch --project unit",
83
82
  "compile": "tsc",
84
- "postinstall": "node scripts/check-types.js || true"
83
+ "typecheck": "tsc --noEmit",
84
+ "typecheck:transit": "exit 0"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {