@openrouter/sdk 1.2.134 → 1.2.135

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 (62) hide show
  1. package/esm/funcs/internsCreateIntern.d.ts +21 -0
  2. package/esm/funcs/internsCreateIntern.js +103 -0
  3. package/esm/funcs/internsDeleteIntern.d.ts +21 -0
  4. package/esm/funcs/internsDeleteIntern.js +105 -0
  5. package/esm/funcs/internsGetIntern.d.ts +21 -0
  6. package/esm/funcs/internsGetIntern.js +105 -0
  7. package/esm/funcs/internsListInterns.d.ts +21 -0
  8. package/esm/funcs/internsListInterns.js +106 -0
  9. package/esm/funcs/internsProvisionIntern.d.ts +21 -0
  10. package/esm/funcs/internsProvisionIntern.js +105 -0
  11. package/esm/funcs/internsSuspendIntern.d.ts +21 -0
  12. package/esm/funcs/internsSuspendIntern.js +105 -0
  13. package/esm/funcs/internsUpdateIntern.d.ts +21 -0
  14. package/esm/funcs/internsUpdateIntern.js +108 -0
  15. package/esm/lib/config.d.ts +2 -2
  16. package/esm/lib/config.js +2 -2
  17. package/esm/models/createinternrequest.d.ts +43 -0
  18. package/esm/models/createinternrequest.js +24 -0
  19. package/esm/models/deleteinternresponse.d.ts +10 -0
  20. package/esm/models/deleteinternresponse.js +14 -0
  21. package/esm/models/errors/index.d.ts +1 -0
  22. package/esm/models/errors/index.js +1 -0
  23. package/esm/models/errors/internlifecycleerror.d.ts +25 -0
  24. package/esm/models/errors/internlifecycleerror.js +35 -0
  25. package/esm/models/index.d.ts +8 -0
  26. package/esm/models/index.js +8 -0
  27. package/esm/models/intern.d.ts +108 -0
  28. package/esm/models/intern.js +58 -0
  29. package/esm/models/internlifecycleerror.d.ts +15 -0
  30. package/esm/models/internlifecycleerror.js +23 -0
  31. package/esm/models/internlistresponse.d.ts +18 -0
  32. package/esm/models/internlistresponse.js +21 -0
  33. package/esm/models/operations/createintern.d.ts +61 -0
  34. package/esm/models/operations/createintern.js +25 -0
  35. package/esm/models/operations/deleteintern.d.ts +58 -0
  36. package/esm/models/operations/deleteintern.js +21 -0
  37. package/esm/models/operations/getintern.d.ts +58 -0
  38. package/esm/models/operations/getintern.js +21 -0
  39. package/esm/models/operations/index.d.ts +7 -0
  40. package/esm/models/operations/index.js +7 -0
  41. package/esm/models/operations/listinterns.d.ts +82 -0
  42. package/esm/models/operations/listinterns.js +38 -0
  43. package/esm/models/operations/provisionintern.d.ts +58 -0
  44. package/esm/models/operations/provisionintern.js +21 -0
  45. package/esm/models/operations/suspendintern.d.ts +58 -0
  46. package/esm/models/operations/suspendintern.js +21 -0
  47. package/esm/models/operations/updateintern.d.ts +61 -0
  48. package/esm/models/operations/updateintern.js +24 -0
  49. package/esm/models/provisioninternresponse.d.ts +10 -0
  50. package/esm/models/provisioninternresponse.js +14 -0
  51. package/esm/models/responseserrorfield.d.ts +4 -4
  52. package/esm/models/responseserrorfield.js +4 -4
  53. package/esm/models/suspendinternresponse.d.ts +10 -0
  54. package/esm/models/suspendinternresponse.js +14 -0
  55. package/esm/models/updateinternrequest.d.ts +33 -0
  56. package/esm/models/updateinternrequest.js +16 -0
  57. package/esm/sdk/interns.d.ts +55 -0
  58. package/esm/sdk/interns.js +79 -0
  59. package/esm/sdk/sdk.d.ts +3 -0
  60. package/esm/sdk/sdk.js +4 -0
  61. package/jsr.json +1 -1
  62. package/package.json +3 -3
