@openrouter/sdk 1.2.96 → 1.2.98

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.
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
12
12
  * Create a new API key
13
13
  *
14
14
  * @remarks
15
- * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret. `external_user` and `external_api_key` are accepted only with a client secret, and `external_user` is required there; supplying either field with a management key is rejected with 403.
15
+ * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret.
16
16
  */
17
17
  export declare function apiKeysCreate(client: OpenRouterCore, request: operations.CreateKeysRequest, options?: RequestOptions): APIPromise<Result<operations.CreateKeysResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
18
  //# sourceMappingURL=apiKeysCreate.d.ts.map
@@ -16,7 +16,7 @@ import { APIPromise } from "../types/async.js";
16
16
  * Create a new API key
17
17
  *
18
18
  * @remarks
19
- * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret. `external_user` and `external_api_key` are accepted only with a client secret, and `external_user` is required there; supplying either field with a management key is rejected with 403.
19
+ * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret.
20
20
  */
21
21
  export function apiKeysCreate(client, request, options) {
22
22
  return new APIPromise($do(client, request, options));
@@ -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.2.96";
53
+ readonly sdkVersion: "1.2.98";
54
54
  readonly genVersion: "2.914.0";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.2.96 2.914.0 1.0.0 @openrouter/sdk";
55
+ readonly userAgent: "speakeasy-sdk/typescript 1.2.98 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.2.96",
32
+ sdkVersion: "1.2.98",
33
33
  genVersion: "2.914.0",
34
- userAgent: "speakeasy-sdk/typescript 1.2.96 2.914.0 1.0.0 @openrouter/sdk",
34
+ userAgent: "speakeasy-sdk/typescript 1.2.98 2.914.0 1.0.0 @openrouter/sdk",
35
35
  };
36
36
  //# sourceMappingURL=config.js.map
@@ -1,8 +1,13 @@
1
1
  import * as z from "zod/v4";
2
2
  import { ContentFilterBuiltinEntryInput, ContentFilterBuiltinEntryInput$Outbound } from "./contentfilterbuiltinentryinput.js";
3
3
  import { ContentFilterEntry, ContentFilterEntry$Outbound } from "./contentfilterentry.js";
4
+ import { GuardrailDataRegion } from "./guardraildataregion.js";
4
5
  import { GuardrailInterval } from "./guardrailinterval.js";
