@openrouter/sdk 1.1.19 → 1.1.20

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.
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
13
13
  * Create or update a workspace budget
14
14
  *
15
15
  * @remarks
16
- * Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
+ * Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). The optional `include_byok_in_budgets` flag is a workspace-wide setting: when provided it applies to every budget interval for the workspace, not just the interval in this request. Note that a change made here is applied to budget enforcement immediately, but an already-open workspace settings page in the web dashboard may keep showing the previous value until it is reloaded. [Management key](/docs/guides/overview/auth/management-api-keys) required.
17
17
  */
18
18
  export declare function workspacesSetBudget(client: OpenRouterCore, request: operations.UpsertWorkspaceBudgetRequest, options?: RequestOptions): APIPromise<Result<models.UpsertWorkspaceBudgetResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
19
  //# sourceMappingURL=workspacesSetBudget.d.ts.map
@@ -17,7 +17,7 @@ import { APIPromise } from "../types/async.js";
17
17
  * Create or update a workspace budget
18
18
  *
19
19
  * @remarks
20
- * Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). [Management key](/docs/guides/overview/auth/management-api-keys) required.
20
+ * Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). The optional `include_byok_in_budgets` flag is a workspace-wide setting: when provided it applies to every budget interval for the workspace, not just the interval in this request. Note that a change made here is applied to budget enforcement immediately, but an already-open workspace settings page in the web dashboard may keep showing the previous value until it is reloaded. [Management key](/docs/guides/overview/auth/management-api-keys) required.
21
21
  */
