@openrouter/sdk 1.3.6 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,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.6";
53
+ readonly sdkVersion: "1.3.8";
54
54
  readonly genVersion: "2.914.0";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.3.6 2.914.0 1.0.0 @openrouter/sdk";
55
+ readonly userAgent: "speakeasy-sdk/typescript 1.3.8 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.6",
32
+ sdkVersion: "1.3.8",
33
33
  genVersion: "2.914.0",
34
- userAgent: "speakeasy-sdk/typescript 1.3.6 2.914.0 1.0.0 @openrouter/sdk",
34
+ userAgent: "speakeasy-sdk/typescript 1.3.8 2.914.0 1.0.0 @openrouter/sdk",
35
35
  };
36
36
  //# sourceMappingURL=config.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";
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.6",
5
+ "version": "1.3.8",
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.6",
3
+ "version": "1.3.8",
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
- "prepare": "npm run build",
79
- "test:e2e": "vitest --run --project e2e",
80
- "test:transit": "exit 0",
81
- "typecheck:transit": "exit 0",
82
78
  "test": "vitest --run --project unit",
79
+ "test:e2e": "vitest --run --project e2e",
83
80
  "test:watch": "vitest --watch --project unit",
84
- "typecheck": "tsc --noEmit"
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": {