@openrouter/sdk 1.2.97 → 1.2.99
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/oAuthCreateOauthToken.d.ts +19 -0
- package/esm/funcs/oAuthCreateOauthToken.js +100 -0
- package/esm/funcs/oAuthListOauthJwks.d.ts +19 -0
- package/esm/funcs/oAuthListOauthJwks.js +97 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/createguardrailrequest.d.ts +6 -0
- package/esm/models/createguardrailrequest.js +4 -0
- package/esm/models/errors/index.d.ts +1 -0
- package/esm/models/errors/index.js +1 -0
- package/esm/models/errors/oautherrorresponse.d.ts +27 -0
- package/esm/models/errors/oautherrorresponse.js +42 -0
- package/esm/models/guardrail.d.ts +5 -0
- package/esm/models/guardrail.js +4 -0
- package/esm/models/guardraildataregion.d.ts +19 -0
- package/esm/models/guardraildataregion.js +18 -0
- package/esm/models/index.d.ts +5 -0
- package/esm/models/index.js +5 -0
- package/esm/models/oautherrorresponse.d.ts +14 -0
- package/esm/models/oautherrorresponse.js +17 -0
- package/esm/models/oauthjwks.d.ts +50 -0
- package/esm/models/oauthjwks.js +47 -0
- package/esm/models/operations/createoauthtoken.d.ts +56 -0
- package/esm/models/operations/createoauthtoken.js +23 -0
- package/esm/models/operations/index.d.ts +2 -0
- package/esm/models/operations/index.js +2 -0
- package/esm/models/operations/listoauthjwks.d.ts +53 -0
- package/esm/models/operations/listoauthjwks.js +20 -0
- package/esm/models/tokenexchangerequest.d.ts +92 -0
- package/esm/models/tokenexchangerequest.js +59 -0
- package/esm/models/tokenexchangeresponse.d.ts +36 -0
- package/esm/models/tokenexchangeresponse.js +36 -0
- package/esm/models/updateguardrailrequest.d.ts +6 -0
- package/esm/models/updateguardrailrequest.js +4 -0
- package/esm/sdk/oauth.d.ts +15 -0
- package/esm/sdk/oauth.js +20 -0
- package/jsr.json +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
/**
|
|
13
|
+
* Exchange a workload identity token
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* RFC 8693 token exchange. Presents a JWT from an issuer your organization trusts (Settings → Workload identity) and receives a short-lived OpenRouter access token that acts as the API key the matching federation policy targets.
|
|
17
|
+
*/
|
|
18
|
+
export declare function oAuthCreateOauthToken(client: OpenRouterCore, request: operations.CreateOauthTokenRequest, options?: RequestOptions): APIPromise<Result<models.TokenExchangeResponse, errors.OAuthErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=oAuthCreateOauthToken.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: e5f6a20bb612
|
|
4
|
+
*/
|
|
5
|
+
import { encodeBodyForm, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
/**
|
|
17
|
+
* Exchange a workload identity token
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* RFC 8693 token exchange. Presents a JWT from an issuer your organization trusts (Settings → Workload identity) and receives a short-lived OpenRouter access token that acts as the API key the matching federation policy targets.
|
|
21
|
+
*/
|
|
22
|
+
export function oAuthCreateOauthToken(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.CreateOauthTokenRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [parsed, { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = Object.entries(payload.TokenExchangeRequest || {}).map(([k, v]) => {
|
|
32
|
+
return encodeBodyForm(k, v, { charEncoding: "percent" });
|
|
33
|
+
}).join("&");
|
|
34
|
+
const path = pathToFunc("/oauth/token")();
|
|
35
|
+
const headers = new Headers(compactMap({
|
|
36
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
37
|
+
Accept: "application/json",
|
|
38
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
39
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
40
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
41
|
+
}));
|
|
42
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
43
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
44
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
45
|
+
const context = {
|
|
46
|
+
options: client._options,
|
|
47
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
48
|
+
operationID: "createOauthToken",
|
|
49
|
+
oAuth2Scopes: null,
|
|
50
|
+
resolvedSecurity: requestSecurity,
|
|
51
|
+
securitySource: client._options.apiKey,
|
|
52
|
+
retryConfig: options?.retries
|
|
53
|
+
|| client._options.retryConfig
|
|
54
|
+
|| {
|
|
55
|
+
strategy: "backoff",
|
|
56
|
+
backoff: {
|
|
57
|
+
initialInterval: 500,
|
|
58
|
+
maxInterval: 60000,
|
|
59
|
+
exponent: 1.5,
|
|
60
|
+
maxElapsedTime: 3600000,
|
|
61
|
+
},
|
|
62
|
+
retryConnectionErrors: true,
|
|
63
|
+
}
|
|
64
|
+
|| { strategy: "none" },
|
|
65
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
66
|
+
};
|
|
67
|
+
const requestRes = client._createRequest(context, {
|
|
68
|
+
security: requestSecurity,
|
|
69
|
+
method: "POST",
|
|
70
|
+
baseURL: options?.serverURL,
|
|
71
|
+
path: path,
|
|
72
|
+
headers: headers,
|
|
73
|
+
body: body,
|
|
74
|
+
userAgent: client._options.userAgent,
|
|
75
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
76
|
+
}, options);
|
|
77
|
+
if (!requestRes.ok) {
|
|
78
|
+
return [requestRes, { status: "invalid" }];
|
|
79
|
+
}
|
|
80
|
+
const req = requestRes.value;
|
|
81
|
+
const doResult = await client._do(req, {
|
|
82
|
+
context,
|
|
83
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
84
|
+
retryConfig: context.retryConfig,
|
|
85
|
+
retryCodes: context.retryCodes,
|
|
86
|
+
});
|
|
87
|
+
if (!doResult.ok) {
|
|
88
|
+
return [doResult, { status: "request-error", request: req }];
|
|
89
|
+
}
|
|
90
|
+
const response = doResult.value;
|
|
91
|
+
const responseFields = {
|
|
92
|
+
HttpMeta: { Response: response, Request: req },
|
|
93
|
+
};
|
|
94
|
+
const [result] = await M.match(M.json(200, models.TokenExchangeResponse$inboundSchema), M.jsonErr([400, 429], errors.OAuthErrorResponse$inboundSchema), M.jsonErr([500, 503], errors.OAuthErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
95
|
+
if (!result.ok) {
|
|
96
|
+
return [result, { status: "complete", request: req, response }];
|
|
97
|
+
}
|
|
98
|
+
return [result, { status: "complete", request: req, response }];
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=oAuthCreateOauthToken.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
/**
|
|
13
|
+
* OpenRouter access token signing keys
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* RFC 7517 JWK Set containing the public keys OpenRouter signs access tokens with.
|
|
17
|
+
*/
|
|
18
|
+
export declare function oAuthListOauthJwks(client: OpenRouterCore, request?: operations.ListOauthJwksRequest | undefined, options?: RequestOptions): APIPromise<Result<models.OAuthJwks, errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=oAuthListOauthJwks.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f7899acb7c1e
|
|
4
|
+
*/
|
|
5
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
/**
|
|
17
|
+
* OpenRouter access token signing keys
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* RFC 7517 JWK Set containing the public keys OpenRouter signs access tokens with.
|
|
21
|
+
*/
|
|
22
|
+
export function oAuthListOauthJwks(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.ListOauthJwksRequest$outboundSchema.optional().parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [parsed, { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = null;
|
|
32
|
+
const path = pathToFunc("/oauth/jwks")();
|
|
33
|
+
const headers = new Headers(compactMap({
|
|
34
|
+
Accept: "application/json",
|
|
35
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
36
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload?.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
37
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload?.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
38
|
+
}));
|
|
39
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
40
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
41
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
42
|
+
const context = {
|
|
43
|
+
options: client._options,
|
|
44
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
45
|
+
operationID: "listOauthJwks",
|
|
46
|
+
oAuth2Scopes: null,
|
|
47
|
+
resolvedSecurity: requestSecurity,
|
|
48
|
+
securitySource: client._options.apiKey,
|
|
49
|
+
retryConfig: options?.retries
|
|
50
|
+
|| client._options.retryConfig
|
|
51
|
+
|| {
|
|
52
|
+
strategy: "backoff",
|
|
53
|
+
backoff: {
|
|
54
|
+
initialInterval: 500,
|
|
55
|
+
maxInterval: 60000,
|
|
56
|
+
exponent: 1.5,
|
|
57
|
+
maxElapsedTime: 3600000,
|
|
58
|
+
},
|
|
59
|
+
retryConnectionErrors: true,
|
|
60
|
+
}
|
|
61
|
+
|| { strategy: "none" },
|
|
62
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
63
|
+
};
|
|
64
|
+
const requestRes = client._createRequest(context, {
|
|
65
|
+
security: requestSecurity,
|
|
66
|
+
method: "GET",
|
|
67
|
+
baseURL: options?.serverURL,
|
|
68
|
+
path: path,
|
|
69
|
+
headers: headers,
|
|
70
|
+
body: body,
|
|
71
|
+
userAgent: client._options.userAgent,
|
|
72
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
73
|
+
}, options);
|
|
74
|
+
if (!requestRes.ok) {
|
|
75
|
+
return [requestRes, { status: "invalid" }];
|
|
76
|
+
}
|
|
77
|
+
const req = requestRes.value;
|
|
78
|
+
const doResult = await client._do(req, {
|
|
79
|
+
context,
|
|
80
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
81
|
+
retryConfig: context.retryConfig,
|
|
82
|
+
retryCodes: context.retryCodes,
|
|
83
|
+
});
|
|
84
|
+
if (!doResult.ok) {
|
|
85
|
+
return [doResult, { status: "request-error", request: req }];
|
|
86
|
+
}
|
|
87
|
+
const response = doResult.value;
|
|
88
|
+
const responseFields = {
|
|
89
|
+
HttpMeta: { Response: response, Request: req },
|
|
90
|
+
};
|
|
91
|
+
const [result] = await M.match(M.json(200, models.OAuthJwks$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
92
|
+
if (!result.ok) {
|
|
93
|
+
return [result, { status: "complete", request: req, response }];
|
|
94
|
+
}
|
|
95
|
+
return [result, { status: "complete", request: req, response }];
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=oAuthListOauthJwks.js.map
|
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.2.
|
|
53
|
+
readonly sdkVersion: "1.2.99";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.2.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.2.99 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.
|
|
32
|
+
sdkVersion: "1.2.99",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.2.99 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",
|
|
@@ -6,6 +6,7 @@ export * from "./forbiddenresponseerror.js";
|
|
|
6
6
|
export * from "./httpclienterrors.js";
|
|
7
7
|
export * from "./internalserverresponseerror.js";
|
|
8
8
|
export * from "./notfoundresponseerror.js";
|
|
9
|
+
export * from "./oautherrorresponse.js";
|
|
9
10
|
export * from "./openrouterdefaulterror.js";
|
|
10
11
|
export * from "./openroutererror.js";
|
|
11
12
|
export * from "./payloadtoolargeresponseerror.js";
|
|
@@ -10,6 +10,7 @@ export * from "./forbiddenresponseerror.js";
|
|
|
10
10
|
export * from "./httpclienterrors.js";
|
|
11
11
|
export * from "./internalserverresponseerror.js";
|
|
12
12
|
export * from "./notfoundresponseerror.js";
|
|
13
|
+
export * from "./oautherrorresponse.js";
|
|
13
14
|
export * from "./openrouterdefaulterror.js";
|
|
14
15
|
export * from "./openroutererror.js";
|
|
15
16
|
export * from "./payloadtoolargeresponseerror.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as models from "../index.js";
|
|
3
|
+
import { OpenRouterError } from "./openroutererror.js";
|
|
4
|
+
/**
|
|
5
|
+
* RFC 6749 §5.2 error response.
|
|
6
|
+
*/
|
|
7
|
+
export type OAuthErrorResponseData = {
|
|
8
|
+
error: models.ErrorEnum;
|
|
9
|
+
errorDescription: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* RFC 6749 §5.2 error response.
|
|
13
|
+
*/
|
|
14
|
+
export declare class OAuthErrorResponse extends OpenRouterError {
|
|
15
|
+
error: models.ErrorEnum;
|
|
16
|
+
errorDescription: string;
|
|
17
|
+
/** The original data that was passed to this error instance. */
|
|
18
|
+
data$: OAuthErrorResponseData;
|
|
19
|
+
constructor(err: OAuthErrorResponseData, httpMeta: {
|
|
20
|
+
response: Response;
|
|
21
|
+
request: Request;
|
|
22
|
+
body: string;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const OAuthErrorResponse$inboundSchema: z.ZodType<OAuthErrorResponse, unknown>;
|
|
27
|
+
//# sourceMappingURL=oautherrorresponse.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: b0268e4f0a4e
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import * as models from "../index.js";
|
|
8
|
+
import { OpenRouterError } from "./openroutererror.js";
|
|
9
|
+
/**
|
|
10
|
+
* RFC 6749 §5.2 error response.
|
|
11
|
+
*/
|
|
12
|
+
export class OAuthErrorResponse extends OpenRouterError {
|
|
13
|
+
constructor(err, httpMeta) {
|
|
14
|
+
const message = "message" in err && typeof err.message === "string"
|
|
15
|
+
? err.message
|
|
16
|
+
: `API error occurred: ${JSON.stringify(err)}`;
|
|
17
|
+
super(message, httpMeta);
|
|
18
|
+
this.data$ = err;
|
|
19
|
+
this.error = err.error;
|
|
20
|
+
this.errorDescription = err.errorDescription;
|
|
21
|
+
this.name = "OAuthErrorResponse";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const OAuthErrorResponse$inboundSchema = z.object({
|
|
26
|
+
error: models.ErrorEnum$inboundSchema,
|
|
27
|
+
error_description: z.string(),
|
|
28
|
+
request$: z.custom(x => x instanceof Request),
|
|
29
|
+
response$: z.custom(x => x instanceof Response),
|
|
30
|
+
body$: z.string(),
|
|
31
|
+
})
|
|
32
|
+
.transform((v) => {
|
|
33
|
+
const remapped = remap$(v, {
|
|
34
|
+
"error_description": "errorDescription",
|
|
35
|
+
});
|
|
36
|
+
return new OAuthErrorResponse(remapped, {
|
|
37
|
+
request: v.request$,
|
|
38
|
+
response: v.response$,
|
|
39
|
+
body: v.body$,
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=oautherrorresponse.js.map
|
|
@@ -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
|
*/
|
package/esm/models/guardrail.js
CHANGED
|
@@ -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
|
package/esm/models/index.d.ts
CHANGED
|
@@ -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";
|
|
@@ -349,6 +350,8 @@ export * from "./multimodalmedia.js";
|
|
|
349
350
|
export * from "./namespacefunctiontool.js";
|
|
350
351
|
export * from "./namespacetool.js";
|
|
351
352
|
export * from "./notfoundresponseerrordata.js";
|
|
353
|
+
export * from "./oautherrorresponse.js";
|
|
354
|
+
export * from "./oauthjwks.js";
|
|
352
355
|
export * from "./observabilityarizedestination.js";
|
|
353
356
|
export * from "./observabilitybraintrustdestination.js";
|
|
354
357
|
export * from "./observabilityclickhousedestination.js";
|
|
@@ -560,6 +563,8 @@ export * from "./taskclassificationresponse.js";
|
|
|
560
563
|
export * from "./textdeltaevent.js";
|
|
561
564
|
export * from "./textdoneevent.js";
|
|
562
565
|
export * from "./textextendedconfig.js";
|
|
566
|
+
export * from "./tokenexchangerequest.js";
|
|
567
|
+
export * from "./tokenexchangeresponse.js";
|
|
563
568
|
export * from "./toolcallstatus.js";
|
|
564
569
|
export * from "./toolchoiceallowed.js";
|
|
565
570
|
export * from "./toolchoicesupport.js";
|
package/esm/models/index.js
CHANGED
|
@@ -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";
|
|
@@ -353,6 +354,8 @@ export * from "./multimodalmedia.js";
|
|
|
353
354
|
export * from "./namespacefunctiontool.js";
|
|
354
355
|
export * from "./namespacetool.js";
|
|
355
356
|
export * from "./notfoundresponseerrordata.js";
|
|
357
|
+
export * from "./oautherrorresponse.js";
|
|
358
|
+
export * from "./oauthjwks.js";
|
|
356
359
|
export * from "./observabilityarizedestination.js";
|
|
357
360
|
export * from "./observabilitybraintrustdestination.js";
|
|
358
361
|
export * from "./observabilityclickhousedestination.js";
|
|
@@ -564,6 +567,8 @@ export * from "./taskclassificationresponse.js";
|
|
|
564
567
|
export * from "./textdeltaevent.js";
|
|
565
568
|
export * from "./textdoneevent.js";
|
|
566
569
|
export * from "./textextendedconfig.js";
|
|
570
|
+
export * from "./tokenexchangerequest.js";
|
|
571
|
+
export * from "./tokenexchangeresponse.js";
|
|
567
572
|
export * from "./toolcallstatus.js";
|
|
568
573
|
export * from "./toolchoiceallowed.js";
|
|
569
574
|
export * from "./toolchoicesupport.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
export declare const ErrorEnum: {
|
|
4
|
+
readonly InvalidRequest: "invalid_request";
|
|
5
|
+
readonly InvalidGrant: "invalid_grant";
|
|
6
|
+
readonly UnsupportedGrantType: "unsupported_grant_type";
|
|
7
|
+
readonly InvalidScope: "invalid_scope";
|
|
8
|
+
readonly ServerError: "server_error";
|
|
9
|
+
readonly TemporarilyUnavailable: "temporarily_unavailable";
|
|
10
|
+
};
|
|
11
|
+
export type ErrorEnum = OpenEnum<typeof ErrorEnum>;
|
|
12
|
+
/** @internal */
|
|
13
|
+
export declare const ErrorEnum$inboundSchema: z.ZodType<ErrorEnum, unknown>;
|
|
14
|
+
//# sourceMappingURL=oautherrorresponse.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 2e54250dbb09
|
|
4
|
+
*/
|
|
5
|
+
import * as openEnums from "../types/enums.js";
|
|
6
|
+
export const ErrorEnum = {
|
|
7
|
+
InvalidRequest: "invalid_request",
|
|
8
|
+
InvalidGrant: "invalid_grant",
|
|
9
|
+
UnsupportedGrantType: "unsupported_grant_type",
|
|
10
|
+
InvalidScope: "invalid_scope",
|
|
11
|
+
ServerError: "server_error",
|
|
12
|
+
TemporarilyUnavailable: "temporarily_unavailable",
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const ErrorEnum$inboundSchema = openEnums
|
|
16
|
+
.inboundSchema(ErrorEnum);
|
|
17
|
+
//# sourceMappingURL=oautherrorresponse.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export declare const Alg: {
|
|
6
|
+
readonly Es256: "ES256";
|
|
7
|
+
};
|
|
8
|
+
export type Alg = ClosedEnum<typeof Alg>;
|
|
9
|
+
export declare const Crv: {
|
|
10
|
+
readonly P256: "P-256";
|
|
11
|
+
};
|
|
12
|
+
export type Crv = ClosedEnum<typeof Crv>;
|
|
13
|
+
export declare const Kty: {
|
|
14
|
+
readonly Ec: "EC";
|
|
15
|
+
};
|
|
16
|
+
export type Kty = ClosedEnum<typeof Kty>;
|
|
17
|
+
export declare const Use: {
|
|
18
|
+
readonly Sig: "sig";
|
|
19
|
+
};
|
|
20
|
+
export type Use = ClosedEnum<typeof Use>;
|
|
21
|
+
export type Key = {
|
|
22
|
+
alg: Alg;
|
|
23
|
+
crv: Crv;
|
|
24
|
+
kid: string;
|
|
25
|
+
kty: Kty;
|
|
26
|
+
use: Use;
|
|
27
|
+
x: string;
|
|
28
|
+
y: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* RFC 7517 JWK Set of the keys OpenRouter signs access tokens with.
|
|
32
|
+
*/
|
|
33
|
+
export type OAuthJwks = {
|
|
34
|
+
keys: Array<Key>;
|
|
35
|
+
};
|
|
36
|
+
/** @internal */
|
|
37
|
+
export declare const Alg$inboundSchema: z.ZodEnum<typeof Alg>;
|
|
38
|
+
/** @internal */
|
|
39
|
+
export declare const Crv$inboundSchema: z.ZodEnum<typeof Crv>;
|
|
40
|
+
/** @internal */
|
|
41
|
+
export declare const Kty$inboundSchema: z.ZodEnum<typeof Kty>;
|
|
42
|
+
/** @internal */
|
|
43
|
+
export declare const Use$inboundSchema: z.ZodEnum<typeof Use>;
|
|
44
|
+
/** @internal */
|
|
45
|
+
export declare const Key$inboundSchema: z.ZodType<Key, unknown>;
|
|
46
|
+
export declare function keyFromJSON(jsonString: string): SafeParseResult<Key, SDKValidationError>;
|
|
47
|
+
/** @internal */
|
|
48
|
+
export declare const OAuthJwks$inboundSchema: z.ZodType<OAuthJwks, unknown>;
|
|
49
|
+
export declare function oAuthJwksFromJSON(jsonString: string): SafeParseResult<OAuthJwks, SDKValidationError>;
|
|
50
|
+
//# sourceMappingURL=oauthjwks.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: fa2c53553900
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
export const Alg = {
|
|
8
|
+
Es256: "ES256",
|
|
9
|
+
};
|
|
10
|
+
export const Crv = {
|
|
11
|
+
P256: "P-256",
|
|
12
|
+
};
|
|
13
|
+
export const Kty = {
|
|
14
|
+
Ec: "EC",
|
|
15
|
+
};
|
|
16
|
+
export const Use = {
|
|
17
|
+
Sig: "sig",
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const Alg$inboundSchema = z.enum(Alg);
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const Crv$inboundSchema = z.enum(Crv);
|
|
23
|
+
/** @internal */
|
|
24
|
+
export const Kty$inboundSchema = z.enum(Kty);
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const Use$inboundSchema = z.enum(Use);
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const Key$inboundSchema = z.object({
|
|
29
|
+
alg: Alg$inboundSchema,
|
|
30
|
+
crv: Crv$inboundSchema,
|
|
31
|
+
kid: z.string(),
|
|
32
|
+
kty: Kty$inboundSchema,
|
|
33
|
+
use: Use$inboundSchema,
|
|
34
|
+
x: z.string(),
|
|
35
|
+
y: z.string(),
|
|
36
|
+
});
|
|
37
|
+
export function keyFromJSON(jsonString) {
|
|
38
|
+
return safeParse(jsonString, (x) => Key$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Key' from JSON`);
|
|
39
|
+
}
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const OAuthJwks$inboundSchema = z.object({
|
|
42
|
+
keys: z.array(z.lazy(() => Key$inboundSchema)),
|
|
43
|
+
});
|
|
44
|
+
export function oAuthJwksFromJSON(jsonString) {
|
|
45
|
+
return safeParse(jsonString, (x) => OAuthJwks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OAuthJwks' from JSON`);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=oauthjwks.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as models from "../index.js";
|
|
3
|
+
export type CreateOauthTokenGlobals = {
|
|
4
|
+
/**
|
|
5
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This is used to track API usage per application.
|
|
9
|
+
*/
|
|
10
|
+
httpReferer?: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
*/
|
|
16
|
+
appTitle?: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
*/
|
|
22
|
+
appCategories?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
export type CreateOauthTokenRequest = {
|
|
25
|
+
/**
|
|
26
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* This is used to track API usage per application.
|
|
30
|
+
*/
|
|
31
|
+
httpReferer?: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
*/
|
|
37
|
+
appTitle?: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
*/
|
|
43
|
+
appCategories?: string | undefined;
|
|
44
|
+
tokenExchangeRequest: models.TokenExchangeRequest;
|
|
45
|
+
};
|
|
46
|
+
/** @internal */
|
|
47
|
+
export type CreateOauthTokenRequest$Outbound = {
|
|
48
|
+
"HTTP-Referer"?: string | undefined;
|
|
49
|
+
appTitle?: string | undefined;
|
|
50
|
+
appCategories?: string | undefined;
|
|
51
|
+
TokenExchangeRequest: models.TokenExchangeRequest$Outbound;
|
|
52
|
+
};
|
|
53
|
+
/** @internal */
|
|
54
|
+
export declare const CreateOauthTokenRequest$outboundSchema: z.ZodType<CreateOauthTokenRequest$Outbound, CreateOauthTokenRequest>;
|
|
55
|
+
export declare function createOauthTokenRequestToJSON(createOauthTokenRequest: CreateOauthTokenRequest): string;
|
|
56
|
+
//# sourceMappingURL=createoauthtoken.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 12bca86790cc
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import * as models from "../index.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const CreateOauthTokenRequest$outboundSchema = z.object({
|
|
10
|
+
httpReferer: z.string().optional(),
|
|
11
|
+
appTitle: z.string().optional(),
|
|
12
|
+
appCategories: z.string().optional(),
|
|
13
|
+
tokenExchangeRequest: models.TokenExchangeRequest$outboundSchema,
|
|
14
|
+
}).transform((v) => {
|
|
15
|
+
return remap$(v, {
|
|
16
|
+
httpReferer: "HTTP-Referer",
|
|
17
|
+
tokenExchangeRequest: "TokenExchangeRequest",
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
export function createOauthTokenRequestToJSON(createOauthTokenRequest) {
|
|
21
|
+
return JSON.stringify(CreateOauthTokenRequest$outboundSchema.parse(createOauthTokenRequest));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=createoauthtoken.js.map
|
|
@@ -13,6 +13,7 @@ export * from "./createembeddings.js";
|
|
|
13
13
|
export * from "./createguardrail.js";
|
|
14
14
|
export * from "./createimages.js";
|
|
15
15
|
export * from "./createkeys.js";
|
|
16
|
+
export * from "./createoauthtoken.js";
|
|
16
17
|
export * from "./createobservabilitydestination.js";
|
|
17
18
|
export * from "./createpresetschatcompletions.js";
|
|
18
19
|
export * from "./createpresetsmessages.js";
|
|
@@ -74,6 +75,7 @@ export * from "./listkeyassignments.js";
|
|
|
74
75
|
export * from "./listmemberassignments.js";
|
|
75
76
|
export * from "./listmodelscount.js";
|
|
76
77
|
export * from "./listmodelsuser.js";
|
|
78
|
+
export * from "./listoauthjwks.js";
|
|
77
79
|
export * from "./listobservabilitydestinations.js";
|
|
78
80
|
export * from "./listorganizationmembers.js";
|
|
79
81
|
export * from "./listpresets.js";
|
|
@@ -17,6 +17,7 @@ export * from "./createembeddings.js";
|
|
|
17
17
|
export * from "./createguardrail.js";
|
|
18
18
|
export * from "./createimages.js";
|
|
19
19
|
export * from "./createkeys.js";
|
|
20
|
+
export * from "./createoauthtoken.js";
|
|
20
21
|
export * from "./createobservabilitydestination.js";
|
|
21
22
|
export * from "./createpresetschatcompletions.js";
|
|
22
23
|
export * from "./createpresetsmessages.js";
|
|
@@ -78,6 +79,7 @@ export * from "./listkeyassignments.js";
|
|
|
78
79
|
export * from "./listmemberassignments.js";
|
|
79
80
|
export * from "./listmodelscount.js";
|
|
80
81
|
export * from "./listmodelsuser.js";
|
|
82
|
+
export * from "./listoauthjwks.js";
|
|
81
83
|
export * from "./listobservabilitydestinations.js";
|
|
82
84
|
export * from "./listorganizationmembers.js";
|
|
83
85
|
export * from "./listpresets.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type ListOauthJwksGlobals = {
|
|
3
|
+
/**
|
|
4
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This is used to track API usage per application.
|
|
8
|
+
*/
|
|
9
|
+
httpReferer?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
*/
|
|
15
|
+
appTitle?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
*/
|
|
21
|
+
appCategories?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type ListOauthJwksRequest = {
|
|
24
|
+
/**
|
|
25
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* This is used to track API usage per application.
|
|
29
|
+
*/
|
|
30
|
+
httpReferer?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
*/
|
|
36
|
+
appTitle?: string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
*/
|
|
42
|
+
appCategories?: string | undefined;
|
|
43
|
+
};
|
|
44
|
+
/** @internal */
|
|
45
|
+
export type ListOauthJwksRequest$Outbound = {
|
|
46
|
+
"HTTP-Referer"?: string | undefined;
|
|
47
|
+
appTitle?: string | undefined;
|
|
48
|
+
appCategories?: string | undefined;
|
|
49
|
+
};
|
|
50
|
+
/** @internal */
|
|
51
|
+
export declare const ListOauthJwksRequest$outboundSchema: z.ZodType<ListOauthJwksRequest$Outbound, ListOauthJwksRequest>;
|
|
52
|
+
export declare function listOauthJwksRequestToJSON(listOauthJwksRequest: ListOauthJwksRequest): string;
|
|
53
|
+
//# sourceMappingURL=listoauthjwks.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 63db6f2762a2
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const ListOauthJwksRequest$outboundSchema = z.object({
|
|
9
|
+
httpReferer: z.string().optional(),
|
|
10
|
+
appTitle: z.string().optional(),
|
|
11
|
+
appCategories: z.string().optional(),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return remap$(v, {
|
|
14
|
+
httpReferer: "HTTP-Referer",
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
export function listOauthJwksRequestToJSON(listOauthJwksRequest) {
|
|
18
|
+
return JSON.stringify(ListOauthJwksRequest$outboundSchema.parse(listOauthJwksRequest));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=listoauthjwks.js.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
/**
|
|
4
|
+
* Must be `urn:ietf:params:oauth:grant-type:token-exchange`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const GrantType: {
|
|
7
|
+
readonly UrnIetfParamsOauthGrantTypeTokenExchange: "urn:ietf:params:oauth:grant-type:token-exchange";
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Must be `urn:ietf:params:oauth:grant-type:token-exchange`.
|
|
11
|
+
*/
|
|
12
|
+
export type GrantType = ClosedEnum<typeof GrantType>;
|
|
13
|
+
/**
|
|
14
|
+
* Optional; when present must be `urn:ietf:params:oauth:token-type:access_token`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const RequestedTokenType: {
|
|
17
|
+
readonly UrnIetfParamsOauthTokenTypeAccessToken: "urn:ietf:params:oauth:token-type:access_token";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Optional; when present must be `urn:ietf:params:oauth:token-type:access_token`.
|
|
21
|
+
*/
|
|
22
|
+
export type RequestedTokenType = ClosedEnum<typeof RequestedTokenType>;
|
|
23
|
+
/**
|
|
24
|
+
* Optional; only `inference` is available.
|
|
25
|
+
*/
|
|
26
|
+
export declare const Scope: {
|
|
27
|
+
readonly Inference: "inference";
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Optional; only `inference` is available.
|
|
31
|
+
*/
|
|
32
|
+
export type Scope = ClosedEnum<typeof Scope>;
|
|
33
|
+
/**
|
|
34
|
+
* Must be `urn:ietf:params:oauth:token-type:jwt`.
|
|
35
|
+
*/
|
|
36
|
+
export declare const SubjectTokenType: {
|
|
37
|
+
readonly UrnIetfParamsOauthTokenTypeJwt: "urn:ietf:params:oauth:token-type:jwt";
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Must be `urn:ietf:params:oauth:token-type:jwt`.
|
|
41
|
+
*/
|
|
42
|
+
export type SubjectTokenType = ClosedEnum<typeof SubjectTokenType>;
|
|
43
|
+
/**
|
|
44
|
+
* RFC 8693 token exchange request body (application/x-www-form-urlencoded).
|
|
45
|
+
*/
|
|
46
|
+
export type TokenExchangeRequest = {
|
|
47
|
+
/**
|
|
48
|
+
* The federation policy to evaluate, from Settings → Workload identity. Binds the exchange to one organization.
|
|
49
|
+
*/
|
|
50
|
+
federationPolicyId: string;
|
|
51
|
+
/**
|
|
52
|
+
* Must be `urn:ietf:params:oauth:grant-type:token-exchange`.
|
|
53
|
+
*/
|
|
54
|
+
grantType: GrantType;
|
|
55
|
+
/**
|
|
56
|
+
* Optional; when present must be `urn:ietf:params:oauth:token-type:access_token`.
|
|
57
|
+
*/
|
|
58
|
+
requestedTokenType?: RequestedTokenType | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Optional; only `inference` is available.
|
|
61
|
+
*/
|
|
62
|
+
scope?: Scope | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* The JWT issued by your identity provider.
|
|
65
|
+
*/
|
|
66
|
+
subjectToken: string;
|
|
67
|
+
/**
|
|
68
|
+
* Must be `urn:ietf:params:oauth:token-type:jwt`.
|
|
69
|
+
*/
|
|
70
|
+
subjectTokenType: SubjectTokenType;
|
|
71
|
+
};
|
|
72
|
+
/** @internal */
|
|
73
|
+
export declare const GrantType$outboundSchema: z.ZodEnum<typeof GrantType>;
|
|
74
|
+
/** @internal */
|
|
75
|
+
export declare const RequestedTokenType$outboundSchema: z.ZodEnum<typeof RequestedTokenType>;
|
|
76
|
+
/** @internal */
|
|
77
|
+
export declare const Scope$outboundSchema: z.ZodEnum<typeof Scope>;
|
|
78
|
+
/** @internal */
|
|
79
|
+
export declare const SubjectTokenType$outboundSchema: z.ZodEnum<typeof SubjectTokenType>;
|
|
80
|
+
/** @internal */
|
|
81
|
+
export type TokenExchangeRequest$Outbound = {
|
|
82
|
+
federation_policy_id: string;
|
|
83
|
+
grant_type: string;
|
|
84
|
+
requested_token_type?: string | undefined;
|
|
85
|
+
scope?: string | undefined;
|
|
86
|
+
subject_token: string;
|
|
87
|
+
subject_token_type: string;
|
|
88
|
+
};
|
|
89
|
+
/** @internal */
|
|
90
|
+
export declare const TokenExchangeRequest$outboundSchema: z.ZodType<TokenExchangeRequest$Outbound, TokenExchangeRequest>;
|
|
91
|
+
export declare function tokenExchangeRequestToJSON(tokenExchangeRequest: TokenExchangeRequest): string;
|
|
92
|
+
//# sourceMappingURL=tokenexchangerequest.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 27152e05f952
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/**
|
|
8
|
+
* Must be `urn:ietf:params:oauth:grant-type:token-exchange`.
|
|
9
|
+
*/
|
|
10
|
+
export const GrantType = {
|
|
11
|
+
UrnIetfParamsOauthGrantTypeTokenExchange: "urn:ietf:params:oauth:grant-type:token-exchange",
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Optional; when present must be `urn:ietf:params:oauth:token-type:access_token`.
|
|
15
|
+
*/
|
|
16
|
+
export const RequestedTokenType = {
|
|
17
|
+
UrnIetfParamsOauthTokenTypeAccessToken: "urn:ietf:params:oauth:token-type:access_token",
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Optional; only `inference` is available.
|
|
21
|
+
*/
|
|
22
|
+
export const Scope = {
|
|
23
|
+
Inference: "inference",
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Must be `urn:ietf:params:oauth:token-type:jwt`.
|
|
27
|
+
*/
|
|
28
|
+
export const SubjectTokenType = {
|
|
29
|
+
UrnIetfParamsOauthTokenTypeJwt: "urn:ietf:params:oauth:token-type:jwt",
|
|
30
|
+
};
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const GrantType$outboundSchema = z.enum(GrantType);
|
|
33
|
+
/** @internal */
|
|
34
|
+
export const RequestedTokenType$outboundSchema = z.enum(RequestedTokenType);
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const Scope$outboundSchema = z.enum(Scope);
|
|
37
|
+
/** @internal */
|
|
38
|
+
export const SubjectTokenType$outboundSchema = z.enum(SubjectTokenType);
|
|
39
|
+
/** @internal */
|
|
40
|
+
export const TokenExchangeRequest$outboundSchema = z.object({
|
|
41
|
+
federationPolicyId: z.string(),
|
|
42
|
+
grantType: GrantType$outboundSchema,
|
|
43
|
+
requestedTokenType: RequestedTokenType$outboundSchema.optional(),
|
|
44
|
+
scope: Scope$outboundSchema.optional(),
|
|
45
|
+
subjectToken: z.string(),
|
|
46
|
+
subjectTokenType: SubjectTokenType$outboundSchema,
|
|
47
|
+
}).transform((v) => {
|
|
48
|
+
return remap$(v, {
|
|
49
|
+
federationPolicyId: "federation_policy_id",
|
|
50
|
+
grantType: "grant_type",
|
|
51
|
+
requestedTokenType: "requested_token_type",
|
|
52
|
+
subjectToken: "subject_token",
|
|
53
|
+
subjectTokenType: "subject_token_type",
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
export function tokenExchangeRequestToJSON(tokenExchangeRequest) {
|
|
57
|
+
return JSON.stringify(TokenExchangeRequest$outboundSchema.parse(tokenExchangeRequest));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=tokenexchangerequest.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export declare const IssuedTokenType: {
|
|
6
|
+
readonly UrnIetfParamsOauthTokenTypeAccessToken: "urn:ietf:params:oauth:token-type:access_token";
|
|
7
|
+
};
|
|
8
|
+
export type IssuedTokenType = ClosedEnum<typeof IssuedTokenType>;
|
|
9
|
+
export declare const TokenType: {
|
|
10
|
+
readonly Bearer: "Bearer";
|
|
11
|
+
};
|
|
12
|
+
export type TokenType = ClosedEnum<typeof TokenType>;
|
|
13
|
+
/**
|
|
14
|
+
* RFC 8693 token exchange response.
|
|
15
|
+
*/
|
|
16
|
+
export type TokenExchangeResponse = {
|
|
17
|
+
/**
|
|
18
|
+
* A short-lived JWT to send as `Authorization: Bearer` to the inference API.
|
|
19
|
+
*/
|
|
20
|
+
accessToken: string;
|
|
21
|
+
/**
|
|
22
|
+
* Seconds until the access token expires: at most 15 minutes, and never later than the subject token expires.
|
|
23
|
+
*/
|
|
24
|
+
expiresIn: number;
|
|
25
|
+
issuedTokenType: IssuedTokenType;
|
|
26
|
+
scope: string;
|
|
27
|
+
tokenType: TokenType;
|
|
28
|
+
};
|
|
29
|
+
/** @internal */
|
|
30
|
+
export declare const IssuedTokenType$inboundSchema: z.ZodEnum<typeof IssuedTokenType>;
|
|
31
|
+
/** @internal */
|
|
32
|
+
export declare const TokenType$inboundSchema: z.ZodEnum<typeof TokenType>;
|
|
33
|
+
/** @internal */
|
|
34
|
+
export declare const TokenExchangeResponse$inboundSchema: z.ZodType<TokenExchangeResponse, unknown>;
|
|
35
|
+
export declare function tokenExchangeResponseFromJSON(jsonString: string): SafeParseResult<TokenExchangeResponse, SDKValidationError>;
|
|
36
|
+
//# sourceMappingURL=tokenexchangeresponse.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: e2774cad9e5e
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
export const IssuedTokenType = {
|
|
9
|
+
UrnIetfParamsOauthTokenTypeAccessToken: "urn:ietf:params:oauth:token-type:access_token",
|
|
10
|
+
};
|
|
11
|
+
export const TokenType = {
|
|
12
|
+
Bearer: "Bearer",
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const IssuedTokenType$inboundSchema = z.enum(IssuedTokenType);
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const TokenType$inboundSchema = z.enum(TokenType);
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const TokenExchangeResponse$inboundSchema = z.object({
|
|
20
|
+
access_token: z.string(),
|
|
21
|
+
expires_in: z.int(),
|
|
22
|
+
issued_token_type: IssuedTokenType$inboundSchema,
|
|
23
|
+
scope: z.string(),
|
|
24
|
+
token_type: TokenType$inboundSchema,
|
|
25
|
+
}).transform((v) => {
|
|
26
|
+
return remap$(v, {
|
|
27
|
+
"access_token": "accessToken",
|
|
28
|
+
"expires_in": "expiresIn",
|
|
29
|
+
"issued_token_type": "issuedTokenType",
|
|
30
|
+
"token_type": "tokenType",
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
export function tokenExchangeResponseFromJSON(jsonString) {
|
|
34
|
+
return safeParse(jsonString, (x) => TokenExchangeResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TokenExchangeResponse' from JSON`);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=tokenexchangeresponse.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 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",
|
package/esm/sdk/oauth.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
|
+
import * as models from "../models/index.js";
|
|
2
3
|
import * as operations from "../models/operations/index.js";
|
|
3
4
|
import type { CreateAuthorizationUrlRequest } from "../funcs/oAuthCreateAuthorizationUrl.js";
|
|
4
5
|
import type { CreateSHA256CodeChallengeResponse } from "../funcs/oAuthCreateSHA256CodeChallenge.js";
|
|
@@ -42,5 +43,19 @@ export declare class OAuth extends ClientSDK {
|
|
|
42
43
|
* Create an authorization code for the PKCE flow to generate a user-controlled API key
|
|
43
44
|
*/
|
|
44
45
|
createAuthCode(request: operations.CreateAuthKeysCodeRequest, options?: RequestOptions): Promise<operations.CreateAuthKeysCodeResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* OpenRouter access token signing keys
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* RFC 7517 JWK Set containing the public keys OpenRouter signs access tokens with.
|
|
51
|
+
*/
|
|
52
|
+
listOauthJwks(request?: operations.ListOauthJwksRequest | undefined, options?: RequestOptions): Promise<models.OAuthJwks>;
|
|
53
|
+
/**
|
|
54
|
+
* Exchange a workload identity token
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* RFC 8693 token exchange. Presents a JWT from an issuer your organization trusts (Settings → Workload identity) and receives a short-lived OpenRouter access token that acts as the API key the matching federation policy targets.
|
|
58
|
+
*/
|
|
59
|
+
createOauthToken(request: operations.CreateOauthTokenRequest, options?: RequestOptions): Promise<models.TokenExchangeResponse>;
|
|
45
60
|
}
|
|
46
61
|
//# sourceMappingURL=oauth.d.ts.map
|
package/esm/sdk/oauth.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* @generated-id: 37b7f9b2970b
|
|
4
4
|
*/
|
|
5
5
|
import { oAuthCreateAuthCode } from "../funcs/oAuthCreateAuthCode.js";
|
|
6
|
+
import { oAuthCreateOauthToken } from "../funcs/oAuthCreateOauthToken.js";
|
|
6
7
|
import { oAuthExchangeAuthCodeForAPIKey } from "../funcs/oAuthExchangeAuthCodeForAPIKey.js";
|
|
8
|
+
import { oAuthListOauthJwks } from "../funcs/oAuthListOauthJwks.js";
|
|
7
9
|
import { ClientSDK } from "../lib/sdks.js";
|
|
8
10
|
import { unwrapAsync } from "../types/fp.js";
|
|
9
11
|
import { oAuthCreateAuthorizationUrl } from "../funcs/oAuthCreateAuthorizationUrl.js";
|
|
@@ -63,5 +65,23 @@ export class OAuth extends ClientSDK {
|
|
|
63
65
|
async createAuthCode(request, options) {
|
|
64
66
|
return unwrapAsync(oAuthCreateAuthCode(this, request, options));
|
|
65
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* OpenRouter access token signing keys
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* RFC 7517 JWK Set containing the public keys OpenRouter signs access tokens with.
|
|
73
|
+
*/
|
|
74
|
+
async listOauthJwks(request, options) {
|
|
75
|
+
return unwrapAsync(oAuthListOauthJwks(this, request, options));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Exchange a workload identity token
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* RFC 8693 token exchange. Presents a JWT from an issuer your organization trusts (Settings → Workload identity) and receives a short-lived OpenRouter access token that acts as the API key the matching federation policy targets.
|
|
82
|
+
*/
|
|
83
|
+
async createOauthToken(request, options) {
|
|
84
|
+
return unwrapAsync(oAuthCreateOauthToken(this, request, options));
|
|
85
|
+
}
|
|
66
86
|
}
|
|
67
87
|
//# sourceMappingURL=oauth.js.map
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.99",
|
|
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:e2e": "vitest --run --project e2e",
|
|
79
|
-
"test:transit": "exit 0",
|
|
80
76
|
"test:watch": "vitest --watch --project unit",
|
|
81
77
|
"typecheck": "tsc --noEmit",
|
|
78
|
+
"test:transit": "exit 0",
|
|
79
|
+
"typecheck:transit": "exit 0",
|
|
82
80
|
"compile": "tsc",
|
|
81
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
82
|
+
"prepare": "npm run build",
|
|
83
83
|
"test": "vitest --run --project unit",
|
|
84
|
-
"
|
|
84
|
+
"test:e2e": "vitest --run --project e2e"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|