@openrouter/sdk 1.5.72 → 1.5.73

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.
Files changed (34) hide show
  1. package/esm/funcs/presetsDelete.d.ts +21 -0
  2. package/esm/funcs/presetsDelete.js +109 -0
  3. package/esm/funcs/presetsGet.js +5 -1
  4. package/esm/funcs/presetsGetVersion.js +5 -1
  5. package/esm/funcs/presetsList.d.ts +1 -1
  6. package/esm/funcs/presetsList.js +3 -2
  7. package/esm/funcs/presetsListVersions.js +1 -0
  8. package/esm/funcs/presetsRestore.d.ts +21 -0
  9. package/esm/funcs/presetsRestore.js +109 -0
  10. package/esm/lib/config.d.ts +2 -2
  11. package/esm/lib/config.js +2 -2
  12. package/esm/models/deferredbm25search.d.ts +1 -1
  13. package/esm/models/deferredregexsearch.d.ts +1 -1
  14. package/esm/models/operations/createpresetschatcompletions.d.ts +1 -1
  15. package/esm/models/operations/createpresetsmessages.d.ts +1 -1
  16. package/esm/models/operations/createpresetsresponses.d.ts +1 -1
  17. package/esm/models/operations/deletepreset.d.ts +63 -0
  18. package/esm/models/operations/deletepreset.js +23 -0
  19. package/esm/models/operations/getpreset.d.ts +5 -0
  20. package/esm/models/operations/getpreset.js +2 -0
  21. package/esm/models/operations/getpresetversion.d.ts +5 -0
  22. package/esm/models/operations/getpresetversion.js +2 -0
  23. package/esm/models/operations/index.d.ts +2 -0
  24. package/esm/models/operations/index.js +2 -0
  25. package/esm/models/operations/listpresets.d.ts +5 -0
  26. package/esm/models/operations/listpresets.js +2 -0
  27. package/esm/models/operations/listpresetversions.d.ts +5 -0
  28. package/esm/models/operations/listpresetversions.js +2 -0
  29. package/esm/models/operations/restorepreset.d.ts +63 -0
  30. package/esm/models/operations/restorepreset.js +23 -0
  31. package/esm/sdk/presets.d.ts +14 -0
  32. package/esm/sdk/presets.js +20 -0
  33. package/jsr.json +1 -1
  34. package/package.json +8 -8
@@ -0,0 +1,21 @@
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
+ * Delete a preset
14
+ *
15
+ * @remarks
16
+ * Archives a preset: it no longer resolves for inference and is hidden from get and list. The preset and its versions are kept, so the slug stays taken; restore it with `POST /presets/{slug}/restore`. Deleting an already-archived preset succeeds again. A disabled preset returns 409. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. `workspace_id` may be sent as a query parameter or a JSON body field.
17
+ *
18
+ * If set, this operation will use {@link Security.apiKey} from the global security.
19
+ */
20
+ export declare function presetsDelete(client: OpenRouterCore, request: operations.DeletePresetRequest, options?: RequestOptions): APIPromise<Result<models.GetPresetResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.ConflictResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
21
+ //# sourceMappingURL=presetsDelete.d.ts.map
@@ -0,0 +1,109 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 2004474b99ef
4
+ */
5
+ import { encodeFormQuery, 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 { 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
+ import { GetPresetResponse$inboundSchema as models_GetPresetResponse$inboundSchema } from "../models/getpresetresponse.js";
14
+ import { DeletePresetRequest$outboundSchema as operations_DeletePresetRequest$outboundSchema } from "../models/operations/deletepreset.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Delete a preset
18
+ *
19
+ * @remarks
20
+ * Archives a preset: it no longer resolves for inference and is hidden from get and list. The preset and its versions are kept, so the slug stays taken; restore it with `POST /presets/{slug}/restore`. Deleting an already-archived preset succeeds again. A disabled preset returns 409. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. `workspace_id` may be sent as a query parameter or a JSON body field.
21
+ *
22
+ * If set, this operation will use {@link Security.apiKey} from the global security.
23
+ */
24
+ export function presetsDelete(client, request, options) {
25
+ return new APIPromise($do(client, request, options));
26
+ }
27
+ async function $do(client, request, options) {
28
+ const parsed = safeParse(request, (value) => operations_DeletePresetRequest$outboundSchema.parse(value), "Input validation failed");
29
+ if (!parsed.ok) {
30
+ return [parsed, { status: "invalid" }];
31
+ }
32
+ const payload = parsed.value;
33
+ const body = null;
34
+ const pathParams = {
35
+ slug: encodeSimple("slug", payload.slug, {
36
+ explode: false,
37
+ charEncoding: "percent",
38
+ }),
39
+ };
40
+ const path = pathToFunc("/presets/{slug}")(pathParams);
41
+ const query = encodeFormQuery({
42
+ "workspace_id": payload.workspace_id,
43
+ });
44
+ const headers = new Headers(compactMap({
45
+ Accept: "application/json",
46
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
47
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
48
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
49
+ }));
50
+ const secConfig = await extractSecurity(client._options.apiKey);
51
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
52
+ const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
53
+ const context = {
54
+ options: client._options,
55
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
56
+ operationID: "deletePreset",
57
+ oAuth2Scopes: null,
58
+ resolvedSecurity: requestSecurity,
59
+ securitySource: client._options.apiKey,
60
+ retryConfig: options?.retries
61
+ || client._options.retryConfig
62
+ || {
63
+ strategy: "backoff",
64
+ backoff: {
65
+ initialInterval: 500,
66
+ maxInterval: 60000,
67
+ exponent: 1.5,
68
+ maxElapsedTime: 3600000,
69
+ },
70
+ retryConnectionErrors: true,
71
+ }
72
+ || { strategy: "none" },
73
+ retryCodes: options?.retryCodes || ["5XX"],
74
+ };
75
+ const requestRes = client._createRequest(context, {
76
+ security: requestSecurity,
77
+ method: "DELETE",
78
+ baseURL: options?.serverURL,
79
+ path: path,
80
+ headers: headers,
81
+ query: query,
82
+ body: body,
83
+ userAgent: client._options.userAgent,
84
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
85
+ }, options);
86
+ if (!requestRes.ok) {
87
+ return [requestRes, { status: "invalid" }];
88
+ }
89
+ const req = requestRes.value;
90
+ const doResult = await client._do(req, {
91
+ context,
92
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
93
+ retryConfig: context.retryConfig,
94
+ retryCodes: context.retryCodes,
95
+ });
96
+ if (!doResult.ok) {
97
+ return [doResult, { status: "request-error", request: req }];
98
+ }
99
+ const response = doResult.value;
100
+ const responseFields = {
101
+ HttpMeta: { Response: response, Request: req },
102
+ };
103
+ const [result] = await M.match(M.json(200, models_GetPresetResponse$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 });
104
+ if (!result.ok) {
105
+ return [result, { status: "complete", request: req, response }];
106
+ }
107
+ return [result, { status: "complete", request: req, response }];
108
+ }
109
+ //# sourceMappingURL=presetsDelete.js.map
@@ -2,7 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: dd59c30d4b79
4
4
  */
5
- import { encodeSimple } from "../lib/encodings.js";
5
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
6
6
  import { matchStatusCode } from "../lib/http.js";
7
7
  import * as M from "../lib/matchers.js";
8
8
  import { compactMap } from "../lib/primitives.js";
@@ -38,6 +38,9 @@ async function $do(client, request, options) {
38
38
  }),
39
39
  };
