@openrouter/sdk 1.3.24 → 1.3.25

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.
@@ -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's daemon access
14
+ *
15
+ * @remarks
16
+ * Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: the response is sent with `Cache-Control: no-store`, each reveal is logged by caller and intern, and a caller may make 10 reveals per minute. 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 internsGetInternDaemonAccess(client: OpenRouterCore, request: operations.GetInternDaemonAccessRequest, options?: RequestOptions): APIPromise<Result<models.InternDaemonAccess, errors.InternLifecycleError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
21
+ //# sourceMappingURL=internsGetInternDaemonAccess.d.ts.map
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 464f7f69e2f0
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 { InternLifecycleError$inboundSchema as errors_InternLifecycleError$inboundSchema } from "../models/errors/internlifecycleerror.js";
13
+ import { InternDaemonAccess$inboundSchema as models_InternDaemonAccess$inboundSchema } from "../models/interndaemonaccess.js";
14
+ import { GetInternDaemonAccessRequest$outboundSchema as operations_GetInternDaemonAccessRequest$outboundSchema } from "../models/operations/getinterndaemonaccess.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Get an intern's daemon access
18
+ *
19
+ * @remarks
20
+ * Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: the response is sent with `Cache-Control: no-store`, each reveal is logged by caller and intern, and a caller may make 10 reveals per minute. 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 internsGetInternDaemonAccess(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_GetInternDaemonAccessRequest$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}/daemon-access")(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: "getInternDaemonAccess",
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_InternDaemonAccess$inboundSchema), M.jsonErr([401, 403, 404, 408, 409, 429], 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=internsGetInternDaemonAccess.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.3.24";
53
+ readonly sdkVersion: "1.3.25";
54
54
  readonly genVersion: "2.914.0";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.3.24 2.914.0 1.0.0 @openrouter/sdk";
55
+ readonly userAgent: "speakeasy-sdk/typescript 1.3.25 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.3.24",
32
+ sdkVersion: "1.3.25",
33
33
  genVersion: "2.914.0",
34
- userAgent: "speakeasy-sdk/typescript 1.3.24 2.914.0 1.0.0 @openrouter/sdk",
34
+ userAgent: "speakeasy-sdk/typescript 1.3.25 2.914.0 1.0.0 @openrouter/sdk",
35
35
  };
36
36
  //# sourceMappingURL=config.js.map
@@ -342,6 +342,7 @@ export * from "./internchattoolcallfunction.js";
342
342
  export * from "./internchattoolmessage.js";
343
343
  export * from "./internchatusage.js";
344
344
  export * from "./internchatusermessage.js";
345
+ export * from "./interndaemonaccess.js";
345
346
  export * from "./interninvokeacceptedresponse.js";
346
347
  export * from "./interninvokerequest.js";
347
348
  export * from "./internlifecycleerror.js";
@@ -346,6 +346,7 @@ export * from "./internchattoolcallfunction.js";
346
346
  export * from "./internchattoolmessage.js";
347
347
  export * from "./internchatusage.js";
348
348
  export * from "./internchatusermessage.js";
349
+ export * from "./interndaemonaccess.js";
349
350
  export * from "./interninvokeacceptedresponse.js";
350
351
  export * from "./interninvokerequest.js";
351
352
  export * from "./internlifecycleerror.js";
