@openrouter/sdk 1.3.8 → 1.3.9
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 +1 -3
- package/esm/funcs/internsChat.js +7 -15
- package/esm/funcs/internsProvisionIntern.d.ts +1 -1
- package/esm/funcs/internsProvisionIntern.js +2 -2
- package/esm/funcs/internsSuspendIntern.d.ts +1 -1
- package/esm/funcs/internsSuspendIntern.js +2 -2
- package/esm/funcs/internsUpdateIntern.js +1 -1
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/internchaterrormetadata.d.ts +4 -0
- package/esm/models/internchaterrormetadata.js +1 -0
- package/esm/models/internlifecycleerror.d.ts +8 -0
- package/esm/models/internlifecycleerror.js +9 -0
- package/esm/models/operations/createintern.d.ts +1 -1
- package/esm/models/operations/createinternchatcompletion.d.ts +12 -0
- package/esm/models/operations/createinternchatcompletion.js +25 -0
- package/esm/models/operations/listinterns.d.ts +1 -1
- package/esm/sdk/interns.d.ts +3 -4
- package/esm/sdk/interns.js +2 -2
- package/jsr.json +1 -1
- package/package.json +4 -4
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { OpenRouterCore } from "../core.js";
|
|
2
|
-
import { EventStream } from "../lib/event-streams.js";
|
|
3
2
|
import { RequestOptions } from "../lib/sdks.js";
|
|
4
3
|
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
5
4
|
import * as errors from "../models/errors/index.js";
|
|
6
5
|
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
7
6
|
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
8
7
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
9
|
-
import * as models from "../models/index.js";
|
|
10
8
|
import * as operations from "../models/operations/index.js";
|
|
11
9
|
import { APIPromise } from "../types/async.js";
|
|
12
10
|
import { Result } from "../types/fp.js";
|
|
@@ -30,5 +28,5 @@ import { Result } from "../types/fp.js";
|
|
|
30
28
|
*
|
|
31
29
|
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
32
30
|
*/
|
|
33
|
-
export declare function internsChat(client: OpenRouterCore, request: operations.CreateInternChatCompletionRequest, options?: RequestOptions): APIPromise<Result<
|
|
31
|
+
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>>;
|
|
34
32
|
//# sourceMappingURL=internsChat.d.ts.map
|
package/esm/funcs/internsChat.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
* @generated-id: 36149dc7ea8d
|
|
4
4
|
*/
|
|
5
|
-
import * as z from "zod/v4";
|
|
6
5
|
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
-
import { EventStream } from "../lib/event-streams.js";
|
|
8
6
|
import { matchStatusCode } from "../lib/http.js";
|
|
9
7
|
import * as M from "../lib/matchers.js";
|
|
10
8
|
import { compactMap } from "../lib/primitives.js";
|
|
@@ -12,7 +10,6 @@ import { safeParse } from "../lib/schemas.js";
|
|
|
12
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
11
|
import { pathToFunc } from "../lib/url.js";
|
|
14
12
|
import * as errors from "../models/errors/index.js";
|
|
15
|
-
import * as models from "../models/index.js";
|
|
16
13
|
import * as operations from "../models/operations/index.js";
|
|
17
14
|
import { APIPromise } from "../types/async.js";
|
|
18
15
|
/**
|
|
@@ -113,18 +110,13 @@ async function $do(client, request, options) {
|
|
|
113
110
|
const responseFields = {
|
|
114
111
|
HttpMeta: { Response: response, Request: req },
|
|
115
112
|
};
|
|
116
|
-
const [result] = await M.match(M.sse(200,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
done: false,
|
|
124
|
-
value: models.InternChatStreamingResponse$inboundSchema.parse(rawEvent)?.data,
|
|
125
|
-
};
|
|
126
|
-
});
|
|
127
|
-
})), M.jsonErr([400, 401, 403, 404, 409, 410, 413, 429], errors.InternChatErrorResponse$inboundSchema), M.jsonErr([502, 503, 504], errors.InternChatErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
113
|
+
const [result] = await M.match(M.sse(200, operations.CreateInternChatCompletionResponse$inboundSchema, {
|
|
114
|
+
key: "Result",
|
|
115
|
+
}), M.jsonErr([400, 401, 403, 404, 408, 410, 413], errors.InternChatErrorResponse$inboundSchema), M.jsonErr([409, 429], errors.InternChatErrorResponse$inboundSchema, {
|
|
116
|
+
hdrs: true,
|
|
117
|
+
}), M.jsonErr(503, errors.InternChatErrorResponse$inboundSchema, {
|
|
118
|
+
hdrs: true,
|
|
119
|
+
}), M.jsonErr([502, 504], errors.InternChatErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
128
120
|
if (!result.ok) {
|
|
129
121
|
return [result, { status: "complete", request: req, response }];
|
|
130
122
|
}
|
|
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
|
|
|
13
13
|
* Provision an intern
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
|
-
* Starts the first boot, or resumes an intern after suspension. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
|
|
16
|
+
* Starts the first boot, or resumes an intern after suspension. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. 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
|
* Provision an intern
|
|
18
18
|
*
|
|
19
19
|
* @remarks
|
|
20
|
-
* Starts the first boot, or resumes an intern after suspension. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
|
|
20
|
+
* Starts the first boot, or resumes an intern after suspension. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. 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
|
*/
|
|
@@ -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([401, 403, 404, 408, 409], errors.InternLifecycleError$inboundSchema), M.jsonErr([500, 502], errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
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 });
|
|
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
|
* Suspend an intern
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
|
-
* Stops the intern runtime while keeping its disk and configuration for a later provision call. 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
|
+
* Stops the intern runtime while keeping its disk and configuration for a later provision call. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. 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
|
* Suspend an intern
|
|
18
18
|
*
|
|
19
19
|
* @remarks
|
|
20
|
-
* Stops the intern runtime while keeping its disk and configuration for a later provision call. 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
|
+
* Stops the intern runtime while keeping its disk and configuration for a later provision call. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. 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
|
*/
|
|
@@ -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([401, 403, 404, 408, 409], errors.InternLifecycleError$inboundSchema), M.jsonErr([500, 502], errors.InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
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 });
|
|
100
100
|
if (!result.ok) {
|
|
101
101
|
return [result, { status: "complete", request: req, response }];
|
|
102
102
|
}
|
|
@@ -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, 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], 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.9";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.3.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.3.9 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.9",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.3.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.3.9 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -35,6 +35,10 @@ export type InternChatErrorMetadata = {
|
|
|
35
35
|
* A stable reason a client can branch on.
|
|
36
36
|
*/
|
|
37
37
|
reason: InternChatErrorMetadataReason;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the same request may be sent again unchanged. Always `true` for the transient refusals — `busy`, `intern_not_ready`, `intern_unreachable`, `rate_limited`, `stream_severed` and `timeout` — and always `false` for the ones a retry cannot fix. For `turn_failed` it varies by failure and is the intern's own classification of what went wrong: `true` for an upstream overload, rate limit, timeout or transport fault, `false` for an authentication or bad-request failure that would be rejected the same way again. Branch on this field rather than on `reason` when deciding whether to retry. A `429`, and a `409` or `503` with reason `busy`, also carry a `Retry-After` header saying how long to wait.
|
|
40
|
+
*/
|
|
41
|
+
retryable: boolean;
|
|
38
42
|
};
|
|
39
43
|
/** @internal */
|
|
40
44
|
export declare const InternChatErrorMetadataReason$inboundSchema: z.ZodType<InternChatErrorMetadataReason, unknown>;
|
|
@@ -31,6 +31,7 @@ export const InternChatErrorMetadataReason$inboundSchema = openEnums.inboundSche
|
|
|
31
31
|
/** @internal */
|
|
32
32
|
export const InternChatErrorMetadata$inboundSchema = z.object({
|
|
33
33
|
reason: InternChatErrorMetadataReason$inboundSchema,
|
|
34
|
+
retryable: z.boolean(),
|
|
34
35
|
});
|
|
35
36
|
export function internChatErrorMetadataFromJSON(jsonString) {
|
|
36
37
|
return safeParse(jsonString, (x) => InternChatErrorMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternChatErrorMetadata' from JSON`);
|
|
@@ -2,14 +2,22 @@ import * as z from "zod/v4";
|
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
3
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
4
|
export type Code = string | number;
|
|
5
|
+
export type InternLifecycleErrorMetadata = {
|
|
6
|
+
reason: string;
|
|
7
|
+
retryable: boolean;
|
|
8
|
+
};
|
|
5
9
|
export type InternLifecycleErrorError = {
|
|
6
10
|
code: string | number;
|
|
7
11
|
message: string;
|
|
12
|
+
metadata?: InternLifecycleErrorMetadata | undefined;
|
|
8
13
|
};
|
|
9
14
|
/** @internal */
|
|
10
15
|
export declare const Code$inboundSchema: z.ZodType<Code, unknown>;
|
|
11
16
|
export declare function codeFromJSON(jsonString: string): SafeParseResult<Code, SDKValidationError>;
|
|
12
17
|
/** @internal */
|
|
18
|
+
export declare const InternLifecycleErrorMetadata$inboundSchema: z.ZodType<InternLifecycleErrorMetadata, unknown>;
|
|
19
|
+
export declare function internLifecycleErrorMetadataFromJSON(jsonString: string): SafeParseResult<InternLifecycleErrorMetadata, SDKValidationError>;
|
|
20
|
+
/** @internal */
|
|
13
21
|
export declare const InternLifecycleErrorError$inboundSchema: z.ZodType<InternLifecycleErrorError, unknown>;
|
|
14
22
|
export declare function internLifecycleErrorErrorFromJSON(jsonString: string): SafeParseResult<InternLifecycleErrorError, SDKValidationError>;
|
|
15
23
|
//# sourceMappingURL=internlifecycleerror.d.ts.map
|
|
@@ -13,9 +13,18 @@ export function codeFromJSON(jsonString) {
|
|
|
13
13
|
return safeParse(jsonString, (x) => Code$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Code' from JSON`);
|
|
14
14
|
}
|
|
15
15
|
/** @internal */
|
|
16
|
+
export const InternLifecycleErrorMetadata$inboundSchema = z.object({
|
|
17
|
+
reason: z.string(),
|
|
18
|
+
retryable: z.boolean(),
|
|
19
|
+
});
|
|
20
|
+
export function internLifecycleErrorMetadataFromJSON(jsonString) {
|
|
21
|
+
return safeParse(jsonString, (x) => InternLifecycleErrorMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternLifecycleErrorMetadata' from JSON`);
|
|
22
|
+
}
|
|
23
|
+
/** @internal */
|
|
16
24
|
export const InternLifecycleErrorError$inboundSchema = z.object({
|
|
17
25
|
code: z.union([z.string(), z.int()]),
|
|
18
26
|
message: z.string(),
|
|
27
|
+
metadata: z.lazy(() => InternLifecycleErrorMetadata$inboundSchema).optional(),
|
|
19
28
|
});
|
|
20
29
|
export function internLifecycleErrorErrorFromJSON(jsonString) {
|
|
21
30
|
return safeParse(jsonString, (x) => InternLifecycleErrorError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternLifecycleErrorError' from JSON`);
|
|
@@ -42,7 +42,7 @@ export type CreateInternRequest = {
|
|
|
42
42
|
*/
|
|
43
43
|
appCategories?: string | undefined;
|
|
44
44
|
/**
|
|
45
|
-
* Key that makes retries resume the same create operation. Without
|
|
45
|
+
* Key that makes retries resume the same create operation, from 1 through 255 characters. An empty or longer key is refused with 400. Without the header, the server derives a stable key from the request body.
|
|
46
46
|
*/
|
|
47
47
|
idempotencyKey?: string | undefined;
|
|
48
48
|
createInternRequest: models.CreateInternRequest;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import { EventStream } from "../../lib/event-streams.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
2
5
|
import * as models from "../index.js";
|
|
3
6
|
export type CreateInternChatCompletionGlobals = {
|
|
4
7
|
/**
|
|
@@ -47,6 +50,12 @@ export type CreateInternChatCompletionRequest = {
|
|
|
47
50
|
internId: string;
|
|
48
51
|
internChatCompletionRequest: models.InternChatCompletionRequest;
|
|
49
52
|
};
|
|
53
|
+
export type CreateInternChatCompletionResponse = {
|
|
54
|
+
headers: {
|
|
55
|
+
[k: string]: Array<string>;
|
|
56
|
+
};
|
|
57
|
+
result: EventStream<models.InternChatCompletionChunk>;
|
|
58
|
+
};
|
|
50
59
|
/** @internal */
|
|
51
60
|
export type CreateInternChatCompletionRequest$Outbound = {
|
|
52
61
|
"HTTP-Referer"?: string | undefined;
|
|
@@ -58,4 +67,7 @@ export type CreateInternChatCompletionRequest$Outbound = {
|
|
|
58
67
|
/** @internal */
|
|
59
68
|
export declare const CreateInternChatCompletionRequest$outboundSchema: z.ZodType<CreateInternChatCompletionRequest$Outbound, CreateInternChatCompletionRequest>;
|
|
60
69
|
export declare function createInternChatCompletionRequestToJSON(createInternChatCompletionRequest: CreateInternChatCompletionRequest): string;
|
|
70
|
+
/** @internal */
|
|
71
|
+
export declare const CreateInternChatCompletionResponse$inboundSchema: z.ZodType<CreateInternChatCompletionResponse, unknown>;
|
|
72
|
+
export declare function createInternChatCompletionResponseFromJSON(jsonString: string): SafeParseResult<CreateInternChatCompletionResponse, SDKValidationError>;
|
|
61
73
|
//# sourceMappingURL=createinternchatcompletion.d.ts.map
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* @generated-id: 0d92e801a635
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
|
+
import { EventStream } from "../../lib/event-streams.js";
|
|
6
7
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
8
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
9
|
import * as models from "../index.js";
|
|
8
10
|
/** @internal */
|
|
9
11
|
export const CreateInternChatCompletionRequest$outboundSchema = z.object({
|
|
@@ -21,4 +23,27 @@ export const CreateInternChatCompletionRequest$outboundSchema = z.object({
|
|
|
21
23
|
export function createInternChatCompletionRequestToJSON(createInternChatCompletionRequest) {
|
|
22
24
|
return JSON.stringify(CreateInternChatCompletionRequest$outboundSchema.parse(createInternChatCompletionRequest));
|
|
23
25
|
}
|
|
26
|
+
/** @internal */
|
|
27
|
+
export const CreateInternChatCompletionResponse$inboundSchema = z.object({
|
|
28
|
+
Headers: z.record(z.string(), z.array(z.string())).default({}),
|
|
29
|
+
Result: z.custom(x => x instanceof ReadableStream)
|
|
30
|
+
.transform(stream => {
|
|
31
|
+
return new EventStream(stream, rawEvent => {
|
|
32
|
+
if (rawEvent.data === "[DONE]")
|
|
33
|
+
return { done: true, value: undefined };
|
|
34
|
+
return {
|
|
35
|
+
done: false,
|
|
36
|
+
value: models.InternChatStreamingResponse$inboundSchema.parse(rawEvent)?.data,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}),
|
|
40
|
+
}).transform((v) => {
|
|
41
|
+
return remap$(v, {
|
|
42
|
+
"Headers": "headers",
|
|
43
|
+
"Result": "result",
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
export function createInternChatCompletionResponseFromJSON(jsonString) {
|
|
47
|
+
return safeParse(jsonString, (x) => CreateInternChatCompletionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateInternChatCompletionResponse' from JSON`);
|
|
48
|
+
}
|
|
24
49
|
//# sourceMappingURL=createinternchatcompletion.js.map
|
|
@@ -57,7 +57,7 @@ export type ListInternsRequest = {
|
|
|
57
57
|
*/
|
|
58
58
|
limit?: number | undefined;
|
|
59
59
|
/**
|
|
60
|
-
* Comma-separated lifecycle statuses to include.
|
|
60
|
+
* Comma-separated lifecycle statuses to include, at most 8. Repeats are collapsed.
|
|
61
61
|
*/
|
|
62
62
|
status?: Array<Status> | undefined;
|
|
63
63
|
/**
|
package/esm/sdk/interns.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EventStream } from "../lib/event-streams.js";
|
|
2
1
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
3
2
|
import * as models from "../models/index.js";
|
|
4
3
|
import * as operations from "../models/operations/index.js";
|
|
@@ -42,14 +41,14 @@ export declare class Interns extends ClientSDK {
|
|
|
42
41
|
* Provision an intern
|
|
43
42
|
*
|
|
44
43
|
* @remarks
|
|
45
|
-
* Starts the first boot, or resumes an intern after suspension. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
|
|
44
|
+
* Starts the first boot, or resumes an intern after suspension. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. 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.
|
|
46
45
|
*/
|
|
47
46
|
provisionIntern(request: operations.ProvisionInternRequest, options?: RequestOptions): Promise<models.ProvisionInternResponse>;
|
|
48
47
|
/**
|
|
49
48
|
* Suspend an intern
|
|
50
49
|
*
|
|
51
50
|
* @remarks
|
|
52
|
-
* Stops the intern runtime while keeping its disk and configuration for a later provision call. 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.
|
|
51
|
+
* Stops the intern runtime while keeping its disk and configuration for a later provision call. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. 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.
|
|
53
52
|
*/
|
|
54
53
|
suspendIntern(request: operations.SuspendInternRequest, options?: RequestOptions): Promise<models.SuspendInternResponse>;
|
|
55
54
|
/**
|
|
@@ -70,6 +69,6 @@ export declare class Interns extends ClientSDK {
|
|
|
70
69
|
*
|
|
71
70
|
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
72
71
|
*/
|
|
73
|
-
chat(request: operations.CreateInternChatCompletionRequest, options?: RequestOptions): Promise<
|
|
72
|
+
chat(request: operations.CreateInternChatCompletionRequest, options?: RequestOptions): Promise<operations.CreateInternChatCompletionResponse>;
|
|
74
73
|
}
|
|
75
74
|
//# sourceMappingURL=interns.d.ts.map
|
package/esm/sdk/interns.js
CHANGED
|
@@ -62,7 +62,7 @@ export class Interns extends ClientSDK {
|
|
|
62
62
|
* Provision an intern
|
|
63
63
|
*
|
|
64
64
|
* @remarks
|
|
65
|
-
* Starts the first boot, or resumes an intern after suspension. The API key selects the caller, workspace and visible interns. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
|
|
65
|
+
* Starts the first boot, or resumes an intern after suspension. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. 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.
|
|
66
66
|
*/
|
|
67
67
|
async provisionIntern(request, options) {
|
|
68
68
|
return unwrapAsync(internsProvisionIntern(this, request, options));
|
|
@@ -71,7 +71,7 @@ export class Interns extends ClientSDK {
|
|
|
71
71
|
* Suspend an intern
|
|
72
72
|
*
|
|
73
73
|
* @remarks
|
|
74
|
-
* Stops the intern runtime while keeping its disk and configuration for a later provision call. 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.
|
|
74
|
+
* Stops the intern runtime while keeping its disk and configuration for a later provision call. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. 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.
|
|
75
75
|
*/
|
|
76
76
|
async suspendIntern(request, options) {
|
|
77
77
|
return unwrapAsync(internsSuspendIntern(this, request, options));
|
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.9",
|
|
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": [
|
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
76
|
"compile": "tsc",
|
|
77
77
|
"postinstall": "node scripts/check-types.js || true",
|
|
78
|
-
"test": "vitest --run --project unit",
|
|
79
78
|
"test:e2e": "vitest --run --project e2e",
|
|
80
79
|
"test:watch": "vitest --watch --project unit",
|
|
80
|
+
"typecheck:transit": "exit 0",
|
|
81
81
|
"prepare": "npm run build",
|
|
82
|
+
"test": "vitest --run --project unit",
|
|
82
83
|
"test:transit": "exit 0",
|
|
83
|
-
"typecheck": "tsc --noEmit"
|
|
84
|
-
"typecheck:transit": "exit 0"
|
|
84
|
+
"typecheck": "tsc --noEmit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|