@@ -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
+ * Create an intern
14
+ *
15
+ * @remarks
16
+ * Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
17
+ *
18
+ * If set, this operation will use {@link Security.apiKey} from the global security.
19
+ */
20
+ export declare function internsCreateIntern(client: OpenRouterCore, request: operations.CreateInternRequest, options?: RequestOptions): APIPromise<Result<models.Intern, errors.InternLifecycleError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
21
+ //# sourceMappingURL=internsCreateIntern.d.ts.map
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 74ff6cd8e4b0
4
+ */
5
+ import { encodeJSON, 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
+ * Create an intern
18
+ *
19
+ * @remarks
20
+ * Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
21
+ *
22
+ * If set, this operation will use {@link Security.apiKey} from the global security.
23
+ */
24
+ export function internsCreateIntern(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.CreateInternRequest$outboundSchema.parse(value), "Input validation failed");
29
+ if (!parsed.ok) {
30
+ return [parsed, { status: "invalid" }];
31
+ }
32
+ const payload = parsed.value;
33
+ const body = encodeJSON("body", payload.CreateInternRequest, {
34
+ explode: true,
35
+ });
36
+ const path = pathToFunc("/interns")();
37
+ const headers = new Headers(compactMap({
38
+ "Content-Type": "application/json",
39
+ Accept: "application/json",
40
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
41
+ "Idempotency-Key": encodeSimple("Idempotency-Key", payload["Idempotency-Key"], { explode: false, charEncoding: "none" }),
42
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
43
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
44
+ }));
45
+ const secConfig = await extractSecurity(client._options.apiKey);
46
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
47
+ const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
48
+ const context = {
49
+ options: client._options,
50
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
51
+ operationID: "createIntern",
52
+ oAuth2Scopes: null,
53
+ resolvedSecurity: requestSecurity,
54
+ securitySource: client._options.apiKey,
55
+ retryConfig: options?.retries
56
+ || client._options.retryConfig
57
+ || {
58
+ strategy: "backoff",
59
+ backoff: {
60
+ initialInterval: 500,
61
+ maxInterval: 60000,
62
+ exponent: 1.5,
63
+ maxElapsedTime: 3600000,
64
+ },
65
+ retryConnectionErrors: true,
66
+ }
67
+ || { strategy: "none" },
68
+ retryCodes: options?.retryCodes || ["5XX"],
69
+ };
70
+ const requestRes = client._createRequest(context, {
71
+ security: requestSecurity,
72
+ method: "POST",
73
+ baseURL: options?.serverURL,
74
+ path: path,
75
+ headers: headers,
76
+ body: body,
77
+ userAgent: client._options.userAgent,
78
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
79
+ }, options);
80
+ if (!requestRes.ok) {
81
+ return [requestRes, { status: "invalid" }];
82
+ }
83
+ const req = requestRes.value;
84
+ const doResult = await client._do(req, {
85
+ context,
86
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
87
+ retryConfig: context.retryConfig,
88
+ retryCodes: context.retryCodes,
89
+ });
90
+ if (!doResult.ok) {
91
+ return [doResult, { status: "request-error", request: req }];
92
+ }
93
+ const response = doResult.value;
94
+ const responseFields = {
95
+ HttpMeta: { Response: response, Request: req },
96
+ };
97
+ const [result] = await M.match(M.json([200, 201], models.Intern$inboundSchema), M.jsonErr([400, 401, 403, 404, 408, 409, 413], errors.InternLifecycleError$inboundSchema), M.jsonErr([500, 502], errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
98
+ if (!result.ok) {
99
+ return [result, { status: "complete", request: req, response }];
100
+ }
101
+ return [result, { status: "complete", request: req, response }];
102
+ }
103
+ //# sourceMappingURL=internsCreateIntern.js.map
@@ -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 an intern
14
+ *
15
+ * @remarks
16
+ * Starts safe teardown of the intern, its runtime and its private vault. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
17
+ *
18
+ * If set, this operation will use {@link Security.apiKey} from the global security.
19
+ */
20
+ export declare function internsDeleteIntern(client: OpenRouterCore, request: operations.DeleteInternRequest, options?: RequestOptions): APIPromise<Result<models.DeleteInternResponse, errors.InternLifecycleError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
21
+ //# sourceMappingURL=internsDeleteIntern.d.ts.map
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 7eb35f20da18
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
+ * Delete an intern
18
+ *
19
+ * @remarks
20
+ * Starts safe teardown of the intern, its runtime and its private vault. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
21
+ *
22
+ * If set, this operation will use {@link Security.apiKey} from the global security.
23
+ */
24
+ export function internsDeleteIntern(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.DeleteInternRequest$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
+ internId: encodeSimple("internId", payload.internId, {
36
+ explode: false,
37
+ charEncoding: "percent",
38
+ }),
39
+ };
40
+ const path = pathToFunc("/interns/{internId}")(pathParams);
41
+ const headers = new Headers(compactMap({
42
+ Accept: "application/json",
43
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
44
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
45
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
46
+ }));
47
+ const secConfig = await extractSecurity(client._options.apiKey);
48
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
49
+ const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
50
+ const context = {
51
+ options: client._options,
52
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
53
+ operationID: "deleteIntern",
54
+ oAuth2Scopes: null,
55
+ resolvedSecurity: requestSecurity,
56
+ securitySource: client._options.apiKey,
57
+ retryConfig: options?.retries
58
+ || client._options.retryConfig
59
+ || {
60
+ strategy: "backoff",
61
+ backoff: {
62
+ initialInterval: 500,
63
+ maxInterval: 60000,
64
+ exponent: 1.5,
65
+ maxElapsedTime: 3600000,
66
+ },
67
+ retryConnectionErrors: true,
68
+ }
69
+ || { strategy: "none" },
70
+ retryCodes: options?.retryCodes || ["5XX"],
71
+ };
72
+ const requestRes = client._createRequest(context, {
73
+ security: requestSecurity,
74
+ method: "DELETE",
75
+ baseURL: options?.serverURL,
76
+ path: path,
77
+ headers: headers,
78
+ body: body,
79
+ userAgent: client._options.userAgent,
80
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
81
+ }, options);
82
+ if (!requestRes.ok) {
83
+ return [requestRes, { status: "invalid" }];
84
+ }
85
+ const req = requestRes.value;
86
+ const doResult = await client._do(req, {
87
+ context,
88
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
89
+ retryConfig: context.retryConfig,
90
+ retryCodes: context.retryCodes,
91
+ });
92
+ if (!doResult.ok) {
93
+ return [doResult, { status: "request-error", request: req }];
94
+ }
95
+ const response = doResult.value;
96
+ const responseFields = {
97
+ HttpMeta: { Response: response, Request: req },
98
+ };
99
+ const [result] = await M.match(M.json(202, models.DeleteInternResponse$inboundSchema), M.jsonErr([401, 403, 404, 408, 409], errors.InternLifecycleError$inboundSchema), M.jsonErr([500, 502], errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
100
+ if (!result.ok) {
101
+ return [result, { status: "complete", request: req, response }];
102
+ }
103
+ return [result, { status: "complete", request: req, response }];
104
+ }
105
+ //# sourceMappingURL=internsDeleteIntern.js.map
@@ -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
+ * Get an intern
14
+ *
15
+ * @remarks
16
+ * Returns the public lifecycle state and settings for one visible intern. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
17
+ *
18
+ * If set, this operation will use {@link Security.apiKey} from the global security.
19
+ */
20
+ export declare function internsGetIntern(client: OpenRouterCore, request: operations.GetInternRequest, options?: RequestOptions): APIPromise<Result<models.Intern, errors.InternLifecycleError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
21
+ //# sourceMappingURL=internsGetIntern.d.ts.map
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 484b04c35876
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
+ * Get an intern
18
+ *
19
+ * @remarks
20
+ * Returns the public lifecycle state and settings for one visible intern. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
21
+ *
22
+ * If set, this operation will use {@link Security.apiKey} from the global security.
23
+ */
24
+ export function internsGetIntern(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.GetInternRequest$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
+ internId: encodeSimple("internId", payload.internId, {
36
+ explode: false,
37
+ charEncoding: "percent",
38
+ }),
39
+ };
40
+ const path = pathToFunc("/interns/{internId}")(pathParams);
41
+ const headers = new Headers(compactMap({
42
+ Accept: "application/json",
43
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
44
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
45
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
46
+ }));
47
+ const secConfig = await extractSecurity(client._options.apiKey);
48
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
49
+ const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
50
+ const context = {
51
+ options: client._options,
52
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
53
+ operationID: "getIntern",
54
+ oAuth2Scopes: null,
55
+ resolvedSecurity: requestSecurity,
56
+ securitySource: client._options.apiKey,
57
+ retryConfig: options?.retries
58
+ || client._options.retryConfig
59
+ || {
60
+ strategy: "backoff",
61
+ backoff: {
62
+ initialInterval: 500,
63
+ maxInterval: 60000,
64
+ exponent: 1.5,
65
+ maxElapsedTime: 3600000,
66
+ },
67
+ retryConnectionErrors: true,
68
+ }
69
+ || { strategy: "none" },
70
+ retryCodes: options?.retryCodes || ["5XX"],
71
+ };
72
+ const requestRes = client._createRequest(context, {
73
+ security: requestSecurity,
74
+ method: "GET",
75
+ baseURL: options?.serverURL,
76
+ path: path,
77
+ headers: headers,
78
+ body: body,
79
+ userAgent: client._options.userAgent,
80
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
81
+ }, options);
82
+ if (!requestRes.ok) {
83
+ return [requestRes, { status: "invalid" }];
84
+ }
85
+ const req = requestRes.value;
86
+ const doResult = await client._do(req, {
87
+ context,
88
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
89
+ retryConfig: context.retryConfig,
90
+ retryCodes: context.retryCodes,
91
+ });
92
+ if (!doResult.ok) {
93
+ return [doResult, { status: "request-error", request: req }];
94
+ }
95
+ const response = doResult.value;
96
+ const responseFields = {
97
+ HttpMeta: { Response: response, Request: req },
98
+ };
99
+ const [result] = await M.match(M.json(200, models.Intern$inboundSchema), M.jsonErr([401, 403, 404, 408], errors.InternLifecycleError$inboundSchema), M.jsonErr(500, errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
100
+ if (!result.ok) {
101
+ return [result, { status: "complete", request: req, response }];
102
+ }
103
+ return [result, { status: "complete", request: req, response }];
104
+ }
105
+ //# sourceMappingURL=internsGetIntern.js.map
@@ -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
+ * List interns
14
+ *
15
+ * @remarks
16
+ * Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
17
+ *
18
+ * If set, this operation will use {@link Security.apiKey} from the global security.
19
+ */
20
+ export declare function internsListInterns(client: OpenRouterCore, request?: operations.ListInternsRequest | undefined, options?: RequestOptions): APIPromise<Result<models.InternListResponse, errors.InternLifecycleError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
21
+ //# sourceMappingURL=internsListInterns.d.ts.map
@@ -0,0 +1,106 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: eceaf7dad653
4
+ */
5
+ import { encodeFormQuery, encodeSimple, queryJoin } 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
+ * List interns
18
+ *
19
+ * @remarks
20
+ * Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
21
+ *
22
+ * If set, this operation will use {@link Security.apiKey} from the global security.
23
+ */
24
+ export function internsListInterns(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.ListInternsRequest$outboundSchema.optional().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 path = pathToFunc("/interns")();
35
+ const query = queryJoin(encodeFormQuery({
36
+ "status": payload?.status,
37
+ }, { explode: false }), encodeFormQuery({
38
+ "limit": payload?.limit,
39
+ "workspace_id": payload?.workspace_id,
40
+ }));
41
+ const headers = new Headers(compactMap({
42
+ Accept: "application/json",
43
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
44
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload?.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
45
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload?.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
46
+ }));
47
+ const secConfig = await extractSecurity(client._options.apiKey);
48
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
49
+ const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
50
+ const context = {
51
+ options: client._options,
52
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
53
+ operationID: "listInterns",
54
+ oAuth2Scopes: null,
55
+ resolvedSecurity: requestSecurity,
56
+ securitySource: client._options.apiKey,
57
+ retryConfig: options?.retries
58
+ || client._options.retryConfig
59
+ || {
60
+ strategy: "backoff",
61
+ backoff: {
62
+ initialInterval: 500,
63
+ maxInterval: 60000,
64
+ exponent: 1.5,
65
+ maxElapsedTime: 3600000,
66
+ },
67
+ retryConnectionErrors: true,
68
+ }
69
+ || { strategy: "none" },
70
+ retryCodes: options?.retryCodes || ["5XX"],
71
+ };
72
+ const requestRes = client._createRequest(context, {
73
+ security: requestSecurity,
74
+ method: "GET",
75
+ baseURL: options?.serverURL,
76
+ path: path,
77
+ headers: headers,
78
+ query: query,
79
+ body: body,
80
+ userAgent: client._options.userAgent,
81
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
82
+ }, options);
83
+ if (!requestRes.ok) {
84
+ return [requestRes, { status: "invalid" }];
85
+ }
86
+ const req = requestRes.value;
87
+ const doResult = await client._do(req, {
88
+ context,
89
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
90
+ retryConfig: context.retryConfig,
91
+ retryCodes: context.retryCodes,
92
+ });
93
+ if (!doResult.ok) {
94
+ return [doResult, { status: "request-error", request: req }];
95
+ }
96
+ const response = doResult.value;
97
+ const responseFields = {
98
+ HttpMeta: { Response: response, Request: req },
99
+ };
100
+ const [result] = await M.match(M.json(200, models.InternListResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 408], errors.InternLifecycleError$inboundSchema), M.jsonErr(500, errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
101
+ if (!result.ok) {
102
+ return [result, { status: "complete", request: req, response }];
103
+ }
104
+ return [result, { status: "complete", request: req, response }];
105
+ }
106
+ //# sourceMappingURL=internsListInterns.js.map
@@ -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
+ * Provision an intern
14
+ *
15
+ * @remarks
16
+ * Starts the first boot, or resumes an intern after suspension. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
17
+ *
18
+ * If set, this operation will use {@link Security.apiKey} from the global security.
19
+ */
20
+ export declare function internsProvisionIntern(client: OpenRouterCore, request: operations.ProvisionInternRequest, options?: RequestOptions): APIPromise<Result<models.ProvisionInternResponse, errors.InternLifecycleError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
21
+ //# sourceMappingURL=internsProvisionIntern.d.ts.map
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 38001699f102
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
+ * Provision an intern
18
+ *
19
+ * @remarks
20
+ * Starts the first boot, or resumes an intern after suspension. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
21
+ *
22
+ * If set, this operation will use {@link Security.apiKey} from the global security.
23
+ */
24
+ export function internsProvisionIntern(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.ProvisionInternRequest$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
+ internId: encodeSimple("internId", payload.internId, {
36
+ explode: false,
37
+ charEncoding: "percent",
38
+ }),
39
+ };
40
+ const path = pathToFunc("/interns/{internId}/provision")(pathParams);
41
+ const headers = new Headers(compactMap({
42
+ Accept: "application/json",
43
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
44
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
45
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
46
+ }));
47
+ const secConfig = await extractSecurity(client._options.apiKey);
48
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
49
+ const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
50
+ const context = {
51
+ options: client._options,
52
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
53
+ operationID: "provisionIntern",
54
+ oAuth2Scopes: null,
55
+ resolvedSecurity: requestSecurity,
56
+ securitySource: client._options.apiKey,
57
+ retryConfig: options?.retries
58
+ || client._options.retryConfig
59
+ || {
60
+ strategy: "backoff",
61
+ backoff: {
62
+ initialInterval: 500,
63
+ maxInterval: 60000,
64
+ exponent: 1.5,
65
+ maxElapsedTime: 3600000,
66
+ },
67
+ retryConnectionErrors: true,
68
+ }
69
+ || { strategy: "none" },
70
+ retryCodes: options?.retryCodes || ["5XX"],
71
+ };
72
+ const requestRes = client._createRequest(context, {
73
+ security: requestSecurity,
74
+ method: "POST",
75
+ baseURL: options?.serverURL,
76
+ path: path,
77
+ headers: headers,
78
+ body: body,
79
+ userAgent: client._options.userAgent,
80
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
81
+ }, options);
82
+ if (!requestRes.ok) {
83
+ return [requestRes, { status: "invalid" }];
84
+ }
85
+ const req = requestRes.value;
86
+ const doResult = await client._do(req, {
87
+ context,
88
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
89
+ retryConfig: context.retryConfig,
90
+ retryCodes: context.retryCodes,
91
+ });
92
+ if (!doResult.ok) {
93
+ return [doResult, { status: "request-error", request: req }];
94
+ }
95
+ const response = doResult.value;
96
+ const responseFields = {
97
+ HttpMeta: { Response: response, Request: req },
98
+ };
99
+ const [result] = await M.match(M.json(202, models.ProvisionInternResponse$inboundSchema), M.jsonErr([401, 403, 404, 408, 409], errors.InternLifecycleError$inboundSchema), M.jsonErr([500, 502], errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
100
+ if (!result.ok) {
101
+ return [result, { status: "complete", request: req, response }];
102
+ }
103
+ return [result, { status: "complete", request: req, response }];
104
+ }
105
+ //# sourceMappingURL=internsProvisionIntern.js.map