22
22
  export function workspacesSetBudget(client, request, options) {
23
23
  return new APIPromise($do(client, request, options));
@@ -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.19";
52
+ readonly sdkVersion: "1.1.20";
53
53
  readonly genVersion: "2.914.0";
54
- readonly userAgent: "speakeasy-sdk/typescript 1.1.19 2.914.0 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 1.1.20 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.19",
29
+ sdkVersion: "1.1.20",
30
30
  genVersion: "2.914.0",
31
- userAgent: "speakeasy-sdk/typescript 1.1.19 2.914.0 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 1.1.20 2.914.0 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -309,6 +309,7 @@ export * from "./messagestooladditionblock.js";
309
309
  export * from "./messagestoolremovalblock.js";
310
310
  export * from "./metadatalevel.js";
311
311
  export * from "./model.js";
312
+ export * from "./modelaliastarget.js";
312
313
  export * from "./modelarchitecture.js";
313
314
  export * from "./modelbenchmarks.js";
314
315
  export * from "./modelgroup.js";
@@ -313,6 +313,7 @@ export * from "./messagestooladditionblock.js";
313
313
  export * from "./messagestoolremovalblock.js";
314
314
  export * from "./metadatalevel.js";
315
315
  export * from "./model.js";
316
+ export * from "./modelaliastarget.js";
316
317
  export * from "./modelarchitecture.js";
317
318
  export * from "./modelbenchmarks.js";
318
319
  export * from "./modelgroup.js";
@@ -7,6 +7,10 @@ export type ListWorkspaceBudgetsResponse = {
7
7
  * List of budgets configured for the workspace
8
8
  */
9
9
  data: Array<WorkspaceBudget>;
10
+ /**
11
+ * Whether BYOK (bring-your-own-key) spend is included when enforcing the workspace's budgets. This is a workspace-wide setting that applies to all budget intervals (daily, weekly, monthly, and lifetime).
12
+ */
13
+ includeByokInBudgets?: boolean | undefined;
10
14
  };
11
15
  /** @internal */
12
16
  export declare const ListWorkspaceBudgetsResponse$inboundSchema: z.ZodType<ListWorkspaceBudgetsResponse, unknown>;
@@ -3,11 +3,17 @@
3
3
  * @generated-id: 2573f31846b9
4
4
  */
5
5
  import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
6
7
  import { safeParse } from "../lib/schemas.js";
7
8
  import { WorkspaceBudget$inboundSchema, } from "./workspacebudget.js";
8
9
  /** @internal */
9
10
  export const ListWorkspaceBudgetsResponse$inboundSchema = z.object({
10
11
  data: z.array(WorkspaceBudget$inboundSchema),
12
+ include_byok_in_budgets: z.boolean().optional(),
13
+ }).transform((v) => {
14
+ return remap$(v, {
15
+ "include_byok_in_budgets": "includeByokInBudgets",
16
+ });
11
17
  });
12
18
  export function listWorkspaceBudgetsResponseFromJSON(jsonString) {
13
19
  return safeParse(jsonString, (x) => ListWorkspaceBudgetsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListWorkspaceBudgetsResponse' from JSON`);
@@ -2,6 +2,7 @@ import * as z from "zod/v4";
2
2
  import { Result as SafeParseResult } from "../types/fp.js";
3
3
  import { DefaultParameters } from "./defaultparameters.js";
4
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ import { ModelAliasTarget } from "./modelaliastarget.js";
5
6
  import { ModelArchitecture } from "./modelarchitecture.js";
6
7
  import { ModelBenchmarks } from "./modelbenchmarks.js";
7
8
  import { ModelLinks } from "./modellinks.js";
@@ -14,6 +15,10 @@ import { TopProviderInfo } from "./topproviderinfo.js";
14
15
  * Information about an AI model available on OpenRouter
15
16
  */
16
17
  export type Model = {
18
+ /**
19
+ * Concrete model targeted by this tilde-latest alias, when applicable
20
+ */
21
+ aliasTarget?: ModelAliasTarget | undefined;
17
22
  /**
18
23
  * Model architecture information
19
24
  */
@@ -6,6 +6,7 @@ import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
7
  import { safeParse } from "../lib/schemas.js";
8
8
  import { DefaultParameters$inboundSchema, } from "./defaultparameters.js";
9
+ import { ModelAliasTarget$inboundSchema, } from "./modelaliastarget.js";
9
10
  import { ModelArchitecture$inboundSchema, } from "./modelarchitecture.js";
10
11
  import { ModelBenchmarks$inboundSchema, } from "./modelbenchmarks.js";
11
12
  import { ModelLinks$inboundSchema } from "./modellinks.js";
@@ -16,6 +17,7 @@ import { PublicPricing$inboundSchema } from "./publicpricing.js";
16
17
  import { TopProviderInfo$inboundSchema, } from "./topproviderinfo.js";
17
18
  /** @internal */
18
19
  export const Model$inboundSchema = z.object({
20
+ alias_target: ModelAliasTarget$inboundSchema.optional(),
19
21
  architecture: ModelArchitecture$inboundSchema,
20
22
  benchmarks: ModelBenchmarks$inboundSchema.optional(),
21
23
  canonical_slug: z.string(),
@@ -37,6 +39,7 @@ export const Model$inboundSchema = z.object({
37
39
  top_provider: TopProviderInfo$inboundSchema,
38
40
  }).transform((v) => {
39
41
  return remap$(v, {
42
+ "alias_target": "aliasTarget",
40
43
  "canonical_slug": "canonicalSlug",
41
44
  "context_length": "contextLength",
42
45
  "default_parameters": "defaultParameters",
@@ -0,0 +1,20 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ /**
5
+ * Concrete model targeted by this tilde-latest alias, when applicable
6
+ */
7
+ export type ModelAliasTarget = {
8
+ /**
9
+ * Human-readable name of the concrete model targeted by this alias
10
+ */
11
+ name: string;
12
+ /**
13
+ * Routable model ID of the concrete target, matching that model row's id
14
+ */
15
+ slug: string;
16
+ };
17
+ /** @internal */
18
+ export declare const ModelAliasTarget$inboundSchema: z.ZodType<ModelAliasTarget, unknown>;
19
+ export declare function modelAliasTargetFromJSON(jsonString: string): SafeParseResult<ModelAliasTarget, SDKValidationError>;
20
+ //# sourceMappingURL=modelaliastarget.d.ts.map
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 19d90882812d
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ /** @internal */
8
+ export const ModelAliasTarget$inboundSchema = z.object({
9
+ name: z.string(),
10
+ slug: z.string(),
11
+ });
12
+ export function modelAliasTargetFromJSON(jsonString) {
13
+ return safeParse(jsonString, (x) => ModelAliasTarget$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ModelAliasTarget' from JSON`);
14
+ }
15
+ //# sourceMappingURL=modelaliastarget.js.map
@@ -1,5 +1,9 @@
1
1
  import * as z from "zod/v4";
2
2
  export type UpsertWorkspaceBudgetRequest = {
3
+ /**
4
+ * Whether to include BYOK (bring-your-own-key) spend when enforcing the workspace's budgets. This is a workspace-wide setting: it applies to every budget interval (daily, weekly, monthly, and lifetime), not just the interval being upserted in this request. Omit to leave the current setting unchanged.
5
+ */
6
+ includeByokInBudgets?: boolean | undefined;
3
7
  /**
4
8
  * Spending limit in USD. Must be greater than 0.
5
9
  */
@@ -7,6 +11,7 @@ export type UpsertWorkspaceBudgetRequest = {
7
11
  };
8
12
  /** @internal */
9
13
  export type UpsertWorkspaceBudgetRequest$Outbound = {
14
+ include_byok_in_budgets?: boolean | undefined;
10
15
  limit_usd: number;
11
16
  };
12
17
  /** @internal */
@@ -6,9 +6,11 @@ import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
7
  /** @internal */
8
8
  export const UpsertWorkspaceBudgetRequest$outboundSchema = z.object({
9
+ includeByokInBudgets: z.boolean().optional(),
9
10
  limitUsd: z.number(),
10
11
  }).transform((v) => {
11
12
  return remap$(v, {
13
+ includeByokInBudgets: "include_byok_in_budgets",
12
14
  limitUsd: "limit_usd",
13
15
  });
14
16
  });
@@ -4,6 +4,10 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
4
  import { WorkspaceBudget } from "./workspacebudget.js";
5
5
  export type UpsertWorkspaceBudgetResponse = {
6
6
  data: WorkspaceBudget;
7
+ /**
8
+ * Whether BYOK (bring-your-own-key) spend is included when enforcing the workspace's budgets. This is a workspace-wide setting that applies to all budget intervals (daily, weekly, monthly, and lifetime).
9
+ */
10
+ includeByokInBudgets?: boolean | undefined;
7
11
  };
8
12
  /** @internal */
9
13
  export declare const UpsertWorkspaceBudgetResponse$inboundSchema: z.ZodType<UpsertWorkspaceBudgetResponse, unknown>;
@@ -3,11 +3,17 @@
3
3
  * @generated-id: ad34c44c01ce
4
4
  */
5
5
  import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
6
7
  import { safeParse } from "../lib/schemas.js";
7
8
  import { WorkspaceBudget$inboundSchema, } from "./workspacebudget.js";
8
9
  /** @internal */
9
10
  export const UpsertWorkspaceBudgetResponse$inboundSchema = z.object({
10
11
  data: WorkspaceBudget$inboundSchema,
12
+ include_byok_in_budgets: z.boolean().optional(),
13
+ }).transform((v) => {
14
+ return remap$(v, {
15
+ "include_byok_in_budgets": "includeByokInBudgets",
16
+ });
11
17
  });
12
18
  export function upsertWorkspaceBudgetResponseFromJSON(jsonString) {
13
19
  return safeParse(jsonString, (x) => UpsertWorkspaceBudgetResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpsertWorkspaceBudgetResponse' from JSON`);
@@ -34,6 +34,10 @@ export type Workspace = {
34
34
  * Unique identifier for the workspace
35
35
  */
36
36
  id: string;
37
+ /**
38
+ * Whether BYOK (bring-your-own-key) spend counts toward this workspace's budgets. Set it via the workspace budget endpoints.
39
+ */
40
+ includeByokInBudgets?: boolean | undefined;
37
41
  /**
38
42
  * Optional array of API key IDs to filter I/O logging. Null means all keys are logged.
39
43
  */
@@ -15,6 +15,7 @@ export const Workspace$inboundSchema = z.object({
15
15
  default_text_model: z.nullable(z.string()),
16
16
  description: z.nullable(z.string()),
17
17
  id: z.string(),
18
+ include_byok_in_budgets: z.boolean().optional(),
18
19
  io_logging_api_key_ids: z.nullable(z.array(z.int())),
19
20
  io_logging_sampling_rate: z.number(),
20
21
  is_data_discount_logging_enabled: z.boolean(),
@@ -31,6 +32,7 @@ export const Workspace$inboundSchema = z.object({
31
32
  "default_image_model": "defaultImageModel",
32
33
  "default_provider_sort": "defaultProviderSort",
33
34
  "default_text_model": "defaultTextModel",
35
+ "include_byok_in_budgets": "includeByokInBudgets",
34
36
  "io_logging_api_key_ids": "ioLoggingApiKeyIds",
35
37
  "io_logging_sampling_rate": "ioLoggingSamplingRate",
36
38
  "is_data_discount_logging_enabled": "isDataDiscountLoggingEnabled",
@@ -58,7 +58,7 @@ export declare class Workspaces extends ClientSDK {
58
58
  * Create or update a workspace budget
59
59
  *
60
60
  * @remarks
61
- * Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). [Management key](/docs/guides/overview/auth/management-api-keys) required.
61
+ * Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). The optional `include_byok_in_budgets` flag is a workspace-wide setting: when provided it applies to every budget interval for the workspace, not just the interval in this request. Note that a change made here is applied to budget enforcement immediately, but an already-open workspace settings page in the web dashboard may keep showing the previous value until it is reloaded. [Management key](/docs/guides/overview/auth/management-api-keys) required.
62
62
  */
63
63
  setBudget(request: operations.UpsertWorkspaceBudgetRequest, options?: RequestOptions): Promise<models.UpsertWorkspaceBudgetResponse>;
64
64
  /**
@@ -84,7 +84,7 @@ export class Workspaces extends ClientSDK {
84
84
  * Create or update a workspace budget
85
85
  *
86
86
  * @remarks
87
- * Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). [Management key](/docs/guides/overview/auth/management-api-keys) required.
87
+ * Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime > monthly > weekly > daily). The optional `include_byok_in_budgets` flag is a workspace-wide setting: when provided it applies to every budget interval for the workspace, not just the interval in this request. Note that a change made here is applied to budget enforcement immediately, but an already-open workspace settings page in the web dashboard may keep showing the previous value until it is reloaded. [Management key](/docs/guides/overview/auth/management-api-keys) required.
88
88
  */
89
89
  async setBudget(request, options) {
90
90
  return unwrapAsync(workspacesSetBudget(this, request, options));
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.1.19",
5
+ "version": "1.1.20",
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.19",
3
+ "version": "1.1.20",
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",
77
- "prepare": "npm run build",
78
- "test": "vitest --run --project unit",
76
+ "typecheck:transit": "exit 0",
79
77
  "test:transit": "exit 0",
80
78
  "test:watch": "vitest --watch --project unit",
79
+ "compile": "tsc",
81
80
  "postinstall": "node scripts/check-types.js || true",
81
+ "prepare": "npm run build",
82
+ "test": "vitest --run --project unit",
82
83
  "test:e2e": "vitest --run --project e2e",
83
- "typecheck": "tsc --noEmit",
84
- "typecheck:transit": "exit 0"
84
+ "typecheck": "tsc --noEmit"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {