@openrouter/sdk 1.3.7 → 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.
@@ -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<EventStream<models.InternChatCompletionChunk>, errors.InternChatErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
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
@@ -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, z.custom(x => x instanceof ReadableStream)
117
- .transform(stream => {
118
- return new EventStream(stream, rawEvent => {
119
- if (rawEvent.data === "[DONE]") {
120
- return { done: true, value: undefined };
121
- }
122
- return {
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
  }
@@ -0,0 +1,19 @@
1
+ import { OpenRouterCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
4
+ import * as errors from "../models/errors/index.js";
5
+ import { OpenRouterError } from "../models/errors/openroutererror.js";
6
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
7
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
+ import * as models from "../models/index.js";
9
+ import * as operations from "../models/operations/index.js";
10
+ import { APIPromise } from "../types/async.js";
11
+ import { Result } from "../types/fp.js";
12
+ /**
13
+ * Submit a System One request
14
+ *
15
+ * @remarks
16
+ * Sends state and typed questions to a System One model such as Jev and returns its answers. Compatible with the TypeSafe SDKs. Bare System One model IDs such as `jev-1.13` and `jev-latest` are mapped onto the `typesafe/` namespace.
17
+ */
18
+ export declare function systemOneCreate(client: OpenRouterCore, request: operations.CreateSystemoneRequest, options?: RequestOptions): APIPromise<Result<models.DecisionsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.PayloadTooLargeResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
+ //# sourceMappingURL=systemOneCreate.d.ts.map
@@ -0,0 +1,98 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 446a269bb013
4
+ */
5
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import * as errors from "../models/errors/index.js";
13
+ import * as models from "../models/index.js";
14
+ import * as operations from "../models/operations/index.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Submit a System One request
18
+ *
19
+ * @remarks
20
+ * Sends state and typed questions to a System One model such as Jev and returns its answers. Compatible with the TypeSafe SDKs. Bare System One model IDs such as `jev-1.13` and `jev-latest` are mapped onto the `typesafe/` namespace.
21
+ */
22
+ export function systemOneCreate(client, request, options) {
23
+ return new APIPromise($do(client, request, options));
24
+ }
25
+ async function $do(client, request, options) {
26
+ const parsed = safeParse(request, (value) => operations.CreateSystemoneRequest$outboundSchema.parse(value), "Input validation failed");
27
+ if (!parsed.ok) {
28
+ return [parsed, { status: "invalid" }];
29
+ }
30
+ const payload = parsed.value;
31
+ const body = encodeJSON("body", payload.DecisionsRequest, { explode: true });
32
+ const path = pathToFunc("/systemone")();
33
+ const headers = new Headers(compactMap({
34
+ "Content-Type": "application/json",
35
+ Accept: "application/json",
36
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
37
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
38
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
39
+ }));
40
+ const secConfig = await extractSecurity(client._options.apiKey);
41
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
42
+ const requestSecurity = resolveGlobalSecurity(securityInput);
43
+ const context = {
44
+ options: client._options,
45
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
46
+ operationID: "createSystemone",
47
+ oAuth2Scopes: null,
48
+ resolvedSecurity: requestSecurity,
49
+ securitySource: client._options.apiKey,
50
+ retryConfig: options?.retries
51
+ || client._options.retryConfig
52
+ || {
53
+ strategy: "backoff",
54
+ backoff: {
55
+ initialInterval: 500,
56
+ maxInterval: 60000,
57
+ exponent: 1.5,
58
+ maxElapsedTime: 3600000,
59
+ },
60
+ retryConnectionErrors: true,
61
+ }
62
+ || { strategy: "none" },
63
+ retryCodes: options?.retryCodes || ["5XX"],
64
+ };
65
+ const requestRes = client._createRequest(context, {
66
+ security: requestSecurity,
67
+ method: "POST",
68
+ baseURL: options?.serverURL,
69
+ path: path,
70
+ headers: headers,
71
+ body: body,
72
+ userAgent: client._options.userAgent,
73
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
74
+ }, options);
75
+ if (!requestRes.ok) {
76
+ return [requestRes, { status: "invalid" }];
77
+ }
78
+ const req = requestRes.value;
79
+ const doResult = await client._do(req, {
80
+ context,
81
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
82
+ retryConfig: context.retryConfig,
83
+ retryCodes: context.retryCodes,
84
+ });
85
+ if (!doResult.ok) {
86
+ return [doResult, { status: "request-error", request: req }];
87
+ }
88
+ const response = doResult.value;
89
+ const responseFields = {
90
+ HttpMeta: { Response: response, Request: req },
91
+ };
92
+ const [result] = await M.match(M.json(200, models.DecisionsResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(413, errors.PayloadTooLargeResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
93
+ if (!result.ok) {
94
+ return [result, { status: "complete", request: req, response }];
95
+ }
96
+ return [result, { status: "complete", request: req, response }];
97
+ }
98
+ //# sourceMappingURL=systemOneCreate.js.map
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
50
50
  export declare const SDK_METADATA: {
51
51
  readonly language: "typescript";
52
52
  readonly openapiDocVersion: "1.0.0";
53
- readonly sdkVersion: "1.3.7";
53
+ readonly sdkVersion: "1.3.9";
54
54
  readonly genVersion: "2.914.0";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.3.7 2.914.0 1.0.0 @openrouter/sdk";
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.7",
32
+ sdkVersion: "1.3.9",
33
33
  genVersion: "2.914.0",
34
- userAgent: "speakeasy-sdk/typescript 1.3.7 2.914.0 1.0.0 @openrouter/sdk",
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 one, the server derives a stable key from the request body.
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
@@ -0,0 +1,56 @@
1
+ import * as z from "zod/v4";
2
+ import * as models from "../index.js";
3
+ export type CreateSystemoneGlobals = {
4
+ /**
5
+ * The app identifier should be your app's URL and is used as the primary identifier for rankings.
6
+ *
7
+ * @remarks
8
+ * This is used to track API usage per application.
9
+ */
10
+ httpReferer?: string | undefined;
11
+ /**
12
+ * The app display name allows you to customize how your app appears in OpenRouter's dashboard.
13
+ *
14
+ * @remarks
15
+ */
16
+ appTitle?: string | undefined;
17
+ /**
18
+ * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
19
+ *
20
+ * @remarks
21
+ */
22
+ appCategories?: string | undefined;
23
+ };
24
+ export type CreateSystemoneRequest = {
25
+ /**
26
+ * The app identifier should be your app's URL and is used as the primary identifier for rankings.
27
+ *
28
+ * @remarks
29
+ * This is used to track API usage per application.
30
+ */
31
+ httpReferer?: string | undefined;
32
+ /**
33
+ * The app display name allows you to customize how your app appears in OpenRouter's dashboard.
34
+ *
35
+ * @remarks
36
+ */
37
+ appTitle?: string | undefined;
38
+ /**
39
+ * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
40
+ *
41
+ * @remarks
42
+ */
43
+ appCategories?: string | undefined;
44
+ decisionsRequest: models.DecisionsRequest;
45
+ };
46
+ /** @internal */
47
+ export type CreateSystemoneRequest$Outbound = {
48
+ "HTTP-Referer"?: string | undefined;
49
+ appTitle?: string | undefined;
50
+ appCategories?: string | undefined;
51
+ DecisionsRequest: models.DecisionsRequest$Outbound;
52
+ };
53
+ /** @internal */
54
+ export declare const CreateSystemoneRequest$outboundSchema: z.ZodType<CreateSystemoneRequest$Outbound, CreateSystemoneRequest>;
55
+ export declare function createSystemoneRequestToJSON(createSystemoneRequest: CreateSystemoneRequest): string;
56
+ //# sourceMappingURL=createsystemone.d.ts.map
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: ac12b9bcab42
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import * as models from "../index.js";
8
+ /** @internal */
9
+ export const CreateSystemoneRequest$outboundSchema = z.object({
10
+ httpReferer: z.string().optional(),
11
+ appTitle: z.string().optional(),
12
+ appCategories: z.string().optional(),
13
+ decisionsRequest: models.DecisionsRequest$outboundSchema,
14
+ }).transform((v) => {
15
+ return remap$(v, {
16
+ httpReferer: "HTTP-Referer",
17
+ decisionsRequest: "DecisionsRequest",
18
+ });
19
+ });
20
+ export function createSystemoneRequestToJSON(createSystemoneRequest) {
21
+ return JSON.stringify(CreateSystemoneRequest$outboundSchema.parse(createSystemoneRequest));
22
+ }
23
+ //# sourceMappingURL=createsystemone.js.map
@@ -26,6 +26,7 @@ export * from "./creatererank.js";
26
26
  export * from "./createresponses.js";
27
27
  export * from "./createscimgroupmapping.js";
28
28
  export * from "./createscimsyncjob.js";
29
+ export * from "./createsystemone.js";
29
30
  export * from "./createvideos.js";
30
31
  export * from "./createworkspace.js";
31
32
  export * from "./deletebyokkey.js";
@@ -30,6 +30,7 @@ export * from "./creatererank.js";
30
30
  export * from "./createresponses.js";
31
31
  export * from "./createscimgroupmapping.js";
32
32
  export * from "./createscimsyncjob.js";
33
+ export * from "./createsystemone.js";
33
34
  export * from "./createvideos.js";
34
35
  export * from "./createworkspace.js";
35
36
  export * from "./deletebyokkey.js";
@@ -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
  /**
@@ -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<EventStream<models.InternChatCompletionChunk>>;
72
+ chat(request: operations.CreateInternChatCompletionRequest, options?: RequestOptions): Promise<operations.CreateInternChatCompletionResponse>;
74
73
  }
75
74
  //# sourceMappingURL=interns.d.ts.map
@@ -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/esm/sdk/sdk.d.ts CHANGED
@@ -27,6 +27,7 @@ import { Rerank } from "./rerank.js";
27
27
  import { Responses } from "./responses.js";
28
28
  import { Scim } from "./scim.js";
29
29
  import { STT } from "./stt.js";
30
+ import { SystemOne } from "./systemone.js";
30
31
  import { TTS } from "./tts.js";
31
32
  import { Vault } from "./vault.js";
32
33
  import { VideoGeneration } from "./videogeneration.js";
@@ -96,6 +97,8 @@ export declare class OpenRouter extends ClientSDK {
96
97
  get beta(): Beta;
97
98
  private _scim?;
98
99
  get scim(): Scim;
100
+ private _systemOne?;
101
+ get systemOne(): SystemOne;
99
102
  private _vault?;
100
103
  get vault(): Vault;
101
104
  private _videoGeneration?;
package/esm/sdk/sdk.js CHANGED
@@ -31,6 +31,7 @@ import { Rerank } from "./rerank.js";
31
31
  import { Responses } from "./responses.js";
32
32
  import { Scim } from "./scim.js";
33
33
  import { STT } from "./stt.js";
34
+ import { SystemOne } from "./systemone.js";
34
35
  import { TTS } from "./tts.js";
35
36
  import { Vault } from "./vault.js";
36
37
  import { VideoGeneration } from "./videogeneration.js";
@@ -127,6 +128,9 @@ export class OpenRouter extends ClientSDK {
127
128
  get scim() {
128
129
  return (this._scim ?? (this._scim = new Scim(this._options)));
129
130
  }
131
+ get systemOne() {
132
+ return (this._systemOne ?? (this._systemOne = new SystemOne(this._options)));
133
+ }
130
134
  get vault() {
131
135
  return (this._vault ?? (this._vault = new Vault(this._options)));
132
136
  }
@@ -0,0 +1,13 @@
1
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
2
+ import * as models from "../models/index.js";
3
+ import * as operations from "../models/operations/index.js";
4
+ export declare class SystemOne extends ClientSDK {
5
+ /**
6
+ * Submit a System One request
7
+ *
8
+ * @remarks
9
+ * Sends state and typed questions to a System One model such as Jev and returns its answers. Compatible with the TypeSafe SDKs. Bare System One model IDs such as `jev-1.13` and `jev-latest` are mapped onto the `typesafe/` namespace.
10
+ */
11
+ create(request: operations.CreateSystemoneRequest, options?: RequestOptions): Promise<models.DecisionsResponse>;
12
+ }
13
+ //# sourceMappingURL=systemone.d.ts.map
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: af359eaea7c4
4
+ */
5
+ import { systemOneCreate } from "../funcs/systemOneCreate.js";
6
+ import { ClientSDK } from "../lib/sdks.js";
7
+ import { unwrapAsync } from "../types/fp.js";
8
+ export class SystemOne extends ClientSDK {
9
+ /**
10
+ * Submit a System One request
11
+ *
12
+ * @remarks
13
+ * Sends state and typed questions to a System One model such as Jev and returns its answers. Compatible with the TypeSafe SDKs. Bare System One model IDs such as `jev-1.13` and `jev-latest` are mapped onto the `typesafe/` namespace.
14
+ */
15
+ async create(request, options) {
16
+ return unwrapAsync(systemOneCreate(this, request, options));
17
+ }
18
+ }
19
+ //# sourceMappingURL=systemone.js.map
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.3.7",
5
+ "version": "1.3.9",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "1.3.7",
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": [
@@ -73,15 +73,15 @@
73
73
  "lint": "eslint --cache --max-warnings=0 src",
74
74
  "build": "tsc",
75
75
  "prepublishOnly": "npm run build",
76
- "test": "vitest --run --project unit",
77
- "test:transit": "exit 0",
78
- "test:watch": "vitest --watch --project unit",
79
- "typecheck": "tsc --noEmit",
80
- "typecheck:transit": "exit 0",
76
+ "compile": "tsc",
81
77
  "postinstall": "node scripts/check-types.js || true",
82
78
  "test:e2e": "vitest --run --project e2e",
83
- "compile": "tsc",
84
- "prepare": "npm run build"
79
+ "test:watch": "vitest --watch --project unit",
80
+ "typecheck:transit": "exit 0",
81
+ "prepare": "npm run build",
82
+ "test": "vitest --run --project unit",
83
+ "test:transit": "exit 0",
84
+ "typecheck": "tsc --noEmit"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {