@openrouter/sdk 1.3.20 → 1.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/funcs/internsInvoke.d.ts +26 -0
- package/esm/funcs/internsInvoke.js +119 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/interninvokeacceptedresponse.d.ts +34 -0
- package/esm/models/interninvokeacceptedresponse.js +30 -0
- package/esm/models/interninvokerequest.d.ts +23 -0
- package/esm/models/interninvokerequest.js +19 -0
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.js +1 -0
- package/esm/models/operations/invokeintern.d.ts +72 -0
- package/esm/models/operations/invokeintern.js +38 -0
- package/esm/sdk/interns.d.ts +13 -0
- package/esm/sdk/interns.js +16 -0
- package/jsr.json +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,26 @@
|
|
|
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 operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Start an intern run without waiting for it
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
|
|
16
|
+
*
|
|
17
|
+
* Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
|
|
18
|
+
*
|
|
19
|
+
* Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
|
|
20
|
+
*
|
|
21
|
+
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
22
|
+
*
|
|
23
|
+
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
24
|
+
*/
|
|
25
|
+
export declare function internsInvoke(client: OpenRouterCore, request: operations.InvokeInternRequest, options?: RequestOptions): APIPromise<Result<operations.InvokeInternResponse, errors.InternChatErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
26
|
+
//# sourceMappingURL=internsInvoke.d.ts.map
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: d0be40cd89cf
|
|
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 operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
/**
|
|
16
|
+
* Start an intern run without waiting for it
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
|
|
20
|
+
*
|
|
21
|
+
* Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
|
|
22
|
+
*
|
|
23
|
+
* Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
|
|
24
|
+
*
|
|
25
|
+
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
26
|
+
*
|
|
27
|
+
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
28
|
+
*/
|
|
29
|
+
export function internsInvoke(client, request, options) {
|
|
30
|
+
return new APIPromise($do(client, request, options));
|
|
31
|
+
}
|
|
32
|
+
async function $do(client, request, options) {
|
|
33
|
+
const parsed = safeParse(request, (value) => operations.InvokeInternRequest$outboundSchema.parse(value), "Input validation failed");
|
|
34
|
+
if (!parsed.ok) {
|
|
35
|
+
return [parsed, { status: "invalid" }];
|
|
36
|
+
}
|
|
37
|
+
const payload = parsed.value;
|
|
38
|
+
const body = encodeJSON("body", payload.InternInvokeRequest, {
|
|
39
|
+
explode: true,
|
|
40
|
+
});
|
|
41
|
+
const pathParams = {
|
|
42
|
+
internId: encodeSimple("internId", payload.internId, {
|
|
43
|
+
explode: false,
|
|
44
|
+
charEncoding: "percent",
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
const path = pathToFunc("/interns/{internId}/invoke")(pathParams);
|
|
48
|
+
const headers = new Headers(compactMap({
|
|
49
|
+
"Content-Type": "application/json",
|
|
50
|
+
Accept: "application/json",
|
|
51
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
52
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
53
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
54
|
+
}));
|
|
55
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
56
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
57
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
58
|
+
const context = {
|
|
59
|
+
options: client._options,
|
|
60
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
61
|
+
operationID: "invokeIntern",
|
|
62
|
+
oAuth2Scopes: null,
|
|
63
|
+
resolvedSecurity: requestSecurity,
|
|
64
|
+
securitySource: client._options.apiKey,
|
|
65
|
+
retryConfig: options?.retries
|
|
66
|
+
|| client._options.retryConfig
|
|
67
|
+
|| {
|
|
68
|
+
strategy: "backoff",
|
|
69
|
+
backoff: {
|
|
70
|
+
initialInterval: 500,
|
|
71
|
+
maxInterval: 60000,
|
|
72
|
+
exponent: 1.5,
|
|
73
|
+
maxElapsedTime: 3600000,
|
|
74
|
+
},
|
|
75
|
+
retryConnectionErrors: true,
|
|
76
|
+
}
|
|
77
|
+
|| { strategy: "none" },
|
|
78
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
79
|
+
};
|
|
80
|
+
const requestRes = client._createRequest(context, {
|
|
81
|
+
security: requestSecurity,
|
|
82
|
+
method: "POST",
|
|
83
|
+
baseURL: options?.serverURL,
|
|
84
|
+
path: path,
|
|
85
|
+
headers: headers,
|
|
86
|
+
body: body,
|
|
87
|
+
userAgent: client._options.userAgent,
|
|
88
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
89
|
+
}, options);
|
|
90
|
+
if (!requestRes.ok) {
|
|
91
|
+
return [requestRes, { status: "invalid" }];
|
|
92
|
+
}
|
|
93
|
+
const req = requestRes.value;
|
|
94
|
+
const doResult = await client._do(req, {
|
|
95
|
+
context,
|
|
96
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
97
|
+
retryConfig: context.retryConfig,
|
|
98
|
+
retryCodes: context.retryCodes,
|
|
99
|
+
});
|
|
100
|
+
if (!doResult.ok) {
|
|
101
|
+
return [doResult, { status: "request-error", request: req }];
|
|
102
|
+
}
|
|
103
|
+
const response = doResult.value;
|
|
104
|
+
const responseFields = {
|
|
105
|
+
HttpMeta: { Response: response, Request: req },
|
|
106
|
+
};
|
|
107
|
+
const [result] = await M.match(M.json(202, operations.InvokeInternResponse$inboundSchema, {
|
|
108
|
+
key: "Result",
|
|
109
|
+
}), M.jsonErr([400, 401, 403, 404, 408, 413], errors.InternChatErrorResponse$inboundSchema), M.jsonErr([409, 429], errors.InternChatErrorResponse$inboundSchema, {
|
|
110
|
+
hdrs: true,
|
|
111
|
+
}), M.jsonErr(503, errors.InternChatErrorResponse$inboundSchema, {
|
|
112
|
+
hdrs: true,
|
|
113
|
+
}), M.jsonErr([500, 502, 504], errors.InternChatErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
114
|
+
if (!result.ok) {
|
|
115
|
+
return [result, { status: "complete", request: req, response }];
|
|
116
|
+
}
|
|
117
|
+
return [result, { status: "complete", request: req, response }];
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=internsInvoke.js.map
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
50
50
|
export declare const SDK_METADATA: {
|
|
51
51
|
readonly language: "typescript";
|
|
52
52
|
readonly openapiDocVersion: "1.0.0";
|
|
53
|
-
readonly sdkVersion: "1.3.
|
|
53
|
+
readonly sdkVersion: "1.3.21";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.3.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.3.21 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.
|
|
32
|
+
sdkVersion: "1.3.21",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.3.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.3.21 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
package/esm/models/index.d.ts
CHANGED
|
@@ -342,6 +342,8 @@ 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 "./interninvokeacceptedresponse.js";
|
|
346
|
+
export * from "./interninvokerequest.js";
|
|
345
347
|
export * from "./internlifecycleerror.js";
|
|
346
348
|
export * from "./internlistresponse.js";
|
|
347
349
|
export * from "./itemreferenceitem.js";
|
package/esm/models/index.js
CHANGED
|
@@ -346,6 +346,8 @@ 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 "./interninvokeacceptedresponse.js";
|
|
350
|
+
export * from "./interninvokerequest.js";
|
|
349
351
|
export * from "./internlifecycleerror.js";
|
|
350
352
|
export * from "./internlistresponse.js";
|
|
351
353
|
export * from "./itemreferenceitem.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
/**
|
|
6
|
+
* `started` when a new run began. `steered` when the session already had a run going and the prompt was delivered into it instead.
|
|
7
|
+
*/
|
|
8
|
+
export declare const InternInvokeAcceptedResponseStatus: {
|
|
9
|
+
readonly Started: "started";
|
|
10
|
+
readonly Steered: "steered";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* `started` when a new run began. `steered` when the session already had a run going and the prompt was delivered into it instead.
|
|
14
|
+
*/
|
|
15
|
+
export type InternInvokeAcceptedResponseStatus = OpenEnum<typeof InternInvokeAcceptedResponseStatus>;
|
|
16
|
+
/**
|
|
17
|
+
* The intern admitted the prompt. The run continues on the intern.
|
|
18
|
+
*/
|
|
19
|
+
export type InternInvokeAcceptedResponse = {
|
|
20
|
+
/**
|
|
21
|
+
* The session the run belongs to. Send it back to continue the conversation.
|
|
22
|
+
*/
|
|
23
|
+
sessionId: string;
|
|
24
|
+
/**
|
|
25
|
+
* `started` when a new run began. `steered` when the session already had a run going and the prompt was delivered into it instead.
|
|
26
|
+
*/
|
|
27
|
+
status: InternInvokeAcceptedResponseStatus;
|
|
28
|
+
};
|
|
29
|
+
/** @internal */
|
|
30
|
+
export declare const InternInvokeAcceptedResponseStatus$inboundSchema: z.ZodType<InternInvokeAcceptedResponseStatus, unknown>;
|
|
31
|
+
/** @internal */
|
|
32
|
+
export declare const InternInvokeAcceptedResponse$inboundSchema: z.ZodType<InternInvokeAcceptedResponse, unknown>;
|
|
33
|
+
export declare function internInvokeAcceptedResponseFromJSON(jsonString: string): SafeParseResult<InternInvokeAcceptedResponse, SDKValidationError>;
|
|
34
|
+
//# sourceMappingURL=interninvokeacceptedresponse.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 4684252ebfd9
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../types/enums.js";
|
|
9
|
+
/**
|
|
10
|
+
* `started` when a new run began. `steered` when the session already had a run going and the prompt was delivered into it instead.
|
|
11
|
+
*/
|
|
12
|
+
export const InternInvokeAcceptedResponseStatus = {
|
|
13
|
+
Started: "started",
|
|
14
|
+
Steered: "steered",
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const InternInvokeAcceptedResponseStatus$inboundSchema = openEnums.inboundSchema(InternInvokeAcceptedResponseStatus);
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const InternInvokeAcceptedResponse$inboundSchema = z.object({
|
|
20
|
+
session_id: z.string(),
|
|
21
|
+
status: InternInvokeAcceptedResponseStatus$inboundSchema,
|
|
22
|
+
}).transform((v) => {
|
|
23
|
+
return remap$(v, {
|
|
24
|
+
"session_id": "sessionId",
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
export function internInvokeAcceptedResponseFromJSON(jsonString) {
|
|
28
|
+
return safeParse(jsonString, (x) => InternInvokeAcceptedResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternInvokeAcceptedResponse' from JSON`);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=interninvokeacceptedresponse.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* A prompt to run on the intern without holding a connection open.
|
|
4
|
+
*/
|
|
5
|
+
export type InternInvokeRequest = {
|
|
6
|
+
/**
|
|
7
|
+
* The prompt for the run, at most 32000 characters.
|
|
8
|
+
*/
|
|
9
|
+
input: string;
|
|
10
|
+
/**
|
|
11
|
+
* The session to run in. Send the `session_id` from an earlier `202` to continue that conversation, for example to hand the intern a decision on a case it is working. Omit it to start a new session. Only a `session_id` this endpoint issued to the same caller on the same intern is accepted; any other is refused with `404`.
|
|
12
|
+
*/
|
|
13
|
+
sessionId?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
/** @internal */
|
|
16
|
+
export type InternInvokeRequest$Outbound = {
|
|
17
|
+
input: string;
|
|
18
|
+
session_id?: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
/** @internal */
|
|
21
|
+
export declare const InternInvokeRequest$outboundSchema: z.ZodType<InternInvokeRequest$Outbound, InternInvokeRequest>;
|
|
22
|
+
export declare function internInvokeRequestToJSON(internInvokeRequest: InternInvokeRequest): string;
|
|
23
|
+
//# sourceMappingURL=interninvokerequest.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 087aea86ca9d
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const InternInvokeRequest$outboundSchema = z.object({
|
|
9
|
+
input: z.string(),
|
|
10
|
+
sessionId: z.string().optional(),
|
|
11
|
+
}).transform((v) => {
|
|
12
|
+
return remap$(v, {
|
|
13
|
+
sessionId: "session_id",
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
export function internInvokeRequestToJSON(internInvokeRequest) {
|
|
17
|
+
return JSON.stringify(InternInvokeRequest$outboundSchema.parse(internInvokeRequest));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=interninvokerequest.js.map
|
|
@@ -69,6 +69,7 @@ export * from "./getuseractivity.js";
|
|
|
69
69
|
export * from "./getvideos.js";
|
|
70
70
|
export * from "./getworkspace.js";
|
|
71
71
|
export * from "./getworkspacebudget.js";
|
|
72
|
+
export * from "./invokeintern.js";
|
|
72
73
|
export * from "./list.js";
|
|
73
74
|
export * from "./listbyokkeys.js";
|
|
74
75
|
export * from "./listcontainerfiles.js";
|
|
@@ -73,6 +73,7 @@ export * from "./getuseractivity.js";
|
|
|
73
73
|
export * from "./getvideos.js";
|
|
74
74
|
export * from "./getworkspace.js";
|
|
75
75
|
export * from "./getworkspacebudget.js";
|
|
76
|
+
export * from "./invokeintern.js";
|
|
76
77
|
export * from "./list.js";
|
|
77
78
|
export * from "./listbyokkeys.js";
|
|
78
79
|
export * from "./listcontainerfiles.js";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
+
import * as models from "../index.js";
|
|
5
|
+
export type InvokeInternGlobals = {
|
|
6
|
+
/**
|
|
7
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This is used to track API usage per application.
|
|
11
|
+
*/
|
|
12
|
+
httpReferer?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
*/
|
|
18
|
+
appTitle?: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
*/
|
|
24
|
+
appCategories?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
export type InvokeInternRequest = {
|
|
27
|
+
/**
|
|
28
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* This is used to track API usage per application.
|
|
32
|
+
*/
|
|
33
|
+
httpReferer?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
*/
|
|
39
|
+
appTitle?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
*/
|
|
45
|
+
appCategories?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* The intern to run.
|
|
48
|
+
*/
|
|
49
|
+
internId: string;
|
|
50
|
+
internInvokeRequest: models.InternInvokeRequest;
|
|
51
|
+
};
|
|
52
|
+
export type InvokeInternResponse = {
|
|
53
|
+
headers: {
|
|
54
|
+
[k: string]: Array<string>;
|
|
55
|
+
};
|
|
56
|
+
result: models.InternInvokeAcceptedResponse;
|
|
57
|
+
};
|
|
58
|
+
/** @internal */
|
|
59
|
+
export type InvokeInternRequest$Outbound = {
|
|
60
|
+
"HTTP-Referer"?: string | undefined;
|
|
61
|
+
appTitle?: string | undefined;
|
|
62
|
+
appCategories?: string | undefined;
|
|
63
|
+
internId: string;
|
|
64
|
+
InternInvokeRequest: models.InternInvokeRequest$Outbound;
|
|
65
|
+
};
|
|
66
|
+
/** @internal */
|
|
67
|
+
export declare const InvokeInternRequest$outboundSchema: z.ZodType<InvokeInternRequest$Outbound, InvokeInternRequest>;
|
|
68
|
+
export declare function invokeInternRequestToJSON(invokeInternRequest: InvokeInternRequest): string;
|
|
69
|
+
/** @internal */
|
|
70
|
+
export declare const InvokeInternResponse$inboundSchema: z.ZodType<InvokeInternResponse, unknown>;
|
|
71
|
+
export declare function invokeInternResponseFromJSON(jsonString: string): SafeParseResult<InvokeInternResponse, SDKValidationError>;
|
|
72
|
+
//# sourceMappingURL=invokeintern.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f2b19fbd8a96
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import * as models from "../index.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const InvokeInternRequest$outboundSchema = z.object({
|
|
11
|
+
httpReferer: z.string().optional(),
|
|
12
|
+
appTitle: z.string().optional(),
|
|
13
|
+
appCategories: z.string().optional(),
|
|
14
|
+
internId: z.string(),
|
|
15
|
+
internInvokeRequest: models.InternInvokeRequest$outboundSchema,
|
|
16
|
+
}).transform((v) => {
|
|
17
|
+
return remap$(v, {
|
|
18
|
+
httpReferer: "HTTP-Referer",
|
|
19
|
+
internInvokeRequest: "InternInvokeRequest",
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
export function invokeInternRequestToJSON(invokeInternRequest) {
|
|
23
|
+
return JSON.stringify(InvokeInternRequest$outboundSchema.parse(invokeInternRequest));
|
|
24
|
+
}
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const InvokeInternResponse$inboundSchema = z.object({
|
|
27
|
+
Headers: z.record(z.string(), z.array(z.string())).default({}),
|
|
28
|
+
Result: models.InternInvokeAcceptedResponse$inboundSchema,
|
|
29
|
+
}).transform((v) => {
|
|
30
|
+
return remap$(v, {
|
|
31
|
+
"Headers": "headers",
|
|
32
|
+
"Result": "result",
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
export function invokeInternResponseFromJSON(jsonString) {
|
|
36
|
+
return safeParse(jsonString, (x) => InvokeInternResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InvokeInternResponse' from JSON`);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=invokeintern.js.map
|
package/esm/sdk/interns.d.ts
CHANGED
|
@@ -80,5 +80,18 @@ export declare class Interns extends ClientSDK {
|
|
|
80
80
|
};
|
|
81
81
|
}, options?: RequestOptions): Promise<operations.CreateInternChatCompletionResponse>;
|
|
82
82
|
chat(request: operations.CreateInternChatCompletionRequest, options?: RequestOptions): Promise<operations.CreateInternChatCompletionResponse>;
|
|
83
|
+
/**
|
|
84
|
+
* Start an intern run without waiting for it
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
|
|
88
|
+
*
|
|
89
|
+
* Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
|
|
90
|
+
*
|
|
91
|
+
* Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
|
|
92
|
+
*
|
|
93
|
+
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
94
|
+
*/
|
|
95
|
+
invoke(request: operations.InvokeInternRequest, options?: RequestOptions): Promise<operations.InvokeInternResponse>;
|
|
83
96
|
}
|
|
84
97
|
//# sourceMappingURL=interns.d.ts.map
|
package/esm/sdk/interns.js
CHANGED
|
@@ -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 { internsInvoke } from "../funcs/internsInvoke.js";
|
|
9
10
|
import { internsListInterns } from "../funcs/internsListInterns.js";
|
|
10
11
|
import { internsProvisionIntern } from "../funcs/internsProvisionIntern.js";
|
|
11
12
|
import { internsSuspendIntern } from "../funcs/internsSuspendIntern.js";
|
|
@@ -79,5 +80,20 @@ export class Interns extends ClientSDK {
|
|
|
79
80
|
async chat(request, options) {
|
|
80
81
|
return unwrapAsync(internsChat(this, request, options));
|
|
81
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Start an intern run without waiting for it
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
|
|
88
|
+
*
|
|
89
|
+
* Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
|
|
90
|
+
*
|
|
91
|
+
* Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
|
|
92
|
+
*
|
|
93
|
+
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
94
|
+
*/
|
|
95
|
+
async invoke(request, options) {
|
|
96
|
+
return unwrapAsync(internsInvoke(this, request, options));
|
|
97
|
+
}
|
|
82
98
|
}
|
|
83
99
|
//# sourceMappingURL=interns.js.map
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.21",
|
|
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": [
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
76
|
"compile": "tsc",
|
|
77
|
-
"postinstall": "node scripts/check-types.js || true",
|
|
78
77
|
"test:e2e": "vitest --run --project e2e",
|
|
78
|
+
"test:transit": "exit 0",
|
|
79
79
|
"test:watch": "vitest --watch --project unit",
|
|
80
80
|
"typecheck": "tsc --noEmit",
|
|
81
|
+
"typecheck:transit": "exit 0",
|
|
82
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
81
83
|
"prepare": "npm run build",
|
|
82
|
-
"test": "vitest --run --project unit"
|
|
83
|
-
"test:transit": "exit 0",
|
|
84
|
-
"typecheck:transit": "exit 0"
|
|
84
|
+
"test": "vitest --run --project unit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|