5
6
  export type CreateGuardrailRequest = {
7
+ /**
8
+ * Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected.
9
+ */
10
+ allowedDataRegions?: Array<GuardrailDataRegion> | null | undefined;
6
11
  /**
7
12
  * Array of model identifiers (slug or canonical_slug accepted)
8
13
  */
@@ -92,6 +97,7 @@ export type CreateGuardrailRequest = {
92
97
  };
93
98
  /** @internal */
94
99
  export type CreateGuardrailRequest$Outbound = {
100
+ allowed_data_regions?: Array<string> | null | undefined;
95
101
  allowed_models?: Array<string> | null | undefined;
96
102
  allowed_providers?: Array<string> | null | undefined;
97
103
  content_filter_builtins?: Array<ContentFilterBuiltinEntryInput$Outbound> | null | undefined;
@@ -6,9 +6,12 @@ import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
7
  import { ContentFilterBuiltinEntryInput$outboundSchema, } from "./contentfilterbuiltinentryinput.js";
8
8
  import { ContentFilterEntry$outboundSchema, } from "./contentfilterentry.js";
9
+ import { GuardrailDataRegion$outboundSchema, } from "./guardraildataregion.js";
9
10
  import { GuardrailInterval$outboundSchema, } from "./guardrailinterval.js";
10
11
  /** @internal */
11
12
  export const CreateGuardrailRequest$outboundSchema = z.object({
13
+ allowedDataRegions: z.nullable(z.array(GuardrailDataRegion$outboundSchema))
14
+ .optional(),
12
15
  allowedModels: z.nullable(z.array(z.string())).optional(),
13
16
  allowedProviders: z.nullable(z.array(z.string())).optional(),
14
17
  contentFilterBuiltins: z.nullable(z.array(ContentFilterBuiltinEntryInput$outboundSchema)).optional(),
@@ -33,6 +36,7 @@ export const CreateGuardrailRequest$outboundSchema = z.object({
33
36
  workspaceId: z.string().optional(),
34
37
  }).transform((v) => {
35
38
  return remap$(v, {
39
+ allowedDataRegions: "allowed_data_regions",
36
40
  allowedModels: "allowed_models",
37
41
  allowedProviders: "allowed_providers",
38
42
  contentFilterBuiltins: "content_filter_builtins",
@@ -3,8 +3,13 @@ import { Result as SafeParseResult } from "../types/fp.js";
3
3
  import { ContentFilterBuiltinEntry } from "./contentfilterbuiltinentry.js";
4
4
  import { ContentFilterEntry } from "./contentfilterentry.js";
5
5
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
6
+ import { GuardrailDataRegion } from "./guardraildataregion.js";
6
7
  import { GuardrailInterval } from "./guardrailinterval.js";
7
8
  export type Guardrail = {
9
+ /**
10
+ * Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value.
11
+ */
12
+ allowedDataRegions?: Array<GuardrailDataRegion> | null | undefined;
8
13
  /**
9
14
  * Array of model canonical_slugs (immutable identifiers)
10
15
  */
@@ -7,9 +7,12 @@ import { remap as remap$ } from "../lib/primitives.js";
7
7
  import { safeParse } from "../lib/schemas.js";
8
8
  import { ContentFilterBuiltinEntry$inboundSchema, } from "./contentfilterbuiltinentry.js";
9
9
  import { ContentFilterEntry$inboundSchema, } from "./contentfilterentry.js";
10
+ import { GuardrailDataRegion$inboundSchema, } from "./guardraildataregion.js";
10
11
  import { GuardrailInterval$inboundSchema, } from "./guardrailinterval.js";
11
12
  /** @internal */
12
13
  export const Guardrail$inboundSchema = z.object({
14
+ allowed_data_regions: z.nullable(z.array(GuardrailDataRegion$inboundSchema))
15
+ .optional(),
13
16
  allowed_models: z.nullable(z.array(z.string())).optional(),
14
17
  allowed_providers: z.nullable(z.array(z.string())).optional(),
15
18
  content_filter_builtins: z.nullable(z.array(ContentFilterBuiltinEntry$inboundSchema)).optional(),
@@ -37,6 +40,7 @@ export const Guardrail$inboundSchema = z.object({
37
40
  workspace_id: z.nullable(z.string()),
38
41
  }).transform((v) => {
39
42
  return remap$(v, {
43
+ "allowed_data_regions": "allowedDataRegions",
40
44
  "allowed_models": "allowedModels",
41
45
  "allowed_providers": "allowedProviders",
42
46
  "content_filter_builtins": "contentFilterBuiltins",
@@ -0,0 +1,19 @@
1
+ import * as z from "zod/v4";
2
+ import { OpenEnum } from "../types/enums.js";
3
+ /**
4
+ * An OpenRouter data region: `global` (https://openrouter.ai), `europe` (https://eu.openrouter.ai), or `us` (https://us.openrouter.ai)
5
+ */
6
+ export declare const GuardrailDataRegion: {
7
+ readonly Global: "global";
8
+ readonly Europe: "europe";
9
+ readonly Us: "us";
10
+ };
11
+ /**
12
+ * An OpenRouter data region: `global` (https://openrouter.ai), `europe` (https://eu.openrouter.ai), or `us` (https://us.openrouter.ai)
13
+ */
14
+ export type GuardrailDataRegion = OpenEnum<typeof GuardrailDataRegion>;
15
+ /** @internal */
16
+ export declare const GuardrailDataRegion$inboundSchema: z.ZodType<GuardrailDataRegion, unknown>;
17
+ /** @internal */
18
+ export declare const GuardrailDataRegion$outboundSchema: z.ZodType<string, GuardrailDataRegion>;
19
+ //# sourceMappingURL=guardraildataregion.d.ts.map
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 5e2e4801b177
4
+ */
5
+ import * as openEnums from "../types/enums.js";
6
+ /**
7
+ * An OpenRouter data region: `global` (https://openrouter.ai), `europe` (https://eu.openrouter.ai), or `us` (https://us.openrouter.ai)
8
+ */
9
+ export const GuardrailDataRegion = {
10
+ Global: "global",
11
+ Europe: "europe",
12
+ Us: "us",
13
+ };
14
+ /** @internal */
15
+ export const GuardrailDataRegion$inboundSchema = openEnums.inboundSchema(GuardrailDataRegion);
16
+ /** @internal */
17
+ export const GuardrailDataRegion$outboundSchema = openEnums.outboundSchema(GuardrailDataRegion);
18
+ //# sourceMappingURL=guardraildataregion.js.map
@@ -257,6 +257,7 @@ export * from "./getscimgroupmappingresponse.js";
257
257
  export * from "./getworkspacebudgetresponse.js";
258
258
  export * from "./getworkspaceresponse.js";
259
259
  export * from "./guardrail.js";
260
+ export * from "./guardraildataregion.js";
260
261
  export * from "./guardrailinterval.js";
261
262
  export * from "./imageconfig.js";
262
263
  export * from "./imageendpoint.js";
@@ -261,6 +261,7 @@ export * from "./getscimgroupmappingresponse.js";
261
261
  export * from "./getworkspacebudgetresponse.js";
262
262
  export * from "./getworkspaceresponse.js";
263
263
  export * from "./guardrail.js";
264
+ export * from "./guardraildataregion.js";
264
265
  export * from "./guardrailinterval.js";
265
266
  export * from "./imageconfig.js";
266
267
  export * from "./imageendpoint.js";
@@ -44,14 +44,6 @@ export type CreateKeysRequestBody = {
44
44
  * Optional ISO 8601 UTC expiration timestamp. Must include seconds (YYYY-MM-DDTHH:MM:SSZ; fractional seconds allowed); minute-precision timestamps are rejected.
45
45
  */
46
46
  expiresAt?: Date | null | undefined;
47
- /**
48
- * Optional partner-supplied API key. Stored as a SHA-256 hash and never returned. Accepted only when authenticating with a Connect client secret; supplying it with a management key is rejected with 403.
49
- */
50
- externalApiKey?: string | undefined;
51
- /**
52
- * Partner's end-user identifier for attribution, between 1 and 512 characters. Accepted only when authenticating with a Connect client secret, where it is required; supplying it with a management key is rejected with 403.
53
- */
54
- externalUser?: string | undefined;
55
47
  /**
56
48
  * Whether to include BYOK usage in the limit
57
49
  */
@@ -207,8 +199,6 @@ export declare const CreateKeysLimitReset$outboundSchema: z.ZodType<string, Crea
207
199
  export type CreateKeysRequestBody$Outbound = {
208
200
  creator_user_id?: string | null | undefined;
209
201
  expires_at?: string | null | undefined;
210
- external_api_key?: string | undefined;
211
- external_user?: string | undefined;
212
202
  include_byok_in_limit?: boolean | undefined;
213
203
  limit?: number | null | undefined;
214
204
  limit_reset?: string | null | undefined;
@@ -20,8 +20,6 @@ export const CreateKeysLimitReset$outboundSchema = openEnums.outboundSchema(Crea
20
20
  export const CreateKeysRequestBody$outboundSchema = z.object({
21
21
  creatorUserId: z.nullable(z.string()).optional(),
22
22
  expiresAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
23
- externalApiKey: z.string().optional(),
24
- externalUser: z.string().optional(),
25
23
  includeByokInLimit: z.boolean().optional(),
26
24
  limit: z.nullable(z.number()).optional(),
27
25
  limitReset: z.nullable(CreateKeysLimitReset$outboundSchema).optional(),
@@ -31,8 +29,6 @@ export const CreateKeysRequestBody$outboundSchema = z.object({
31
29
  return remap$(v, {
32
30
  creatorUserId: "creator_user_id",
33
31
  expiresAt: "expires_at",
34
- externalApiKey: "external_api_key",
35
- externalUser: "external_user",
36
32
  includeByokInLimit: "include_byok_in_limit",
37
33
  limitReset: "limit_reset",
38
34
  workspaceId: "workspace_id",
@@ -1,8 +1,13 @@
1
1
  import * as z from "zod/v4";
2
2
  import { ContentFilterBuiltinEntryInput, ContentFilterBuiltinEntryInput$Outbound } from "./contentfilterbuiltinentryinput.js";
3
3
  import { ContentFilterEntry, ContentFilterEntry$Outbound } from "./contentfilterentry.js";
4
+ import { GuardrailDataRegion } from "./guardraildataregion.js";
4
5
  import { GuardrailInterval } from "./guardrailinterval.js";
5
6
  export type UpdateGuardrailRequest = {
7
+ /**
8
+ * Data regions through which requests governed by this guardrail must arrive. `global` is https://openrouter.ai, `europe` is https://eu.openrouter.ai, and `us` is https://us.openrouter.ai. Requests arriving through any other region are rejected. `null` leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected.
9
+ */
10
+ allowedDataRegions?: Array<GuardrailDataRegion> | null | undefined;
6
11
  /**
7
12
  * Array of model identifiers (slug or canonical_slug accepted)
8
13
  */
@@ -88,6 +93,7 @@ export type UpdateGuardrailRequest = {
88
93
  };
89
94
  /** @internal */
90
95
  export type UpdateGuardrailRequest$Outbound = {
96
+ allowed_data_regions?: Array<string> | null | undefined;
91
97
  allowed_models?: Array<string> | null | undefined;
92
98
  allowed_providers?: Array<string> | null | undefined;
93
99
  content_filter_builtins?: Array<ContentFilterBuiltinEntryInput$Outbound> | null | undefined;
@@ -6,9 +6,12 @@ import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
7
  import { ContentFilterBuiltinEntryInput$outboundSchema, } from "./contentfilterbuiltinentryinput.js";
8
8
  import { ContentFilterEntry$outboundSchema, } from "./contentfilterentry.js";
9
+ import { GuardrailDataRegion$outboundSchema, } from "./guardraildataregion.js";
9
10
  import { GuardrailInterval$outboundSchema, } from "./guardrailinterval.js";
10
11
  /** @internal */
11
12
  export const UpdateGuardrailRequest$outboundSchema = z.object({
13
+ allowedDataRegions: z.nullable(z.array(GuardrailDataRegion$outboundSchema))
14
+ .optional(),
12
15
  allowedModels: z.nullable(z.array(z.string())).optional(),
13
16
  allowedProviders: z.nullable(z.array(z.string())).optional(),
14
17
  contentFilterBuiltins: z.nullable(z.array(ContentFilterBuiltinEntryInput$outboundSchema)).optional(),
@@ -32,6 +35,7 @@ export const UpdateGuardrailRequest$outboundSchema = z.object({
32
35
  resetInterval: z.nullable(GuardrailInterval$outboundSchema).optional(),
33
36
  }).transform((v) => {
34
37
  return remap$(v, {
38
+ allowedDataRegions: "allowed_data_regions",
35
39
  allowedModels: "allowed_models",
36
40
  allowedProviders: "allowed_providers",
37
41
  contentFilterBuiltins: "content_filter_builtins",
@@ -19,7 +19,7 @@ export declare class APIKeys extends ClientSDK {
19
19
  * Create a new API key
20
20
  *
21
21
  * @remarks
22
- * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret. `external_user` and `external_api_key` are accepted only with a client secret, and `external_user` is required there; supplying either field with a management key is rejected with 403.
22
+ * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret.
23
23
  */
24
24
  create(request: operations.CreateKeysRequest, options?: RequestOptions): Promise<operations.CreateKeysResponse>;
25
25
  /**
@@ -33,7 +33,7 @@ export class APIKeys extends ClientSDK {
33
33
  * Create a new API key
34
34
  *
35
35
  * @remarks
36
- * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret. `external_user` and `external_api_key` are accepted only with a client secret, and `external_user` is required there; supplying either field with a management key is rejected with 403.
36
+ * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret.
37
37
  */
38
38
  async create(request, options) {
39
39
  return unwrapAsync(apiKeysCreate(this, request, options));
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.2.96",
5
+ "version": "1.2.98",
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.2.96",
3
+ "version": "1.2.98",
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
- "postinstall": "node scripts/check-types.js || true",
77
- "prepare": "npm run build",
78
- "test:watch": "vitest --watch --project unit",
79
- "typecheck:transit": "exit 0",
80
- "compile": "tsc",
81
76
  "test": "vitest --run --project unit",
82
77
  "test:e2e": "vitest --run --project e2e",
78
+ "typecheck": "tsc --noEmit",
79
+ "typecheck:transit": "exit 0",
80
+ "compile": "tsc",
81
+ "postinstall": "node scripts/check-types.js || true",
83
82
  "test:transit": "exit 0",
84
- "typecheck": "tsc --noEmit"
83
+ "test:watch": "vitest --watch --project unit",
84
+ "prepare": "npm run build"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {