@openrouter/sdk 1.4.22 → 1.4.24
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/funcs/byokUpdate.d.ts +1 -1
- package/esm/funcs/byokUpdate.js +2 -2
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/byokkey.d.ts +19 -0
- package/esm/models/byokkey.js +13 -0
- package/esm/models/createbyokkeyrequest.d.ts +20 -0
- package/esm/models/createbyokkeyrequest.js +14 -0
- package/esm/models/switchyardrouterplugin.d.ts +5 -0
- package/esm/models/switchyardrouterplugin.js +6 -0
- package/esm/models/updatebyokkeyrequest.d.ts +20 -0
- package/esm/models/updatebyokkeyrequest.js +14 -0
- package/jsr.json +1 -1
- package/package.json +6 -6
|
@@ -15,5 +15,5 @@ import { Result } from "../types/fp.js";
|
|
|
15
15
|
* @remarks
|
|
16
16
|
* Update an existing bring-your-own-key (BYOK) provider credential by its `id`. Include the `key` field to rotate the raw provider API key in-place (the previous key material is overwritten). Use `allowed_api_key_hashes` to restrict the credential to specific OpenRouter API keys (`null` clears the restriction). [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
17
|
*/
|
|
18
|
-
export declare function byokUpdate(client: OpenRouterCore, request: operations.UpdateBYOKKeyRequest, options?: RequestOptions): APIPromise<Result<models.UpdateBYOKKeyResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
export declare function byokUpdate(client: OpenRouterCore, request: operations.UpdateBYOKKeyRequest, options?: RequestOptions): APIPromise<Result<models.UpdateBYOKKeyResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.ConflictResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
19
|
//# sourceMappingURL=byokUpdate.d.ts.map
|
package/esm/funcs/byokUpdate.js
CHANGED
|
@@ -9,7 +9,7 @@ import { compactMap } from "../lib/primitives.js";
|
|
|
9
9
|
import { safeParse } from "../lib/schemas.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
12
|
-
import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
|
|
12
|
+
import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { ConflictResponseError$inboundSchema as errors_ConflictResponseError$inboundSchema } from "../models/errors/conflictresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
|
|
13
13
|
import { UpdateBYOKKeyResponse$inboundSchema as models_UpdateBYOKKeyResponse$inboundSchema } from "../models/updatebyokkeyresponse.js";
|
|
14
14
|
import { UpdateBYOKKeyRequest$outboundSchema as operations_UpdateBYOKKeyRequest$outboundSchema } from "../models/operations/updatebyokkey.js";
|
|
15
15
|
import { APIPromise } from "../types/async.js";
|
|
@@ -97,7 +97,7 @@ async function $do(client, request, options) {
|
|
|
97
97
|
const responseFields = {
|
|
98
98
|
HttpMeta: { Response: response, Request: req },
|
|
99
99
|
};
|
|
100
|
-
const [result] = await M.match(M.json(200, models_UpdateBYOKKeyResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
100
|
+
const [result] = await M.match(M.json(200, models_UpdateBYOKKeyResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(409, errors_ConflictResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
101
101
|
if (!result.ok) {
|
|
102
102
|
return [result, { status: "complete", request: req, response }];
|
|
103
103
|
}
|
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.24";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.4.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.4.24 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.24",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.4.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.4.24 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
package/esm/models/byokkey.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
2
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
4
|
import { BYOKProviderSlug } from "./byokproviderslug.js";
|
|
4
5
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
6
|
+
/**
|
|
7
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BYOKKeyDeclaredRegion: {
|
|
10
|
+
readonly Global: "global";
|
|
11
|
+
readonly Europe: "europe";
|
|
12
|
+
readonly Us: "us";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`.
|
|
16
|
+
*/
|
|
17
|
+
export type BYOKKeyDeclaredRegion = OpenEnum<typeof BYOKKeyDeclaredRegion>;
|
|
5
18
|
export type BYOKKey = {
|
|
6
19
|
/**
|
|
7
20
|
* Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction.
|
|
@@ -19,6 +32,10 @@ export type BYOKKey = {
|
|
|
19
32
|
* ISO timestamp of when the credential was created.
|
|
20
33
|
*/
|
|
21
34
|
createdAt: string;
|
|
35
|
+
/**
|
|
36
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`.
|
|
37
|
+
*/
|
|
38
|
+
declaredRegion: BYOKKeyDeclaredRegion | null;
|
|
22
39
|
/**
|
|
23
40
|
* Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter.
|
|
24
41
|
*/
|
|
@@ -65,6 +82,8 @@ export type BYOKKey = {
|
|
|
65
82
|
workspaceId: string | null;
|
|
66
83
|
};
|
|
67
84
|
/** @internal */
|
|
85
|
+
export declare const BYOKKeyDeclaredRegion$inboundSchema: z.ZodType<BYOKKeyDeclaredRegion, unknown>;
|
|
86
|
+
/** @internal */
|
|
68
87
|
export declare const BYOKKey$inboundSchema: z.ZodType<BYOKKey, unknown>;
|
|
69
88
|
export declare function byokKeyFromJSON(jsonString: string): SafeParseResult<BYOKKey, SDKValidationError>;
|
|
70
89
|
//# sourceMappingURL=byokkey.d.ts.map
|
package/esm/models/byokkey.js
CHANGED
|
@@ -5,13 +5,25 @@
|
|
|
5
5
|
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
|
+
import * as openEnums from "../types/enums.js";
|
|
8
9
|
import { BYOKProviderSlug$inboundSchema, } from "./byokproviderslug.js";
|
|
10
|
+
/**
|
|
11
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`.
|
|
12
|
+
*/
|
|
13
|
+
export const BYOKKeyDeclaredRegion = {
|
|
14
|
+
Global: "global",
|
|
15
|
+
Europe: "europe",
|
|
16
|
+
Us: "us",
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const BYOKKeyDeclaredRegion$inboundSchema = openEnums.inboundSchema(BYOKKeyDeclaredRegion);
|
|
9
20
|
/** @internal */
|
|
10
21
|
export const BYOKKey$inboundSchema = z.object({
|
|
11
22
|
allowed_api_key_hashes: z.nullable(z.array(z.string())),
|
|
12
23
|
allowed_models: z.nullable(z.array(z.string())),
|
|
13
24
|
allowed_user_ids: z.nullable(z.array(z.string())),
|
|
14
25
|
created_at: z.string(),
|
|
26
|
+
declared_region: z.nullable(BYOKKeyDeclaredRegion$inboundSchema),
|
|
15
27
|
declared_zdr: z.nullable(z.boolean()),
|
|
16
28
|
disabled: z.boolean(),
|
|
17
29
|
id: z.string(),
|
|
@@ -29,6 +41,7 @@ export const BYOKKey$inboundSchema = z.object({
|
|
|
29
41
|
"allowed_models": "allowedModels",
|
|
30
42
|
"allowed_user_ids": "allowedUserIds",
|
|
31
43
|
"created_at": "createdAt",
|
|
44
|
+
"declared_region": "declaredRegion",
|
|
32
45
|
"declared_zdr": "declaredZdr",
|
|
33
46
|
"is_byok_only": "isByokOnly",
|
|
34
47
|
"is_fallback": "isFallback",
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
2
3
|
import { BYOKProviderSlug } from "./byokproviderslug.js";
|
|
4
|
+
/**
|
|
5
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`. Defaults to the key's region for OpenAI and Fireworks, otherwise `null`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CreateBYOKKeyRequestDeclaredRegion: {
|
|
8
|
+
readonly Global: "global";
|
|
9
|
+
readonly Europe: "europe";
|
|
10
|
+
readonly Us: "us";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`. Defaults to the key's region for OpenAI and Fireworks, otherwise `null`.
|
|
14
|
+
*/
|
|
15
|
+
export type CreateBYOKKeyRequestDeclaredRegion = OpenEnum<typeof CreateBYOKKeyRequestDeclaredRegion>;
|
|
3
16
|
export type CreateBYOKKeyRequest = {
|
|
4
17
|
/**
|
|
5
18
|
* Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400.
|
|
@@ -13,6 +26,10 @@ export type CreateBYOKKeyRequest = {
|
|
|
13
26
|
* Optional allowlist of user IDs that may use this credential. `null` means no restriction.
|
|
14
27
|
*/
|
|
15
28
|
allowedUserIds?: Array<string> | null | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`. Defaults to the key's region for OpenAI and Fireworks, otherwise `null`.
|
|
31
|
+
*/
|
|
32
|
+
declaredRegion?: CreateBYOKKeyRequestDeclaredRegion | null | undefined;
|
|
16
33
|
/**
|
|
17
34
|
* Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Defaults to `null`.
|
|
18
35
|
*/
|
|
@@ -51,10 +68,13 @@ export type CreateBYOKKeyRequest = {
|
|
|
51
68
|
workspaceId?: string | undefined;
|
|
52
69
|
};
|
|
53
70
|
/** @internal */
|
|
71
|
+
export declare const CreateBYOKKeyRequestDeclaredRegion$outboundSchema: z.ZodType<string, CreateBYOKKeyRequestDeclaredRegion>;
|
|
72
|
+
/** @internal */
|
|
54
73
|
export type CreateBYOKKeyRequest$Outbound = {
|
|
55
74
|
allowed_api_key_hashes?: Array<string> | null | undefined;
|
|
56
75
|
allowed_models?: Array<string> | null | undefined;
|
|
57
76
|
allowed_user_ids?: Array<string> | null | undefined;
|
|
77
|
+
declared_region?: string | null | undefined;
|
|
58
78
|
declared_zdr?: boolean | null | undefined;
|
|
59
79
|
disabled?: boolean | undefined;
|
|
60
80
|
is_byok_only?: boolean | undefined;
|
|
@@ -4,12 +4,25 @@
|
|
|
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";
|
|
7
8
|
import { BYOKProviderSlug$outboundSchema, } from "./byokproviderslug.js";
|
|
9
|
+
/**
|
|
10
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`. Defaults to the key's region for OpenAI and Fireworks, otherwise `null`.
|
|
11
|
+
*/
|
|
12
|
+
export const CreateBYOKKeyRequestDeclaredRegion = {
|
|
13
|
+
Global: "global",
|
|
14
|
+
Europe: "europe",
|
|
15
|
+
Us: "us",
|
|
16
|
+
};
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const CreateBYOKKeyRequestDeclaredRegion$outboundSchema = openEnums.outboundSchema(CreateBYOKKeyRequestDeclaredRegion);
|
|
8
19
|
/** @internal */
|
|
9
20
|
export const CreateBYOKKeyRequest$outboundSchema = z.object({
|
|
10
21
|
allowedApiKeyHashes: z.nullable(z.array(z.string())).optional(),
|
|
11
22
|
allowedModels: z.nullable(z.array(z.string())).optional(),
|
|
12
23
|
allowedUserIds: z.nullable(z.array(z.string())).optional(),
|
|
24
|
+
declaredRegion: z.nullable(CreateBYOKKeyRequestDeclaredRegion$outboundSchema)
|
|
25
|
+
.optional(),
|
|
13
26
|
declaredZdr: z.nullable(z.boolean()).optional(),
|
|
14
27
|
disabled: z.boolean().optional(),
|
|
15
28
|
isByokOnly: z.boolean().optional(),
|
|
@@ -24,6 +37,7 @@ export const CreateBYOKKeyRequest$outboundSchema = z.object({
|
|
|
24
37
|
allowedApiKeyHashes: "allowed_api_key_hashes",
|
|
25
38
|
allowedModels: "allowed_models",
|
|
26
39
|
allowedUserIds: "allowed_user_ids",
|
|
40
|
+
declaredRegion: "declared_region",
|
|
27
41
|
declaredZdr: "declared_zdr",
|
|
28
42
|
isByokOnly: "is_byok_only",
|
|
29
43
|
isFallback: "is_fallback",
|
|
@@ -21,6 +21,10 @@ export type SwitchyardRouterPlugin = {
|
|
|
21
21
|
*/
|
|
22
22
|
algorithm?: Algorithm | undefined;
|
|
23
23
|
id: "switchyard-router";
|
|
24
|
+
/**
|
|
25
|
+
* The model that runs the judge call for the judge-backed algorithms ("capability", "stage", and "composite"). The model must support structured outputs and have a provider that your account and request settings allow. Otherwise, the request uses the platform default judge, google/gemini-2.5-flash-lite, and reports the reason in the routing metadata. The judge call is billed to you like any other request.
|
|
26
|
+
*/
|
|
27
|
+
judgeModel?: string | undefined;
|
|
24
28
|
};
|
|
25
29
|
/** @internal */
|
|
26
30
|
export declare const Algorithm$outboundSchema: z.ZodType<string, Algorithm>;
|
|
@@ -28,6 +32,7 @@ export declare const Algorithm$outboundSchema: z.ZodType<string, Algorithm>;
|
|
|
28
32
|
export type SwitchyardRouterPlugin$Outbound = {
|
|
29
33
|
algorithm?: string | undefined;
|
|
30
34
|
id: "switchyard-router";
|
|
35
|
+
judge_model?: string | undefined;
|
|
31
36
|
};
|
|
32
37
|
/** @internal */
|
|
33
38
|
export declare const SwitchyardRouterPlugin$outboundSchema: z.ZodType<SwitchyardRouterPlugin$Outbound, SwitchyardRouterPlugin>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @generated-id: 90395eb02944
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
7
|
import * as openEnums from "../types/enums.js";
|
|
7
8
|
/**
|
|
8
9
|
* Routing algorithm for this request. "capability" calls a small judge model to rate how demanding the task is, then picks the efficient or capable candidate. "stage" reads the tool-result history (errors, repeated failures, edits landing) and calls the judge only when those signals are undecided. "auto" is "stage" without the judge call. "random" picks one candidate at random. "composite" keeps the tier chosen on the last human turn and re-evaluates tool turns with the stage signals. "passthrough" serves the eligible candidates in the order OpenRouter already ranked them, with no routing decision and no judge call. Omit this field to use the platform default, stage.
|
|
@@ -22,6 +23,11 @@ export const Algorithm$outboundSchema = openEnums
|
|
|
22
23
|
export const SwitchyardRouterPlugin$outboundSchema = z.object({
|
|
23
24
|
algorithm: Algorithm$outboundSchema.optional(),
|
|
24
25
|
id: z.literal("switchyard-router"),
|
|
26
|
+
judgeModel: z.string().optional(),
|
|
27
|
+
}).transform((v) => {
|
|
28
|
+
return remap$(v, {
|
|
29
|
+
judgeModel: "judge_model",
|
|
30
|
+
});
|
|
25
31
|
});
|
|
26
32
|
export function switchyardRouterPluginToJSON(switchyardRouterPlugin) {
|
|
27
33
|
return JSON.stringify(SwitchyardRouterPlugin$outboundSchema.parse(switchyardRouterPlugin));
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
/**
|
|
4
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`. Omit to leave the stored value unchanged (rotating an OpenAI or Fireworks `key` re-derives it from the new key); `null` clears the declaration.
|
|
5
|
+
*/
|
|
6
|
+
export declare const UpdateBYOKKeyRequestDeclaredRegion: {
|
|
7
|
+
readonly Global: "global";
|
|
8
|
+
readonly Europe: "europe";
|
|
9
|
+
readonly Us: "us";
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`. Omit to leave the stored value unchanged (rotating an OpenAI or Fireworks `key` re-derives it from the new key); `null` clears the declaration.
|
|
13
|
+
*/
|
|
14
|
+
export type UpdateBYOKKeyRequestDeclaredRegion = OpenEnum<typeof UpdateBYOKKeyRequestDeclaredRegion>;
|
|
2
15
|
export type UpdateBYOKKeyRequest = {
|
|
3
16
|
/**
|
|
4
17
|
* Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` clears the restriction. Must contain at least one hash if provided. Hashes that do not belong to your account return a 400.
|
|
@@ -12,6 +25,10 @@ export type UpdateBYOKKeyRequest = {
|
|
|
12
25
|
* Optional allowlist of user IDs that may use this credential. `null` means no restriction.
|
|
13
26
|
*/
|
|
14
27
|
allowedUserIds?: Array<string> | null | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`. Omit to leave the stored value unchanged (rotating an OpenAI or Fireworks `key` re-derives it from the new key); `null` clears the declaration.
|
|
30
|
+
*/
|
|
31
|
+
declaredRegion?: UpdateBYOKKeyRequestDeclaredRegion | null | undefined;
|
|
15
32
|
/**
|
|
16
33
|
* Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Omit to leave the stored value unchanged; `null` clears the declaration.
|
|
17
34
|
*/
|
|
@@ -42,10 +59,13 @@ export type UpdateBYOKKeyRequest = {
|
|
|
42
59
|
name?: string | null | undefined;
|
|
43
60
|
};
|
|
44
61
|
/** @internal */
|
|
62
|
+
export declare const UpdateBYOKKeyRequestDeclaredRegion$outboundSchema: z.ZodType<string, UpdateBYOKKeyRequestDeclaredRegion>;
|
|
63
|
+
/** @internal */
|
|
45
64
|
export type UpdateBYOKKeyRequest$Outbound = {
|
|
46
65
|
allowed_api_key_hashes?: Array<string> | null | undefined;
|
|
47
66
|
allowed_models?: Array<string> | null | undefined;
|
|
48
67
|
allowed_user_ids?: Array<string> | null | undefined;
|
|
68
|
+
declared_region?: string | null | undefined;
|
|
49
69
|
declared_zdr?: boolean | null | undefined;
|
|
50
70
|
disabled?: boolean | undefined;
|
|
51
71
|
is_byok_only?: boolean | undefined;
|
|
@@ -4,11 +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
|
+
* Your declaration of the data region in which the upstream provider account behind this credential processes requests, used for routing eligibility on OpenRouter's regional hosts. `null` means undeclared and `global` is behaviorally identical: the credential follows the region OpenRouter records for the endpoint. `europe` or `us` lets requests to `eu.openrouter.ai` or `us.openrouter.ai` use this credential for that provider (private endpoints, endpoints pinned to another cloud region, cross-region inference profiles and video models are excluded). Self-declared and not verified by OpenRouter. For OpenAI and Fireworks the region comes from the key material (a `{"api_key": ..., "region": ...}` key), so the value must match the key's region. Among other providers, only Azure accepts `europe` or `us`. Omit to leave the stored value unchanged (rotating an OpenAI or Fireworks `key` re-derives it from the new key); `null` clears the declaration.
|
|
10
|
+
*/
|
|
11
|
+
export const UpdateBYOKKeyRequestDeclaredRegion = {
|
|
12
|
+
Global: "global",
|
|
13
|
+
Europe: "europe",
|
|
14
|
+
Us: "us",
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const UpdateBYOKKeyRequestDeclaredRegion$outboundSchema = openEnums.outboundSchema(UpdateBYOKKeyRequestDeclaredRegion);
|
|
7
18
|
/** @internal */
|
|
8
19
|
export const UpdateBYOKKeyRequest$outboundSchema = z.object({
|
|
9
20
|
allowedApiKeyHashes: z.nullable(z.array(z.string())).optional(),
|
|
10
21
|
allowedModels: z.nullable(z.array(z.string())).optional(),
|
|
11
22
|
allowedUserIds: z.nullable(z.array(z.string())).optional(),
|
|
23
|
+
declaredRegion: z.nullable(UpdateBYOKKeyRequestDeclaredRegion$outboundSchema)
|
|
24
|
+
.optional(),
|
|
12
25
|
declaredZdr: z.nullable(z.boolean()).optional(),
|
|
13
26
|
disabled: z.boolean().optional(),
|
|
14
27
|
isByokOnly: z.boolean().optional(),
|
|
@@ -21,6 +34,7 @@ export const UpdateBYOKKeyRequest$outboundSchema = z.object({
|
|
|
21
34
|
allowedApiKeyHashes: "allowed_api_key_hashes",
|
|
22
35
|
allowedModels: "allowed_models",
|
|
23
36
|
allowedUserIds: "allowed_user_ids",
|
|
37
|
+
declaredRegion: "declared_region",
|
|
24
38
|
declaredZdr: "declared_zdr",
|
|
25
39
|
isByokOnly: "is_byok_only",
|
|
26
40
|
isFallback: "is_fallback",
|
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.24",
|
|
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 && node scripts/unbarrel-imports.js",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"test": "vitest --run --project unit",
|
|
77
|
-
"test:transit": "exit 0",
|
|
78
|
-
"typecheck": "tsc --noEmit",
|
|
79
76
|
"typecheck:transit": "exit 0",
|
|
80
77
|
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
78
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
79
|
+
"test": "vitest --run --project unit",
|
|
81
80
|
"test:e2e": "vitest --run --project e2e",
|
|
81
|
+
"test:transit": "exit 0",
|
|
82
|
+
"prepare": "npm run build",
|
|
82
83
|
"test:watch": "vitest --watch --project unit",
|
|
83
|
-
"
|
|
84
|
-
"prepare": "npm run build"
|
|
84
|
+
"typecheck": "tsc --noEmit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|