40
40
  const path = pathToFunc("/presets/{slug}")(pathParams);
41
+ const query = encodeFormQuery({
42
+ "workspace_id": payload.workspace_id,
43
+ });
41
44
  const headers = new Headers(compactMap({
42
45
  Accept: "application/json",
43
46
  "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
@@ -75,6 +78,7 @@ async function $do(client, request, options) {
75
78
  baseURL: options?.serverURL,
76
79
  path: path,
77
80
  headers: headers,
81
+ query: query,
78
82
  body: body,
79
83
  userAgent: client._options.userAgent,
80
84
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
@@ -2,7 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: 565567171e74
4
4
  */
5
- import { encodeSimple } from "../lib/encodings.js";
5
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
6
6
  import { matchStatusCode } from "../lib/http.js";
7
7
  import * as M from "../lib/matchers.js";
8
8
  import { compactMap } from "../lib/primitives.js";
@@ -42,6 +42,9 @@ async function $do(client, request, options) {
42
42
  }),
43
43
  };
44
44
  const path = pathToFunc("/presets/{slug}/versions/{version}")(pathParams);
45
+ const query = encodeFormQuery({
46
+ "workspace_id": payload.workspace_id,
47
+ });
45
48
  const headers = new Headers(compactMap({
46
49
  Accept: "application/json",
47
50
  "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
@@ -79,6 +82,7 @@ async function $do(client, request, options) {
79
82
  baseURL: options?.serverURL,
80
83
  path: path,
81
84
  headers: headers,
85
+ query: query,
82
86
  body: body,
83
87
  userAgent: client._options.userAgent,
84
88
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
@@ -17,7 +17,7 @@ import { PageIterator } from "../types/operations.js";
17
17
  *
18
18
  * If set, this operation will use {@link Security.apiKey} from the global security.
19
19
  */
20
- export declare function presetsList(client: OpenRouterCore, request?: operations.ListPresetsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListPresetsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
20
+ export declare function presetsList(client: OpenRouterCore, request?: operations.ListPresetsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListPresetsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
21
21
  offset: number;
22
22
  }>>;
23
23
  //# sourceMappingURL=presetsList.d.ts.map
@@ -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 { ServiceUnavailableResponseError$inboundSchema as errors_ServiceUnavailableResponseError$inboundSchema } from "../models/errors/serviceunavailableresponseerror.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 { 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 { ServiceUnavailableResponseError$inboundSchema as errors_ServiceUnavailableResponseError$inboundSchema } from "../models/errors/serviceunavailableresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
13
13
  import { ListPresetsRequest$outboundSchema as operations_ListPresetsRequest$outboundSchema, ListPresetsResponse$inboundSchema as operations_ListPresetsResponse$inboundSchema } from "../models/operations/listpresets.js";
14
14
  import { APIPromise } from "../types/async.js";
15
15
  import { createPageIterator, haltIterator, } from "../types/operations.js";
@@ -35,6 +35,7 @@ async function $do(client, request, options) {
35
35
  const query = encodeFormQuery({
36
36
  "limit": payload?.limit,
37
37
  "offset": payload?.offset,
38
+ "workspace_id": payload?.workspace_id,
38
39
  });
39
40
  const headers = new Headers(compactMap({
40
41
  Accept: "application/json",
@@ -97,7 +98,7 @@ async function $do(client, request, options) {
97
98
  };
98
99
  const [result, raw] = await M.match(M.json(200, operations_ListPresetsResponse$inboundSchema, {
99
100
  key: "Result",
100
- }), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(503, errors_ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
101
+ }), 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.jsonErr(503, errors_ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
101
102
  if (!result.ok) {
102
103
  return [haltIterator(result), {
103
104
  status: "complete",
@@ -41,6 +41,7 @@ async function $do(client, request, options) {
41
41
  const query = encodeFormQuery({
42
42
  "limit": payload.limit,
43
43
  "offset": payload.offset,
44
+ "workspace_id": payload.workspace_id,
44
45
  });
45
46
  const headers = new Headers(compactMap({
46
47
  Accept: "application/json",
@@ -0,0 +1,21 @@
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
+ * Restore a preset
14
+ *
15
+ * @remarks
16
+ * Re-activates an archived preset so it resolves for inference again. No version is created and the designated version is unchanged. Restoring an active preset returns it unchanged. A disabled preset returns 409. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. `workspace_id` may be sent as a query parameter or a JSON body field.
17
+ *
18
+ * If set, this operation will use {@link Security.apiKey} from the global security.
19
+ */
20
+ export declare function presetsRestore(client: OpenRouterCore, request: operations.RestorePresetRequest, options?: RequestOptions): APIPromise<Result<models.GetPresetResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.ConflictResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
21
+ //# sourceMappingURL=presetsRestore.d.ts.map
@@ -0,0 +1,109 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 4a9b4da2c3fc
4
+ */
5
+ import { encodeFormQuery, 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 { 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
+ import { GetPresetResponse$inboundSchema as models_GetPresetResponse$inboundSchema } from "../models/getpresetresponse.js";
14
+ import { RestorePresetRequest$outboundSchema as operations_RestorePresetRequest$outboundSchema } from "../models/operations/restorepreset.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Restore a preset
18
+ *
19
+ * @remarks
20
+ * Re-activates an archived preset so it resolves for inference again. No version is created and the designated version is unchanged. Restoring an active preset returns it unchanged. A disabled preset returns 409. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. `workspace_id` may be sent as a query parameter or a JSON body field.
21
+ *
22
+ * If set, this operation will use {@link Security.apiKey} from the global security.
23
+ */
24
+ export function presetsRestore(client, request, options) {
25
+ return new APIPromise($do(client, request, options));
26
+ }
27
+ async function $do(client, request, options) {
28
+ const parsed = safeParse(request, (value) => operations_RestorePresetRequest$outboundSchema.parse(value), "Input validation failed");
29
+ if (!parsed.ok) {
30
+ return [parsed, { status: "invalid" }];
31
+ }
32
+ const payload = parsed.value;
33
+ const body = null;
34
+ const pathParams = {
35
+ slug: encodeSimple("slug", payload.slug, {
36
+ explode: false,
37
+ charEncoding: "percent",
38
+ }),
39
+ };
40
+ const path = pathToFunc("/presets/{slug}/restore")(pathParams);
41
+ const query = encodeFormQuery({
42
+ "workspace_id": payload.workspace_id,
43
+ });
44
+ const headers = new Headers(compactMap({
45
+ Accept: "application/json",
46
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
47
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
48
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
49
+ }));
50
+ const secConfig = await extractSecurity(client._options.apiKey);
51
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
52
+ const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
53
+ const context = {
54
+ options: client._options,
55
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
56
+ operationID: "restorePreset",
57
+ oAuth2Scopes: null,
58
+ resolvedSecurity: requestSecurity,
59
+ securitySource: client._options.apiKey,
60
+ retryConfig: options?.retries
61
+ || client._options.retryConfig
62
+ || {
63
+ strategy: "backoff",
64
+ backoff: {
65
+ initialInterval: 500,
66
+ maxInterval: 60000,
67
+ exponent: 1.5,
68
+ maxElapsedTime: 3600000,
69
+ },
70
+ retryConnectionErrors: true,
71
+ }
72
+ || { strategy: "none" },
73
+ retryCodes: options?.retryCodes || ["5XX"],
74
+ };
75
+ const requestRes = client._createRequest(context, {
76
+ security: requestSecurity,
77
+ method: "POST",
78
+ baseURL: options?.serverURL,
79
+ path: path,
80
+ headers: headers,
81
+ query: query,
82
+ body: body,
83
+ userAgent: client._options.userAgent,
84
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
85
+ }, options);
86
+ if (!requestRes.ok) {
87
+ return [requestRes, { status: "invalid" }];
88
+ }
89
+ const req = requestRes.value;
90
+ const doResult = await client._do(req, {
91
+ context,
92
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
93
+ retryConfig: context.retryConfig,
94
+ retryCodes: context.retryCodes,
95
+ });
96
+ if (!doResult.ok) {
97
+ return [doResult, { status: "request-error", request: req }];
98
+ }
99
+ const response = doResult.value;
100
+ const responseFields = {
101
+ HttpMeta: { Response: response, Request: req },
102
+ };
103
+ const [result] = await M.match(M.json(200, models_GetPresetResponse$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 });
104
+ if (!result.ok) {
105
+ return [result, { status: "complete", request: req, response }];
106
+ }
107
+ return [result, { status: "complete", request: req, response }];
108
+ }
109
+ //# sourceMappingURL=presetsRestore.js.map
@@ -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.5.72";
53
+ readonly sdkVersion: "1.5.73";
54
54
  readonly genVersion: "2.950.13";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.5.72 2.950.13 1.0.0 @openrouter/sdk";
55
+ readonly userAgent: "speakeasy-sdk/typescript 1.5.73 2.950.13 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.5.72",
32
+ sdkVersion: "1.5.73",
33
33
  genVersion: "2.950.13",
34
- userAgent: "speakeasy-sdk/typescript 1.5.72 2.950.13 1.0.0 @openrouter/sdk",
34
+ userAgent: "speakeasy-sdk/typescript 1.5.73 2.950.13 1.0.0 @openrouter/sdk",
35
35
  };
36
36
  //# sourceMappingURL=config.js.map
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
5
5
  export type DeferredBm25Search = {
6
6
  maxResults?: number | undefined;
7
7
  /**
8
- * Universal profile only, for searches the router answers through the `tool_search` wrapper. When true, a search that matches nothing also names the deferred sources this search covers (namespaces, MCP servers, and shared `<server>_` prefixes; up to 40 names or 2,000 characters, with a count of any omitted) and tells the model that a source the search does not cover is unreachable through it in this request, so it can make a client tool call the task already needs (or a read-only one) and search again on a later turn instead of concluding the integration is missing. A hit gets the same guidance after its matches when, as a heuristic on the model's own words, the query's leading word has 3 to 64 characters, no query word names a searchable source, and the leading word is not among the words of the deferred tools' names (the union of every deferred tool name's tokens, whole and split as the search index splits names; a camel-case word counts when each of its parts is), with descriptions left out so a tool that merely mentions another product cannot mask it (`jira create issue` answered with another tracker's issue tools). Direct tools, including a client's built-in tools, are already in the tool list and are not named. Absent or false: a miss suggests other keywords and the closest names only.
8
+ * Universal profile only, for searches the router answers through the `tool_search` wrapper. Unless false, a search that matches nothing also names the deferred sources this search covers (namespaces, MCP servers, and shared `<server>_` prefixes; up to 40 names or 2,000 characters, with a count of any omitted) and tells the model that a source the search does not cover is unreachable through it in this request, so it can make a client tool call the task already needs (or a read-only one) and search again on a later turn instead of concluding the integration is missing. A hit gets the same guidance after its matches when, as a heuristic on the model's own words, the query's leading word has 3 to 64 characters, no query word names a searchable source, and the leading word is not among the words of the deferred tools' names (the union of every deferred tool name's tokens, whole and split as the search index splits names; a camel-case word counts when each of its parts is), with descriptions left out so a tool that merely mentions another product cannot mask it (`jira create issue` answered with another tracker's issue tools). Direct tools, including a client's built-in tools, are already in the tool list and are not named. False: a miss suggests other keywords and the closest names only.
9
9
  */
10
10
  missSources?: boolean | undefined;
11
11
  /**
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
5
5
  export type DeferredRegexSearch = {
6
6
  maxResults?: number | undefined;
7
7
  /**
8
- * Universal profile only, for searches the router answers through the `tool_search` wrapper. When true, a search that matches nothing also names the deferred sources this search covers (namespaces, MCP servers, and shared `<server>_` prefixes; up to 40 names or 2,000 characters, with a count of any omitted) and tells the model that a source the search does not cover is unreachable through it in this request, so it can make a client tool call the task already needs (or a read-only one) and search again on a later turn instead of concluding the integration is missing. A hit gets the same guidance after its matches when, as a heuristic on the model's own words, the query's leading word has 3 to 64 characters, no query word names a searchable source, and the leading word is not among the words of the deferred tools' names (the union of every deferred tool name's tokens, whole and split as the search index splits names; a camel-case word counts when each of its parts is), with descriptions left out so a tool that merely mentions another product cannot mask it (`jira create issue` answered with another tracker's issue tools). Direct tools, including a client's built-in tools, are already in the tool list and are not named. Absent or false: a miss suggests other keywords and the closest names only.
8
+ * Universal profile only, for searches the router answers through the `tool_search` wrapper. Unless false, a search that matches nothing also names the deferred sources this search covers (namespaces, MCP servers, and shared `<server>_` prefixes; up to 40 names or 2,000 characters, with a count of any omitted) and tells the model that a source the search does not cover is unreachable through it in this request, so it can make a client tool call the task already needs (or a read-only one) and search again on a later turn instead of concluding the integration is missing. A hit gets the same guidance after its matches when, as a heuristic on the model's own words, the query's leading word has 3 to 64 characters, no query word names a searchable source, and the leading word is not among the words of the deferred tools' names (the union of every deferred tool name's tokens, whole and split as the search index splits names; a camel-case word counts when each of its parts is), with descriptions left out so a tool that merely mentions another product cannot mask it (`jira create issue` answered with another tracker's issue tools). Direct tools, including a client's built-in tools, are already in the tool list and are not named. False: a miss suggests other keywords and the closest names only.
9
9
  */
10
10
  missSources?: boolean | undefined;
11
11
  /**
@@ -46,7 +46,7 @@ export type CreatePresetsChatCompletionsRequest = {
46
46
  */
47
47
  slug: string;
48
48
  /**
49
- * Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
49
+ * Workspace to act in. Also accepted as a `workspace_id` field in a JSON request body. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
50
50
  */
51
51
  workspaceId?: string | undefined;
52
52
  chatRequest: models.ChatRequest;
@@ -46,7 +46,7 @@ export type CreatePresetsMessagesRequest = {
46
46
  */
47
47
  slug: string;
48
48
  /**
49
- * Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
49
+ * Workspace to act in. Also accepted as a `workspace_id` field in a JSON request body. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
50
50
  */
51
51
  workspaceId?: string | undefined;
52
52
  messagesRequest: models.MessagesRequest;
@@ -46,7 +46,7 @@ export type CreatePresetsResponsesRequest = {
46
46
  */
47
47
  slug: string;
48
48
  /**
49
- * Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
49
+ * Workspace to act in. Also accepted as a `workspace_id` field in a JSON request body. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
50
50
  */
51
51
  workspaceId?: string | undefined;
52
52
  responsesRequest: models.ResponsesRequest;
@@ -0,0 +1,63 @@
1
+ import * as z from "zod/v4";
2
+ export type DeletePresetGlobals = {
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 DeletePresetRequest = {
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
+ * URL-safe slug identifying the preset.
45
+ */
46
+ slug: string;
47
+ /**
48
+ * Workspace to act in. Also accepted as a `workspace_id` field in a JSON request body. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
49
+ */
50
+ workspaceId?: string | undefined;
51
+ };
52
+ /** @internal */
53
+ export type DeletePresetRequest$Outbound = {
54
+ "HTTP-Referer"?: string | undefined;
55
+ appTitle?: string | undefined;
56
+ appCategories?: string | undefined;
57
+ slug: string;
58
+ workspace_id?: string | undefined;
59
+ };
60
+ /** @internal */
61
+ export declare const DeletePresetRequest$outboundSchema: z.ZodType<DeletePresetRequest$Outbound, DeletePresetRequest>;
62
+ export declare function deletePresetRequestToJSON(deletePresetRequest: DeletePresetRequest): string;
63
+ //# sourceMappingURL=deletepreset.d.ts.map
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 01254326fe10
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ /** @internal */
8
+ export const DeletePresetRequest$outboundSchema = z.object({
9
+ httpReferer: z.string().optional(),
10
+ appTitle: z.string().optional(),
11
+ appCategories: z.string().optional(),
12
+ slug: z.string(),
13
+ workspaceId: z.string().optional(),
14
+ }).transform((v) => {
15
+ return remap$(v, {
16
+ httpReferer: "HTTP-Referer",
17
+ workspaceId: "workspace_id",
18
+ });
19
+ });
20
+ export function deletePresetRequestToJSON(deletePresetRequest) {
21
+ return JSON.stringify(DeletePresetRequest$outboundSchema.parse(deletePresetRequest));
22
+ }
23
+ //# sourceMappingURL=deletepreset.js.map
@@ -44,6 +44,10 @@ export type GetPresetRequest = {
44
44
  * URL-safe slug identifying the preset.
45
45
  */
46
46
  slug: string;
47
+ /**
48
+ * Workspace to act in. Also accepted as a `workspace_id` field in a JSON request body. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
49
+ */
50
+ workspaceId?: string | undefined;
47
51
  };
48
52
  /** @internal */
49
53
  export type GetPresetRequest$Outbound = {
@@ -51,6 +55,7 @@ export type GetPresetRequest$Outbound = {
51
55
  appTitle?: string | undefined;
52
56
  appCategories?: string | undefined;
53
57
  slug: string;
58
+ workspace_id?: string | undefined;
54
59
  };
55
60
  /** @internal */
56
61
  export declare const GetPresetRequest$outboundSchema: z.ZodType<GetPresetRequest$Outbound, GetPresetRequest>;
@@ -10,9 +10,11 @@ export const GetPresetRequest$outboundSchema = z.object({
10
10
  appTitle: z.string().optional(),
11
11
  appCategories: z.string().optional(),
12
12
  slug: z.string(),
13
+ workspaceId: z.string().optional(),
13
14
  }).transform((v) => {
14
15
  return remap$(v, {
15
16
  httpReferer: "HTTP-Referer",
17
+ workspaceId: "workspace_id",
16
18
  });
17
19
  });
18
20
  export function getPresetRequestToJSON(getPresetRequest) {
@@ -48,6 +48,10 @@ export type GetPresetVersionRequest = {
48
48
  * Version number of the preset.
49
49
  */
50
50
  version: string;
51
+ /**
52
+ * Workspace to act in. Also accepted as a `workspace_id` field in a JSON request body. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
53
+ */
54
+ workspaceId?: string | undefined;
51
55
  };
52
56
  /** @internal */
53
57
  export type GetPresetVersionRequest$Outbound = {
@@ -56,6 +60,7 @@ export type GetPresetVersionRequest$Outbound = {
56
60
  appCategories?: string | undefined;
57
61
  slug: string;
58
62
  version: string;
63
+ workspace_id?: string | undefined;
59
64
  };
60
65
  /** @internal */
61
66
  export declare const GetPresetVersionRequest$outboundSchema: z.ZodType<GetPresetVersionRequest$Outbound, GetPresetVersionRequest>;
@@ -11,9 +11,11 @@ export const GetPresetVersionRequest$outboundSchema = z.object({
11
11
  appCategories: z.string().optional(),
12
12
  slug: z.string(),
13
13
  version: z.string(),
14
+ workspaceId: z.string().optional(),
14
15
  }).transform((v) => {
15
16
  return remap$(v, {
16
17
  httpReferer: "HTTP-Referer",
18
+ workspaceId: "workspace_id",
17
19
  });
18
20
  });
19
21
  export function getPresetVersionRequestToJSON(getPresetVersionRequest) {
@@ -51,6 +51,7 @@ export * from "./deletekeys.js";
51
51
  export * from "./deletemodelavailabilitypolicy.js";
52
52
  export * from "./deletemoderationpolicy.js";
53
53
  export * from "./deleteobservabilitydestination.js";
54
+ export * from "./deletepreset.js";
54
55
  export * from "./deleteprivateendpoint.js";
55
56
  export * from "./deleteprivateprovider.js";
56
57
  export * from "./deletescimgroupmapping.js";
@@ -143,6 +144,7 @@ export * from "./listworkspacemembers.js";
143
144
  export * from "./listworkspaces.js";
144
145
  export * from "./promotecontainerfile.js";
145
146
  export * from "./queryanalytics.js";
147
+ export * from "./restorepreset.js";
146
148
  export * from "./sendchatcompletionrequest.js";
147
149
  export * from "./storeinternvaultsecret.js";
148
150
  export * from "./storevaultsecret.js";
@@ -55,6 +55,7 @@ export * from "./deletekeys.js";
55
55
  export * from "./deletemodelavailabilitypolicy.js";
56
56
  export * from "./deletemoderationpolicy.js";
57
57
  export * from "./deleteobservabilitydestination.js";
58
+ export * from "./deletepreset.js";
58
59
  export * from "./deleteprivateendpoint.js";
59
60
  export * from "./deleteprivateprovider.js";
60
61
  export * from "./deletescimgroupmapping.js";
@@ -147,6 +148,7 @@ export * from "./listworkspacemembers.js";
147
148
  export * from "./listworkspaces.js";
148
149
  export * from "./promotecontainerfile.js";
149
150
  export * from "./queryanalytics.js";
151
+ export * from "./restorepreset.js";
150
152
  export * from "./sendchatcompletionrequest.js";
151
153
  export * from "./storeinternvaultsecret.js";
152
154
  export * from "./storevaultsecret.js";
@@ -51,6 +51,10 @@ export type ListPresetsRequest = {
51
51
  * Maximum number of records to return (max 100)
52
52
  */
53
53
  limit?: number | undefined;
54
+ /**
55
+ * Workspace to act in. Also accepted as a `workspace_id` field in a JSON request body. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
56
+ */
57
+ workspaceId?: string | undefined;
54
58
  };
55
59
  export type ListPresetsResponse = {
56
60
  result: models.ListPresetsResponse;
@@ -62,6 +66,7 @@ export type ListPresetsRequest$Outbound = {
62
66
  appCategories?: string | undefined;
63
67
  offset: number | null;
64
68
  limit: number;
69
+ workspace_id?: string | undefined;
65
70
  };
66
71
  /** @internal */
67
72
  export declare const ListPresetsRequest$outboundSchema: z.ZodType<ListPresetsRequest$Outbound, ListPresetsRequest>;
@@ -13,9 +13,11 @@ export const ListPresetsRequest$outboundSchema = z.object({
13
13
  appCategories: z.string().optional(),
14
14
  offset: z.nullable(z.int().default(0)),
15
15
  limit: z.int().default(50),
16
+ workspaceId: z.string().optional(),
16
17
  }).transform((v) => {
17
18
  return remap$(v, {
18
19
  httpReferer: "HTTP-Referer",
20
+ workspaceId: "workspace_id",
19
21
  });
20
22
  });
21
23
  export function listPresetsRequestToJSON(listPresetsRequest) {
@@ -55,6 +55,10 @@ export type ListPresetVersionsRequest = {
55
55
  * Maximum number of records to return (max 100)
56
56
  */
57
57
  limit?: number | undefined;
58
+ /**
59
+ * Workspace to act in. Also accepted as a `workspace_id` field in a JSON request body. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
60
+ */
61
+ workspaceId?: string | undefined;
58
62
  };
59
63
  export type ListPresetVersionsResponse = {
60
64
  result: models.ListPresetVersionsResponse;
@@ -67,6 +71,7 @@ export type ListPresetVersionsRequest$Outbound = {
67
71
  slug: string;
68
72
  offset: number | null;
69
73
  limit: number;
74
+ workspace_id?: string | undefined;
70
75
  };
71
76
  /** @internal */
72
77
  export declare const ListPresetVersionsRequest$outboundSchema: z.ZodType<ListPresetVersionsRequest$Outbound, ListPresetVersionsRequest>;
@@ -14,9 +14,11 @@ export const ListPresetVersionsRequest$outboundSchema = z.object({
14
14
  slug: z.string(),
15
15
  offset: z.nullable(z.int().default(0)),
16
16
  limit: z.int().default(50),
17
+ workspaceId: z.string().optional(),
17
18
  }).transform((v) => {
18
19
  return remap$(v, {
19
20
  httpReferer: "HTTP-Referer",
21
+ workspaceId: "workspace_id",
20
22
  });
21
23
  });
22
24
  export function listPresetVersionsRequestToJSON(listPresetVersionsRequest) {
@@ -0,0 +1,63 @@
1
+ import * as z from "zod/v4";
2
+ export type RestorePresetGlobals = {
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 RestorePresetRequest = {
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
+ * URL-safe slug identifying the preset.
45
+ */
46
+ slug: string;
47
+ /**
48
+ * Workspace to act in. Also accepted as a `workspace_id` field in a JSON request body. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
49
+ */
50
+ workspaceId?: string | undefined;
51
+ };
52
+ /** @internal */
53
+ export type RestorePresetRequest$Outbound = {
54
+ "HTTP-Referer"?: string | undefined;
55
+ appTitle?: string | undefined;
56
+ appCategories?: string | undefined;
57
+ slug: string;
58
+ workspace_id?: string | undefined;
59
+ };
60
+ /** @internal */
61
+ export declare const RestorePresetRequest$outboundSchema: z.ZodType<RestorePresetRequest$Outbound, RestorePresetRequest>;
62
+ export declare function restorePresetRequestToJSON(restorePresetRequest: RestorePresetRequest): string;
63
+ //# sourceMappingURL=restorepreset.d.ts.map
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 7887ec16ae3e
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ /** @internal */
8
+ export const RestorePresetRequest$outboundSchema = z.object({
9
+ httpReferer: z.string().optional(),
10
+ appTitle: z.string().optional(),
11
+ appCategories: z.string().optional(),
12
+ slug: z.string(),
13
+ workspaceId: z.string().optional(),
14
+ }).transform((v) => {
15
+ return remap$(v, {
16
+ httpReferer: "HTTP-Referer",
17
+ workspaceId: "workspace_id",
18
+ });
19
+ });
20
+ export function restorePresetRequestToJSON(restorePresetRequest) {
21
+ return JSON.stringify(RestorePresetRequest$outboundSchema.parse(restorePresetRequest));
22
+ }
23
+ //# sourceMappingURL=restorepreset.js.map
@@ -12,6 +12,13 @@ export declare class Presets extends ClientSDK {
12
12
  list(request?: operations.ListPresetsRequest | undefined, options?: RequestOptions): Promise<PageIterator<operations.ListPresetsResponse, {
13
13
  offset: number;
14
14
  }>>;
15
+ /**
16
+ * Delete a preset
17
+ *
18
+ * @remarks
19
+ * Archives a preset: it no longer resolves for inference and is hidden from get and list. The preset and its versions are kept, so the slug stays taken; restore it with `POST /presets/{slug}/restore`. Deleting an already-archived preset succeeds again. A disabled preset returns 409. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. `workspace_id` may be sent as a query parameter or a JSON body field.
20
+ */
21
+ delete(request: operations.DeletePresetRequest, options?: RequestOptions): Promise<models.GetPresetResponse>;
15
22
  /**
16
23
  * Get a preset
17
24
  *
@@ -40,6 +47,13 @@ export declare class Presets extends ClientSDK {
40
47
  * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
41
48
  */
42
49
  createPresetsResponses(request: operations.CreatePresetsResponsesRequest, options?: RequestOptions): Promise<models.CreatePresetFromInferenceResponse>;
50
+ /**
51
+ * Restore a preset
52
+ *
53
+ * @remarks
54
+ * Re-activates an archived preset so it resolves for inference again. No version is created and the designated version is unchanged. Restoring an active preset returns it unchanged. A disabled preset returns 409. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. `workspace_id` may be sent as a query parameter or a JSON body field.
55
+ */
56
+ restore(request: operations.RestorePresetRequest, options?: RequestOptions): Promise<models.GetPresetResponse>;
43
57
  /**
44
58
  * List versions of a preset
45
59
  *
@@ -5,10 +5,12 @@
5
5
  import { presetsCreatePresetsChatCompletions } from "../funcs/presetsCreatePresetsChatCompletions.js";
6
6
  import { presetsCreatePresetsMessages } from "../funcs/presetsCreatePresetsMessages.js";
7
7
  import { presetsCreatePresetsResponses } from "../funcs/presetsCreatePresetsResponses.js";
8
+ import { presetsDelete } from "../funcs/presetsDelete.js";
8
9
  import { presetsGet } from "../funcs/presetsGet.js";
9
10
  import { presetsGetVersion } from "../funcs/presetsGetVersion.js";
10
11
  import { presetsList } from "../funcs/presetsList.js";
11
12
  import { presetsListVersions } from "../funcs/presetsListVersions.js";
13
+ import { presetsRestore } from "../funcs/presetsRestore.js";
12
14
  import { ClientSDK } from "../lib/sdks.js";
13
15
  import { unwrapAsync } from "../types/fp.js";
14
16
  import { unwrapResultIterator } from "../types/operations.js";
@@ -22,6 +24,15 @@ export class Presets extends ClientSDK {
22
24
  async list(request, options) {
23
25
  return unwrapResultIterator(presetsList(this, request, options));
24
26
  }
27
+ /**
28
+ * Delete a preset
29
+ *
30
+ * @remarks
31
+ * Archives a preset: it no longer resolves for inference and is hidden from get and list. The preset and its versions are kept, so the slug stays taken; restore it with `POST /presets/{slug}/restore`. Deleting an already-archived preset succeeds again. A disabled preset returns 409. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. `workspace_id` may be sent as a query parameter or a JSON body field.
32
+ */
33
+ async delete(request, options) {
34
+ return unwrapAsync(presetsDelete(this, request, options));
35
+ }
25
36
  /**
26
37
  * Get a preset
27
38
  *
@@ -58,6 +69,15 @@ export class Presets extends ClientSDK {
58
69
  async createPresetsResponses(request, options) {
59
70
  return unwrapAsync(presetsCreatePresetsResponses(this, request, options));
60
71
  }
72
+ /**
73
+ * Restore a preset
74
+ *
75
+ * @remarks
76
+ * Re-activates an archived preset so it resolves for inference again. No version is created and the designated version is unchanged. Restoring an active preset returns it unchanged. A disabled preset returns 409. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected. `workspace_id` may be sent as a query parameter or a JSON body field.
77
+ */
78
+ async restore(request, options) {
79
+ return unwrapAsync(presetsRestore(this, request, options));
80
+ }
61
81
  /**
62
82
  * List versions of a preset
63
83
  *
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.5.72",
5
+ "version": "1.5.73",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "1.5.72",
3
+ "version": "1.5.73",
4
4
  "author": "OpenRouter",
5
5
  "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
6
6
  "keywords": [
@@ -21,8 +21,8 @@
21
21
  "license": "Apache-2.0",
22
22
  "packageManager": "pnpm@10.22.0",
23
23
  "publishConfig": {
24
- "access": "public",
25
- "provenance": true
24
+ "provenance": true,
25
+ "access": "public"
26
26
  },
27
27
  "type": "module",
28
28
  "main": "./esm/index.js",
@@ -73,15 +73,15 @@
73
73
  "lint": "eslint --cache --max-warnings=0 src",
74
74
  "build": "tsc && node scripts/unbarrel-imports.js",
75
75
  "prepublishOnly": "npm run build",
76
+ "test:transit": "exit 0",
77
+ "typecheck": "tsc --noEmit",
76
78
  "compile": "tsc && node scripts/unbarrel-imports.js",
77
- "postinstall": "node scripts/check-types.js || true",
78
79
  "test": "vitest --run --project unit",
80
+ "test:watch": "vitest --watch --project unit",
79
81
  "typecheck:transit": "exit 0",
82
+ "postinstall": "node scripts/check-types.js || true",
80
83
  "prepare": "npm run build",
81
- "test:e2e": "vitest --run --project e2e",
82
- "test:transit": "exit 0",
83
- "test:watch": "vitest --watch --project unit",
84
- "typecheck": "tsc --noEmit"
84
+ "test:e2e": "vitest --run --project e2e"
85
85
  },
86
86
  "peerDependencies": {
87
87