@openrouter/sdk 1.3.11 → 1.3.13
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/internsChat.d.ts +10 -0
- package/esm/funcs/internsChat.js +5 -21
- package/esm/funcs/internsCreateIntern.d.ts +1 -1
- package/esm/funcs/internsCreateIntern.js +2 -2
- package/esm/funcs/internsDeleteIntern.d.ts +1 -1
- package/esm/funcs/internsDeleteIntern.js +2 -2
- package/esm/funcs/internsProvisionIntern.js +1 -1
- package/esm/funcs/internsSuspendIntern.js +1 -1
- package/esm/funcs/internsUpdateIntern.d.ts +1 -1
- package/esm/funcs/internsUpdateIntern.js +2 -2
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/byokkey.d.ts +4 -0
- package/esm/models/byokkey.js +2 -0
- package/esm/models/createbyokkeyrequest.d.ts +5 -0
- package/esm/models/createbyokkeyrequest.js +2 -0
- package/esm/models/generationresponse.d.ts +2 -2
- package/esm/models/generationresponse.js +2 -2
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/internchatsteeredresponse.d.ts +33 -0
- package/esm/models/internchatsteeredresponse.js +28 -0
- package/esm/models/operations/createinternchatcompletion.d.ts +5 -1
- package/esm/models/operations/createinternchatcompletion.js +25 -3
- package/esm/models/updatebyokkeyrequest.d.ts +5 -0
- package/esm/models/updatebyokkeyrequest.js +2 -0
- package/esm/sdk/interns.d.ts +13 -3
- package/esm/sdk/interns.js +3 -21
- package/jsr.json +1 -1
- package/package.json +9 -9
|
@@ -28,5 +28,15 @@ import { Result } from "../types/fp.js";
|
|
|
28
28
|
*
|
|
29
29
|
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
30
30
|
*/
|
|
31
|
+
export declare function internsChat(client: OpenRouterCore, request: operations.CreateInternChatCompletionRequest & {
|
|
32
|
+
internChatCompletionRequest: {
|
|
33
|
+
stream?: false;
|
|
34
|
+
};
|
|
35
|
+
}, options?: RequestOptions): APIPromise<Result<operations.CreateInternChatCompletionResponse, errors.InternChatErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
36
|
+
export declare function internsChat(client: OpenRouterCore, request: operations.CreateInternChatCompletionRequest & {
|
|
37
|
+
internChatCompletionRequest: {
|
|
38
|
+
stream: true;
|
|
39
|
+
};
|
|
40
|
+
}, options?: RequestOptions): APIPromise<Result<operations.CreateInternChatCompletionResponse, errors.InternChatErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
31
41
|
export declare function internsChat(client: OpenRouterCore, request: operations.CreateInternChatCompletionRequest, options?: RequestOptions): APIPromise<Result<operations.CreateInternChatCompletionResponse, errors.InternChatErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
32
42
|
//# sourceMappingURL=internsChat.d.ts.map
|
package/esm/funcs/internsChat.js
CHANGED
|
@@ -12,26 +12,6 @@ import { pathToFunc } from "../lib/url.js";
|
|
|
12
12
|
import * as errors from "../models/errors/index.js";
|
|
13
13
|
import * as operations from "../models/operations/index.js";
|
|
14
14
|
import { APIPromise } from "../types/async.js";
|
|
15
|
-
/**
|
|
16
|
-
* Stream a chat completion with an intern
|
|
17
|
-
*
|
|
18
|
-
* @remarks
|
|
19
|
-
* Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
|
|
20
|
-
*
|
|
21
|
-
* Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
|
|
22
|
-
*
|
|
23
|
-
* To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
|
|
24
|
-
*
|
|
25
|
-
* Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
|
|
26
|
-
*
|
|
27
|
-
* A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
|
|
28
|
-
*
|
|
29
|
-
* Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
|
|
30
|
-
*
|
|
31
|
-
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
32
|
-
*
|
|
33
|
-
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
34
|
-
*/
|
|
35
15
|
export function internsChat(client, request, options) {
|
|
36
16
|
return new APIPromise($do(client, request, options));
|
|
37
17
|
}
|
|
@@ -53,7 +33,9 @@ async function $do(client, request, options) {
|
|
|
53
33
|
const path = pathToFunc("/interns/{internId}/chat/completions")(pathParams);
|
|
54
34
|
const headers = new Headers(compactMap({
|
|
55
35
|
"Content-Type": "application/json",
|
|
56
|
-
Accept:
|
|
36
|
+
Accept: request?.internChatCompletionRequest?.stream
|
|
37
|
+
? "text/event-stream"
|
|
38
|
+
: "application/json",
|
|
57
39
|
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
58
40
|
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
59
41
|
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
@@ -112,6 +94,8 @@ async function $do(client, request, options) {
|
|
|
112
94
|
};
|
|
113
95
|
const [result] = await M.match(M.sse(200, operations.CreateInternChatCompletionResponse$inboundSchema, {
|
|
114
96
|
key: "Result",
|
|
97
|
+
}), M.json(202, operations.CreateInternChatCompletionResponse$inboundSchema, {
|
|
98
|
+
key: "Result",
|
|
115
99
|
}), M.jsonErr([400, 401, 403, 404, 408, 410, 413], errors.InternChatErrorResponse$inboundSchema), M.jsonErr([409, 429], errors.InternChatErrorResponse$inboundSchema, {
|
|
116
100
|
hdrs: true,
|
|
117
101
|
}), M.jsonErr(503, errors.InternChatErrorResponse$inboundSchema, {
|
|
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
|
|
|
13
13
|
* Create an intern
|
|
14
14
|
*
|
|
15
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.
|
|
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. 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.
|
|
17
17
|
*
|
|
18
18
|
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
19
19
|
*/
|
|
@@ -17,7 +17,7 @@ import { APIPromise } from "../types/async.js";
|
|
|
17
17
|
* Create an intern
|
|
18
18
|
*
|
|
19
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.
|
|
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. 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.
|
|
21
21
|
*
|
|
22
22
|
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
23
23
|
*/
|
|
@@ -94,7 +94,7 @@ async function $do(client, request, options) {
|
|
|
94
94
|
const responseFields = {
|
|
95
95
|
HttpMeta: { Response: response, Request: req },
|
|
96
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 });
|
|
97
|
+
const [result] = await M.match(M.json([200, 201], models.Intern$inboundSchema), M.jsonErr([400, 401, 403, 404, 408, 409, 413, 415], errors.InternLifecycleError$inboundSchema), M.jsonErr([500, 502], errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
98
98
|
if (!result.ok) {
|
|
99
99
|
return [result, { status: "complete", request: req, response }];
|
|
100
100
|
}
|
|
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
|
|
|
13
13
|
* Delete an intern
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
|
-
* Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. 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.
|
|
16
|
+
* Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. 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.
|
|
17
17
|
*
|
|
18
18
|
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
19
19
|
*/
|
|
@@ -17,7 +17,7 @@ import { APIPromise } from "../types/async.js";
|
|
|
17
17
|
* Delete an intern
|
|
18
18
|
*
|
|
19
19
|
* @remarks
|
|
20
|
-
* Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. 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.
|
|
20
|
+
* Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. 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.
|
|
21
21
|
*
|
|
22
22
|
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
23
23
|
*/
|
|
@@ -99,7 +99,7 @@ async function $do(client, request, options) {
|
|
|
99
99
|
const responseFields = {
|
|
100
100
|
HttpMeta: { Response: response, Request: req },
|
|
101
101
|
};
|
|
102
|
-
const [result] = await M.match(M.json(202, models.DeleteInternResponse$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 });
|
|
102
|
+
const [result] = await M.match(M.json(202, models.DeleteInternResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 408, 409, 413, 415], errors.InternLifecycleError$inboundSchema), M.jsonErr([500, 502], errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
103
103
|
if (!result.ok) {
|
|
104
104
|
return [result, { status: "complete", request: req, response }];
|
|
105
105
|
}
|
|
@@ -96,7 +96,7 @@ async function $do(client, request, options) {
|
|
|
96
96
|
const responseFields = {
|
|
97
97
|
HttpMeta: { Response: response, Request: req },
|
|
98
98
|
};
|
|
99
|
-
const [result] = await M.match(M.json(202, models.ProvisionInternResponse$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 });
|
|
99
|
+
const [result] = await M.match(M.json(202, models.ProvisionInternResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 408, 409, 413, 415], errors.InternLifecycleError$inboundSchema), M.jsonErr([500, 502], errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
100
100
|
if (!result.ok) {
|
|
101
101
|
return [result, { status: "complete", request: req, response }];
|
|
102
102
|
}
|
|
@@ -96,7 +96,7 @@ async function $do(client, request, options) {
|
|
|
96
96
|
const responseFields = {
|
|
97
97
|
HttpMeta: { Response: response, Request: req },
|
|
98
98
|
};
|
|
99
|
-
const [result] = await M.match(M.json(200, models.SuspendInternResponse$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 });
|
|
99
|
+
const [result] = await M.match(M.json(200, models.SuspendInternResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 408, 409, 413, 415], errors.InternLifecycleError$inboundSchema), M.jsonErr([500, 502], errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
100
100
|
if (!result.ok) {
|
|
101
101
|
return [result, { status: "complete", request: req, response }];
|
|
102
102
|
}
|
|
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
|
|
|
13
13
|
* Update an intern
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
|
-
* 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. 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.
|
|
16
|
+
* 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.
|
|
17
17
|
*
|
|
18
18
|
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
19
19
|
*/
|
|
@@ -17,7 +17,7 @@ import { APIPromise } from "../types/async.js";
|
|
|
17
17
|
* Update an intern
|
|
18
18
|
*
|
|
19
19
|
* @remarks
|
|
20
|
-
* 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. 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.
|
|
20
|
+
* 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.
|
|
21
21
|
*
|
|
22
22
|
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
23
23
|
*/
|
|
@@ -99,7 +99,7 @@ async function $do(client, request, options) {
|
|
|
99
99
|
const responseFields = {
|
|
100
100
|
HttpMeta: { Response: response, Request: req },
|
|
101
101
|
};
|
|
102
|
-
const [result] = await M.match(M.json(200, models.Intern$inboundSchema), M.jsonErr([400, 401, 403, 404, 408, 409, 413], errors.InternLifecycleError$inboundSchema), M.jsonErr(500, errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
|
+
const [result] = await M.match(M.json(200, models.Intern$inboundSchema), M.jsonErr([400, 401, 403, 404, 408, 409, 413, 415], errors.InternLifecycleError$inboundSchema), M.jsonErr(500, errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
103
103
|
if (!result.ok) {
|
|
104
104
|
return [result, { status: "complete", request: req, response }];
|
|
105
105
|
}
|
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.13";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.3.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.3.13 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.13",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.3.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.3.13 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
package/esm/models/byokkey.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ export type BYOKKey = {
|
|
|
19
19
|
* ISO timestamp of when the credential was created.
|
|
20
20
|
*/
|
|
21
21
|
createdAt: string;
|
|
22
|
+
/**
|
|
23
|
+
* Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter.
|
|
24
|
+
*/
|
|
25
|
+
declaredZdr: boolean | null;
|
|
22
26
|
/**
|
|
23
27
|
* Whether this credential is currently disabled.
|
|
24
28
|
*/
|
package/esm/models/byokkey.js
CHANGED
|
@@ -12,6 +12,7 @@ export const BYOKKey$inboundSchema = z.object({
|
|
|
12
12
|
allowed_models: z.nullable(z.array(z.string())),
|
|
13
13
|
allowed_user_ids: z.nullable(z.array(z.string())),
|
|
14
14
|
created_at: z.string(),
|
|
15
|
+
declared_zdr: z.nullable(z.boolean()),
|
|
15
16
|
disabled: z.boolean(),
|
|
16
17
|
id: z.string(),
|
|
17
18
|
is_byok_only: z.boolean(),
|
|
@@ -28,6 +29,7 @@ export const BYOKKey$inboundSchema = z.object({
|
|
|
28
29
|
"allowed_models": "allowedModels",
|
|
29
30
|
"allowed_user_ids": "allowedUserIds",
|
|
30
31
|
"created_at": "createdAt",
|
|
32
|
+
"declared_zdr": "declaredZdr",
|
|
31
33
|
"is_byok_only": "isByokOnly",
|
|
32
34
|
"is_fallback": "isFallback",
|
|
33
35
|
"is_required": "isRequired",
|
|
@@ -13,6 +13,10 @@ export type CreateBYOKKeyRequest = {
|
|
|
13
13
|
* Optional allowlist of user IDs that may use this credential. `null` means no restriction.
|
|
14
14
|
*/
|
|
15
15
|
allowedUserIds?: Array<string> | null | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Defaults to `null`.
|
|
18
|
+
*/
|
|
19
|
+
declaredZdr?: boolean | null | undefined;
|
|
16
20
|
/**
|
|
17
21
|
* Whether this credential should be created in a disabled state.
|
|
18
22
|
*/
|
|
@@ -51,6 +55,7 @@ export type CreateBYOKKeyRequest$Outbound = {
|
|
|
51
55
|
allowed_api_key_hashes?: Array<string> | null | undefined;
|
|
52
56
|
allowed_models?: Array<string> | null | undefined;
|
|
53
57
|
allowed_user_ids?: Array<string> | null | undefined;
|
|
58
|
+
declared_zdr?: boolean | null | undefined;
|
|
54
59
|
disabled?: boolean | undefined;
|
|
55
60
|
is_byok_only?: boolean | undefined;
|
|
56
61
|
is_fallback?: boolean | undefined;
|
|
@@ -10,6 +10,7 @@ export const CreateBYOKKeyRequest$outboundSchema = z.object({
|
|
|
10
10
|
allowedApiKeyHashes: z.nullable(z.array(z.string())).optional(),
|
|
11
11
|
allowedModels: z.nullable(z.array(z.string())).optional(),
|
|
12
12
|
allowedUserIds: z.nullable(z.array(z.string())).optional(),
|
|
13
|
+
declaredZdr: z.nullable(z.boolean()).optional(),
|
|
13
14
|
disabled: z.boolean().optional(),
|
|
14
15
|
isByokOnly: z.boolean().optional(),
|
|
15
16
|
isFallback: z.boolean().optional(),
|
|
@@ -23,6 +24,7 @@ export const CreateBYOKKeyRequest$outboundSchema = z.object({
|
|
|
23
24
|
allowedApiKeyHashes: "allowed_api_key_hashes",
|
|
24
25
|
allowedModels: "allowed_models",
|
|
25
26
|
allowedUserIds: "allowed_user_ids",
|
|
27
|
+
declaredZdr: "declared_zdr",
|
|
26
28
|
isByokOnly: "is_byok_only",
|
|
27
29
|
isFallback: "is_fallback",
|
|
28
30
|
isRequired: "is_required",
|
|
@@ -10,11 +10,11 @@ export declare const ApiType: {
|
|
|
10
10
|
readonly Completions: "completions";
|
|
11
11
|
readonly Embeddings: "embeddings";
|
|
12
12
|
readonly Rerank: "rerank";
|
|
13
|
+
readonly Decisions: "decisions";
|
|
14
|
+
readonly Video: "video";
|
|
13
15
|
readonly TTS: "tts";
|
|
14
16
|
readonly STT: "stt";
|
|
15
|
-
readonly Video: "video";
|
|
16
17
|
readonly Image: "image";
|
|
17
|
-
readonly Decisions: "decisions";
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* Type of API used for the generation
|
|
@@ -14,11 +14,11 @@ export const ApiType = {
|
|
|
14
14
|
Completions: "completions",
|
|
15
15
|
Embeddings: "embeddings",
|
|
16
16
|
Rerank: "rerank",
|
|
17
|
+
Decisions: "decisions",
|
|
18
|
+
Video: "video",
|
|
17
19
|
TTS: "tts",
|
|
18
20
|
STT: "stt",
|
|
19
|
-
Video: "video",
|
|
20
21
|
Image: "image",
|
|
21
|
-
Decisions: "decisions",
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* The data region this generation was routed through: 'global', 'europe', or 'us'.
|
package/esm/models/index.d.ts
CHANGED
|
@@ -331,6 +331,7 @@ export * from "./internchaterrormetadata.js";
|
|
|
331
331
|
export * from "./internchatmessage.js";
|
|
332
332
|
export * from "./internchatmessagecontent.js";
|
|
333
333
|
export * from "./internchatprompttokensdetails.js";
|
|
334
|
+
export * from "./internchatsteeredresponse.js";
|
|
334
335
|
export * from "./internchatstreamerror.js";
|
|
335
336
|
export * from "./internchatstreamingresponse.js";
|
|
336
337
|
export * from "./internchatsystemmessage.js";
|
package/esm/models/index.js
CHANGED
|
@@ -335,6 +335,7 @@ export * from "./internchaterrormetadata.js";
|
|
|
335
335
|
export * from "./internchatmessage.js";
|
|
336
336
|
export * from "./internchatmessagecontent.js";
|
|
337
337
|
export * from "./internchatprompttokensdetails.js";
|
|
338
|
+
export * from "./internchatsteeredresponse.js";
|
|
338
339
|
export * from "./internchatstreamerror.js";
|
|
339
340
|
export * from "./internchatstreamingresponse.js";
|
|
340
341
|
export * from "./internchatsystemmessage.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
/**
|
|
6
|
+
* The message was handed to the turn already running on this session.
|
|
7
|
+
*/
|
|
8
|
+
export declare const InternChatSteeredResponseStatus: {
|
|
9
|
+
readonly Steered: "steered";
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The message was handed to the turn already running on this session.
|
|
13
|
+
*/
|
|
14
|
+
export type InternChatSteeredResponseStatus = ClosedEnum<typeof InternChatSteeredResponseStatus>;
|
|
15
|
+
/**
|
|
16
|
+
* The message was delivered into the turn already running on the same session. Its effect is streamed on that turn, not here.
|
|
17
|
+
*/
|
|
18
|
+
export type InternChatSteeredResponse = {
|
|
19
|
+
/**
|
|
20
|
+
* The session of the running turn the message was delivered to.
|
|
21
|
+
*/
|
|
22
|
+
sessionId: string;
|
|
23
|
+
/**
|
|
24
|
+
* The message was handed to the turn already running on this session.
|
|
25
|
+
*/
|
|
26
|
+
status: InternChatSteeredResponseStatus;
|
|
27
|
+
};
|
|
28
|
+
/** @internal */
|
|
29
|
+
export declare const InternChatSteeredResponseStatus$inboundSchema: z.ZodEnum<typeof InternChatSteeredResponseStatus>;
|
|
30
|
+
/** @internal */
|
|
31
|
+
export declare const InternChatSteeredResponse$inboundSchema: z.ZodType<InternChatSteeredResponse, unknown>;
|
|
32
|
+
export declare function internChatSteeredResponseFromJSON(jsonString: string): SafeParseResult<InternChatSteeredResponse, SDKValidationError>;
|
|
33
|
+
//# sourceMappingURL=internchatsteeredresponse.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 81a2168a45b8
|
|
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
|
+
/**
|
|
9
|
+
* The message was handed to the turn already running on this session.
|
|
10
|
+
*/
|
|
11
|
+
export const InternChatSteeredResponseStatus = {
|
|
12
|
+
Steered: "steered",
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const InternChatSteeredResponseStatus$inboundSchema = z.enum(InternChatSteeredResponseStatus);
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const InternChatSteeredResponse$inboundSchema = z.object({
|
|
18
|
+
session_id: z.string(),
|
|
19
|
+
status: InternChatSteeredResponseStatus$inboundSchema,
|
|
20
|
+
}).transform((v) => {
|
|
21
|
+
return remap$(v, {
|
|
22
|
+
"session_id": "sessionId",
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
export function internChatSteeredResponseFromJSON(jsonString) {
|
|
26
|
+
return safeParse(jsonString, (x) => InternChatSteeredResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternChatSteeredResponse' from JSON`);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=internchatsteeredresponse.js.map
|
|
@@ -50,11 +50,12 @@ export type CreateInternChatCompletionRequest = {
|
|
|
50
50
|
internId: string;
|
|
51
51
|
internChatCompletionRequest: models.InternChatCompletionRequest;
|
|
52
52
|
};
|
|
53
|
+
export type CreateInternChatCompletionResponseResult = models.InternChatSteeredResponse | EventStream<models.InternChatCompletionChunk>;
|
|
53
54
|
export type CreateInternChatCompletionResponse = {
|
|
54
55
|
headers: {
|
|
55
56
|
[k: string]: Array<string>;
|
|
56
57
|
};
|
|
57
|
-
result: EventStream<models.InternChatCompletionChunk>;
|
|
58
|
+
result: models.InternChatSteeredResponse | EventStream<models.InternChatCompletionChunk>;
|
|
58
59
|
};
|
|
59
60
|
/** @internal */
|
|
60
61
|
export type CreateInternChatCompletionRequest$Outbound = {
|
|
@@ -68,6 +69,9 @@ export type CreateInternChatCompletionRequest$Outbound = {
|
|
|
68
69
|
export declare const CreateInternChatCompletionRequest$outboundSchema: z.ZodType<CreateInternChatCompletionRequest$Outbound, CreateInternChatCompletionRequest>;
|
|
69
70
|
export declare function createInternChatCompletionRequestToJSON(createInternChatCompletionRequest: CreateInternChatCompletionRequest): string;
|
|
70
71
|
/** @internal */
|
|
72
|
+
export declare const CreateInternChatCompletionResponseResult$inboundSchema: z.ZodType<CreateInternChatCompletionResponseResult, unknown>;
|
|
73
|
+
export declare function createInternChatCompletionResponseResultFromJSON(jsonString: string): SafeParseResult<CreateInternChatCompletionResponseResult, SDKValidationError>;
|
|
74
|
+
/** @internal */
|
|
71
75
|
export declare const CreateInternChatCompletionResponse$inboundSchema: z.ZodType<CreateInternChatCompletionResponse, unknown>;
|
|
72
76
|
export declare function createInternChatCompletionResponseFromJSON(jsonString: string): SafeParseResult<CreateInternChatCompletionResponse, SDKValidationError>;
|
|
73
77
|
//# sourceMappingURL=createinternchatcompletion.d.ts.map
|
|
@@ -24,9 +24,9 @@ export function createInternChatCompletionRequestToJSON(createInternChatCompleti
|
|
|
24
24
|
return JSON.stringify(CreateInternChatCompletionRequest$outboundSchema.parse(createInternChatCompletionRequest));
|
|
25
25
|
}
|
|
26
26
|
/** @internal */
|
|
27
|
-
export const
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
export const CreateInternChatCompletionResponseResult$inboundSchema = z.union([
|
|
28
|
+
models.InternChatSteeredResponse$inboundSchema,
|
|
29
|
+
z.custom(x => x instanceof ReadableStream)
|
|
30
30
|
.transform(stream => {
|
|
31
31
|
return new EventStream(stream, rawEvent => {
|
|
32
32
|
if (rawEvent.data === "[DONE]")
|
|
@@ -37,6 +37,28 @@ export const CreateInternChatCompletionResponse$inboundSchema = z.object({
|
|
|
37
37
|
};
|
|
38
38
|
});
|
|
39
39
|
}),
|
|
40
|
+
]);
|
|
41
|
+
export function createInternChatCompletionResponseResultFromJSON(jsonString) {
|
|
42
|
+
return safeParse(jsonString, (x) => CreateInternChatCompletionResponseResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateInternChatCompletionResponseResult' from JSON`);
|
|
43
|
+
}
|
|
44
|
+
/** @internal */
|
|
45
|
+
export const CreateInternChatCompletionResponse$inboundSchema = z.object({
|
|
46
|
+
Headers: z.record(z.string(), z.array(z.string())).default({}),
|
|
47
|
+
Result: z.union([
|
|
48
|
+
models.InternChatSteeredResponse$inboundSchema,
|
|
49
|
+
z.custom(x => x instanceof ReadableStream)
|
|
50
|
+
.transform(stream => {
|
|
51
|
+
return new EventStream(stream, rawEvent => {
|
|
52
|
+
if (rawEvent.data === "[DONE]") {
|
|
53
|
+
return { done: true, value: undefined };
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
done: false,
|
|
57
|
+
value: models.InternChatStreamingResponse$inboundSchema.parse(rawEvent)?.data,
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
}),
|
|
61
|
+
]),
|
|
40
62
|
}).transform((v) => {
|
|
41
63
|
return remap$(v, {
|
|
42
64
|
"Headers": "headers",
|
|
@@ -12,6 +12,10 @@ export type UpdateBYOKKeyRequest = {
|
|
|
12
12
|
* Optional allowlist of user IDs that may use this credential. `null` means no restriction.
|
|
13
13
|
*/
|
|
14
14
|
allowedUserIds?: Array<string> | null | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Your declaration of whether the upstream provider account behind this credential has zero data retention (ZDR). `null` inherits OpenRouter's data policy for the provider's endpoint; `true` declares the account ZDR so requests that require ZDR may route to this credential even when the shared endpoint retains data; `false` declares it non-ZDR so such requests never route to it. Self-declared and not verified by OpenRouter. Omit to leave the stored value unchanged; `null` clears the declaration.
|
|
17
|
+
*/
|
|
18
|
+
declaredZdr?: boolean | null | undefined;
|
|
15
19
|
/**
|
|
16
20
|
* Whether this credential is disabled.
|
|
17
21
|
*/
|
|
@@ -42,6 +46,7 @@ export type UpdateBYOKKeyRequest$Outbound = {
|
|
|
42
46
|
allowed_api_key_hashes?: Array<string> | null | undefined;
|
|
43
47
|
allowed_models?: Array<string> | null | undefined;
|
|
44
48
|
allowed_user_ids?: Array<string> | null | undefined;
|
|
49
|
+
declared_zdr?: boolean | null | undefined;
|
|
45
50
|
disabled?: boolean | undefined;
|
|
46
51
|
is_byok_only?: boolean | undefined;
|
|
47
52
|
is_fallback?: boolean | undefined;
|
|
@@ -9,6 +9,7 @@ export const UpdateBYOKKeyRequest$outboundSchema = z.object({
|
|
|
9
9
|
allowedApiKeyHashes: z.nullable(z.array(z.string())).optional(),
|
|
10
10
|
allowedModels: z.nullable(z.array(z.string())).optional(),
|
|
11
11
|
allowedUserIds: z.nullable(z.array(z.string())).optional(),
|
|
12
|
+
declaredZdr: z.nullable(z.boolean()).optional(),
|
|
12
13
|
disabled: z.boolean().optional(),
|
|
13
14
|
isByokOnly: z.boolean().optional(),
|
|
14
15
|
isFallback: z.boolean().optional(),
|
|
@@ -20,6 +21,7 @@ export const UpdateBYOKKeyRequest$outboundSchema = z.object({
|
|
|
20
21
|
allowedApiKeyHashes: "allowed_api_key_hashes",
|
|
21
22
|
allowedModels: "allowed_models",
|
|
22
23
|
allowedUserIds: "allowed_user_ids",
|
|
24
|
+
declaredZdr: "declared_zdr",
|
|
23
25
|
isByokOnly: "is_byok_only",
|
|
24
26
|
isFallback: "is_fallback",
|
|
25
27
|
isRequired: "is_required",
|
package/esm/sdk/interns.d.ts
CHANGED
|
@@ -13,14 +13,14 @@ export declare class Interns extends ClientSDK {
|
|
|
13
13
|
* Create an intern
|
|
14
14
|
*
|
|
15
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.
|
|
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. 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.
|
|
17
17
|
*/
|
|
18
18
|
createIntern(request: operations.CreateInternRequest, options?: RequestOptions): Promise<models.Intern>;
|
|
19
19
|
/**
|
|
20
20
|
* Delete an intern
|
|
21
21
|
*
|
|
22
22
|
* @remarks
|
|
23
|
-
* Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. 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.
|
|
23
|
+
* Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. 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.
|
|
24
24
|
*/
|
|
25
25
|
deleteIntern(request: operations.DeleteInternRequest, options?: RequestOptions): Promise<models.DeleteInternResponse>;
|
|
26
26
|
/**
|
|
@@ -34,7 +34,7 @@ export declare class Interns extends ClientSDK {
|
|
|
34
34
|
* Update an intern
|
|
35
35
|
*
|
|
36
36
|
* @remarks
|
|
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. 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.
|
|
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
40
|
/**
|
|
@@ -69,6 +69,16 @@ export declare class Interns extends ClientSDK {
|
|
|
69
69
|
*
|
|
70
70
|
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
71
71
|
*/
|
|
72
|
+
chat(request: operations.CreateInternChatCompletionRequest & {
|
|
73
|
+
internChatCompletionRequest: {
|
|
74
|
+
stream?: false | undefined;
|
|
75
|
+
};
|
|
76
|
+
}, options?: RequestOptions): Promise<operations.CreateInternChatCompletionResponse>;
|
|
77
|
+
chat(request: operations.CreateInternChatCompletionRequest & {
|
|
78
|
+
internChatCompletionRequest: {
|
|
79
|
+
stream: true;
|
|
80
|
+
};
|
|
81
|
+
}, options?: RequestOptions): Promise<operations.CreateInternChatCompletionResponse>;
|
|
72
82
|
chat(request: operations.CreateInternChatCompletionRequest, options?: RequestOptions): Promise<operations.CreateInternChatCompletionResponse>;
|
|
73
83
|
}
|
|
74
84
|
//# sourceMappingURL=interns.d.ts.map
|
package/esm/sdk/interns.js
CHANGED
|
@@ -26,7 +26,7 @@ export class Interns extends ClientSDK {
|
|
|
26
26
|
* Create an intern
|
|
27
27
|
*
|
|
28
28
|
* @remarks
|
|
29
|
-
* 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.
|
|
29
|
+
* 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. 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.
|
|
30
30
|
*/
|
|
31
31
|
async createIntern(request, options) {
|
|
32
32
|
return unwrapAsync(internsCreateIntern(this, request, options));
|
|
@@ -35,7 +35,7 @@ export class Interns extends ClientSDK {
|
|
|
35
35
|
* Delete an intern
|
|
36
36
|
*
|
|
37
37
|
* @remarks
|
|
38
|
-
* Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. 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.
|
|
38
|
+
* Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. 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.
|
|
39
39
|
*/
|
|
40
40
|
async deleteIntern(request, options) {
|
|
41
41
|
return unwrapAsync(internsDeleteIntern(this, request, options));
|
|
@@ -53,7 +53,7 @@ export class Interns extends ClientSDK {
|
|
|
53
53
|
* Update an intern
|
|
54
54
|
*
|
|
55
55
|
* @remarks
|
|
56
|
-
* 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. 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.
|
|
56
|
+
* 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.
|
|
57
57
|
*/
|
|
58
58
|
async updateIntern(request, options) {
|
|
59
59
|
return unwrapAsync(internsUpdateIntern(this, request, options));
|
|
@@ -76,24 +76,6 @@ export class Interns extends ClientSDK {
|
|
|
76
76
|
async suspendIntern(request, options) {
|
|
77
77
|
return unwrapAsync(internsSuspendIntern(this, request, options));
|
|
78
78
|
}
|
|
79
|
-
/**
|
|
80
|
-
* Stream a chat completion with an intern
|
|
81
|
-
*
|
|
82
|
-
* @remarks
|
|
83
|
-
* Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
|
|
84
|
-
*
|
|
85
|
-
* Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
|
|
86
|
-
*
|
|
87
|
-
* To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
|
|
88
|
-
*
|
|
89
|
-
* Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
|
|
90
|
-
*
|
|
91
|
-
* A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
|
|
92
|
-
*
|
|
93
|
-
* Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
|
|
94
|
-
*
|
|
95
|
-
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
96
|
-
*/
|
|
97
79
|
async chat(request, options) {
|
|
98
80
|
return unwrapAsync(internsChat(this, request, options));
|
|
99
81
|
}
|
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.13",
|
|
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
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"access": "public",
|
|
25
|
+
"provenance": true
|
|
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",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"prepare": "npm run build",
|
|
77
|
-
"test": "vitest --run --project unit",
|
|
78
|
-
"test:e2e": "vitest --run --project e2e",
|
|
79
|
-
"test:transit": "exit 0",
|
|
80
|
-
"typecheck:transit": "exit 0",
|
|
81
76
|
"compile": "tsc",
|
|
82
77
|
"postinstall": "node scripts/check-types.js || true",
|
|
78
|
+
"test": "vitest --run --project unit",
|
|
79
|
+
"test:e2e": "vitest --run --project e2e",
|
|
83
80
|
"test:watch": "vitest --watch --project unit",
|
|
84
|
-
"
|
|
81
|
+
"prepare": "npm run build",
|
|
82
|
+
"test:transit": "exit 0",
|
|
83
|
+
"typecheck": "tsc --noEmit",
|
|
84
|
+
"typecheck:transit": "exit 0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|