@@ -0,0 +1,14 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ /**
5
+ * The intern daemon's origin and the bearer `ori tui --host` sends to it as `ORI_DAEMON_TOKEN`.
6
+ */
7
+ export type InternDaemonAccess = {
8
+ origin: string;
9
+ token: string;
10
+ };
11
+ /** @internal */
12
+ export declare const InternDaemonAccess$inboundSchema: z.ZodType<InternDaemonAccess, unknown>;
13
+ export declare function internDaemonAccessFromJSON(jsonString: string): SafeParseResult<InternDaemonAccess, SDKValidationError>;
14
+ //# sourceMappingURL=interndaemonaccess.d.ts.map
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 3e1c71908a89
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ /** @internal */
8
+ export const InternDaemonAccess$inboundSchema = z.object({
9
+ origin: z.string(),
10
+ token: z.string(),
11
+ });
12
+ export function internDaemonAccessFromJSON(jsonString) {
13
+ return safeParse(jsonString, (x) => InternDaemonAccess$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternDaemonAccess' from JSON`);
14
+ }
15
+ //# sourceMappingURL=interndaemonaccess.js.map
@@ -0,0 +1,58 @@
1
+ import * as z from "zod/v4";
2
+ export type GetInternDaemonAccessGlobals = {
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 GetInternDaemonAccessRequest = {
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
+ * ID of an intern visible to the authenticated API key.
45
+ */
46
+ internId: string;
47
+ };
48
+ /** @internal */
49
+ export type GetInternDaemonAccessRequest$Outbound = {
50
+ "HTTP-Referer"?: string | undefined;
51
+ appTitle?: string | undefined;
52
+ appCategories?: string | undefined;
53
+ internId: string;
54
+ };
55
+ /** @internal */
56
+ export declare const GetInternDaemonAccessRequest$outboundSchema: z.ZodType<GetInternDaemonAccessRequest$Outbound, GetInternDaemonAccessRequest>;
57
+ export declare function getInternDaemonAccessRequestToJSON(getInternDaemonAccessRequest: GetInternDaemonAccessRequest): string;
58
+ //# sourceMappingURL=getinterndaemonaccess.d.ts.map
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 2320374f9c4b
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ /** @internal */
8
+ export const GetInternDaemonAccessRequest$outboundSchema = z.object({
9
+ httpReferer: z.string().optional(),
10
+ appTitle: z.string().optional(),
11
+ appCategories: z.string().optional(),
12
+ internId: z.string(),
13
+ }).transform((v) => {
14
+ return remap$(v, {
15
+ httpReferer: "HTTP-Referer",
16
+ });
17
+ });
18
+ export function getInternDaemonAccessRequestToJSON(getInternDaemonAccessRequest) {
19
+ return JSON.stringify(GetInternDaemonAccessRequest$outboundSchema.parse(getInternDaemonAccessRequest));
20
+ }
21
+ //# sourceMappingURL=getinterndaemonaccess.js.map
@@ -54,6 +54,7 @@ export * from "./getfilemetadata.js";
54
54
  export * from "./getgeneration.js";
55
55
  export * from "./getguardrail.js";
56
56
  export * from "./getintern.js";
57
+ export * from "./getinterndaemonaccess.js";
57
58
  export * from "./getkey.js";
58
59
  export * from "./getmodel.js";
59
60
  export * from "./getmodels.js";
@@ -58,6 +58,7 @@ export * from "./getfilemetadata.js";
58
58
  export * from "./getgeneration.js";
59
59
  export * from "./getguardrail.js";
60
60
  export * from "./getintern.js";
61
+ export * from "./getinterndaemonaccess.js";
61
62
  export * from "./getkey.js";
62
63
  export * from "./getmodel.js";
63
64
  export * from "./getmodels.js";
@@ -37,6 +37,13 @@ export declare class Interns extends ClientSDK {
37
37
  * Changes the intern name, description, instructions or model. Omitted fields stay unchanged. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. 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.
38
38
  */
39
39
  updateIntern(request: operations.UpdateInternRequest, options?: RequestOptions): Promise<models.Intern>;
40
+ /**
41
+ * Get an intern's daemon access
42
+ *
43
+ * @remarks
44
+ * Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: the response is sent with `Cache-Control: no-store`, each reveal is logged by caller and intern, and a caller may make 10 reveals per minute. 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.
45
+ */
46
+ getInternDaemonAccess(request: operations.GetInternDaemonAccessRequest, options?: RequestOptions): Promise<models.InternDaemonAccess>;
40
47
  /**
41
48
  * Provision an intern
42
49
  *
@@ -6,6 +6,7 @@ import { internsChat } from "../funcs/internsChat.js";
6
6
  import { internsCreateIntern } from "../funcs/internsCreateIntern.js";
7
7
  import { internsDeleteIntern } from "../funcs/internsDeleteIntern.js";
8
8
  import { internsGetIntern } from "../funcs/internsGetIntern.js";
9
+ import { internsGetInternDaemonAccess } from "../funcs/internsGetInternDaemonAccess.js";
9
10
  import { internsInvoke } from "../funcs/internsInvoke.js";
10
11
  import { internsListInterns } from "../funcs/internsListInterns.js";
11
12
  import { internsProvisionIntern } from "../funcs/internsProvisionIntern.js";
@@ -59,6 +60,15 @@ export class Interns extends ClientSDK {
59
60
  async updateIntern(request, options) {
60
61
  return unwrapAsync(internsUpdateIntern(this, request, options));
61
62
  }
63
+ /**
64
+ * Get an intern's daemon access
65
+ *
66
+ * @remarks
67
+ * Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: the response is sent with `Cache-Control: no-store`, each reveal is logged by caller and intern, and a caller may make 10 reveals per minute. 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.
68
+ */
69
+ async getInternDaemonAccess(request, options) {
70
+ return unwrapAsync(internsGetInternDaemonAccess(this, request, options));
71
+ }
62
72
  /**
63
73
  * Provision an intern
64
74
  *
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.3.24",
5
+ "version": "1.3.25",
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.3.24",
3
+ "version": "1.3.25",
4
4
  "author": "OpenRouter",
5
5
  "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
6
6
  "keywords": [
@@ -73,15 +73,15 @@
73
73
  "lint": "eslint --cache --max-warnings=0 src",
74
74
  "build": "tsc && node scripts/unbarrel-imports.js",
75
75
  "prepublishOnly": "npm run build",
76
- "typecheck": "tsc --noEmit",
77
- "typecheck:transit": "exit 0",
78
- "postinstall": "node scripts/check-types.js || true",
79
- "test": "vitest --run --project unit",
80
- "test:e2e": "vitest --run --project e2e",
81
76
  "compile": "tsc && node scripts/unbarrel-imports.js",
82
77
  "prepare": "npm run build",
83
78
  "test:transit": "exit 0",
84
- "test:watch": "vitest --watch --project unit"
79
+ "test:watch": "vitest --watch --project unit",
80
+ "postinstall": "node scripts/check-types.js || true",
81
+ "test": "vitest --run --project unit",
82
+ "test:e2e": "vitest --run --project e2e",
83
+ "typecheck": "tsc --noEmit",
84
+ "typecheck:transit": "exit 0"
85
85
  },
86
86
  "peerDependencies": {
87
87