@openrouter/sdk 1.5.62 → 1.5.63

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.
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
13
13
  * Create a preset from a chat-completions request body
14
14
  *
15
15
  * @remarks
16
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
16
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
17
17
  *
18
18
  * If set, this operation will use {@link Security.apiKey} from the global security.
19
19
  */
@@ -2,7 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: 4386fe202ea5
4
4
  */
5
- import { encodeJSON, encodeSimple } from "../lib/encodings.js";
5
+ import { encodeFormQuery, encodeJSON, encodeSimple } from "../lib/encodings.js";
6
6
  import { matchStatusCode } from "../lib/http.js";
7
7
  import * as M from "../lib/matchers.js";
8
8
  import { compactMap } from "../lib/primitives.js";
@@ -17,7 +17,7 @@ import { APIPromise } from "../types/async.js";
17
17
  * Create a preset from a chat-completions request body
18
18
  *
19
19
  * @remarks
20
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
20
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
21
21
  *
22
22
  * If set, this operation will use {@link Security.apiKey} from the global security.
23
23
  */
@@ -38,6 +38,9 @@ async function $do(client, request, options) {
38
38
  }),
39
39
  };
40
40
  const path = pathToFunc("/presets/{slug}/chat/completions")(pathParams);
41
+ const query = encodeFormQuery({
42
+ "workspace_id": payload.workspace_id,
43
+ });
41
44
  const headers = new Headers(compactMap({
42
45
  "Content-Type": "application/json",
43
46
  Accept: "application/json",
@@ -76,6 +79,7 @@ async function $do(client, request, options) {
76
79
  baseURL: options?.serverURL,
77
80
  path: path,
78
81
  headers: headers,
82
+ query: query,
79
83
  body: body,
80
84
  userAgent: client._options.userAgent,
81
85
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
13
13
  * Create a preset from a messages request body
14
14
  *
15
15
  * @remarks
16
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
16
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
17
17
  *
18
18
  * If set, this operation will use {@link Security.apiKey} from the global security.
19
19
  */
@@ -2,7 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: 5f218a786a25
4
4
  */
5
- import { encodeJSON, encodeSimple } from "../lib/encodings.js";
5
+ import { encodeFormQuery, encodeJSON, encodeSimple } from "../lib/encodings.js";
6
6
  import { matchStatusCode } from "../lib/http.js";
7
7
  import * as M from "../lib/matchers.js";
8
8
  import { compactMap } from "../lib/primitives.js";
@@ -17,7 +17,7 @@ import { APIPromise } from "../types/async.js";
17
17
  * Create a preset from a messages request body
18
18
  *
19
19
  * @remarks
20
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
20
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
21
21
  *
22
22
  * If set, this operation will use {@link Security.apiKey} from the global security.
23
23
  */
@@ -38,6 +38,9 @@ async function $do(client, request, options) {
38
38
  }),
39
39
  };
40
40
  const path = pathToFunc("/presets/{slug}/messages")(pathParams);
41
+ const query = encodeFormQuery({
42
+ "workspace_id": payload.workspace_id,
43
+ });
41
44
  const headers = new Headers(compactMap({
42
45
  "Content-Type": "application/json",
43
46
  Accept: "application/json",
@@ -76,6 +79,7 @@ async function $do(client, request, options) {
76
79
  baseURL: options?.serverURL,
77
80
  path: path,
78
81
  headers: headers,
82
+ query: query,
79
83
  body: body,
80
84
  userAgent: client._options.userAgent,
81
85
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
13
13
  * Create a preset from a responses request body
14
14
  *
15
15
  * @remarks
16
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
16
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
17
17
  *
18
18
  * If set, this operation will use {@link Security.apiKey} from the global security.
19
19
  */
@@ -2,7 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: 1f2a88a6adbc
4
4
  */
5
- import { encodeJSON, encodeSimple } from "../lib/encodings.js";
5
+ import { encodeFormQuery, encodeJSON, encodeSimple } from "../lib/encodings.js";
6
6
  import { matchStatusCode } from "../lib/http.js";
7
7
  import * as M from "../lib/matchers.js";
8
8
  import { compactMap } from "../lib/primitives.js";
@@ -17,7 +17,7 @@ import { APIPromise } from "../types/async.js";
17
17
  * Create a preset from a responses request body
18
18
  *
19
19
  * @remarks
20
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
20
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
21
21
  *
22
22
  * If set, this operation will use {@link Security.apiKey} from the global security.
23
23
  */
@@ -38,6 +38,9 @@ async function $do(client, request, options) {
38
38
  }),
39
39
  };
40
40
  const path = pathToFunc("/presets/{slug}/responses")(pathParams);
41
+ const query = encodeFormQuery({
42
+ "workspace_id": payload.workspace_id,
43
+ });
41
44
  const headers = new Headers(compactMap({
42
45
  "Content-Type": "application/json",
43
46
  Accept: "application/json",
@@ -76,6 +79,7 @@ async function $do(client, request, options) {
76
79
  baseURL: options?.serverURL,
77
80
  path: path,
78
81
  headers: headers,
82
+ query: query,
79
83
  body: body,
80
84
  userAgent: client._options.userAgent,
81
85
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
@@ -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.5.62";
53
+ readonly sdkVersion: "1.5.63";
54
54
  readonly genVersion: "2.950.13";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.5.62 2.950.13 1.0.0 @openrouter/sdk";
55
+ readonly userAgent: "speakeasy-sdk/typescript 1.5.63 2.950.13 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.5.62",
32
+ sdkVersion: "1.5.63",
33
33
  genVersion: "2.950.13",
34
- userAgent: "speakeasy-sdk/typescript 1.5.62 2.950.13 1.0.0 @openrouter/sdk",
34
+ userAgent: "speakeasy-sdk/typescript 1.5.63 2.950.13 1.0.0 @openrouter/sdk",
35
35
  };
36
36
  //# sourceMappingURL=config.js.map
@@ -2,6 +2,7 @@ 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 DecisionsNoulAnswer = {
5
+ confidence?: number | undefined;
5
6
  noul: number;
6
7
  type: "noul";
7
8
  };
@@ -6,6 +6,7 @@ import * as z from "zod/v4";
6
6
  import { safeParse } from "../lib/schemas.js";
7
7
  /** @internal */
8
8
  export const DecisionsNoulAnswer$inboundSchema = z.object({
9
+ confidence: z.number().optional(),
9
10
  noul: z.number(),
10
11
  type: z.literal("noul"),
11
12
  });
@@ -45,6 +45,10 @@ export type CreatePresetsChatCompletionsRequest = {
45
45
  * URL-safe slug identifying the preset. Created if it does not exist.
46
46
  */
47
47
  slug: string;
48
+ /**
49
+ * Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
50
+ */
51
+ workspaceId?: string | undefined;
48
52
  chatRequest: models.ChatRequest;
49
53
  };
50
54
  /** @internal */
@@ -53,6 +57,7 @@ export type CreatePresetsChatCompletionsRequest$Outbound = {
53
57
  appTitle?: string | undefined;
54
58
  appCategories?: string | undefined;
55
59
  slug: string;
60
+ workspace_id?: string | undefined;
56
61
  ChatRequest: models.ChatRequest$Outbound;
57
62
  };
58
63
  /** @internal */
@@ -11,10 +11,12 @@ export const CreatePresetsChatCompletionsRequest$outboundSchema = z.object({
11
11
  appTitle: z.string().optional(),
12
12
  appCategories: z.string().optional(),
13
13
  slug: z.string(),
14
+ workspaceId: z.string().optional(),
14
15
  chatRequest: models_ChatRequest$outboundSchema,
15
16
  }).transform((v) => {
16
17
  return remap$(v, {
17
18
  httpReferer: "HTTP-Referer",
19
+ workspaceId: "workspace_id",
18
20
  chatRequest: "ChatRequest",
19
21
  });
20
22
  });
@@ -45,6 +45,10 @@ export type CreatePresetsMessagesRequest = {
45
45
  * URL-safe slug identifying the preset. Created if it does not exist.
46
46
  */
47
47
  slug: string;
48
+ /**
49
+ * Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
50
+ */
51
+ workspaceId?: string | undefined;
48
52
  messagesRequest: models.MessagesRequest;
49
53
  };
50
54
  /** @internal */
@@ -53,6 +57,7 @@ export type CreatePresetsMessagesRequest$Outbound = {
53
57
  appTitle?: string | undefined;
54
58
  appCategories?: string | undefined;
55
59
  slug: string;
60
+ workspace_id?: string | undefined;
56
61
  MessagesRequest: models.MessagesRequest$Outbound;
57
62
  };
58
63
  /** @internal */
@@ -11,10 +11,12 @@ export const CreatePresetsMessagesRequest$outboundSchema = z.object({
11
11
  appTitle: z.string().optional(),
12
12
  appCategories: z.string().optional(),
13
13
  slug: z.string(),
14
+ workspaceId: z.string().optional(),
14
15
  messagesRequest: models_MessagesRequest$outboundSchema,
15
16
  }).transform((v) => {
16
17
  return remap$(v, {
17
18
  httpReferer: "HTTP-Referer",
19
+ workspaceId: "workspace_id",
18
20
  messagesRequest: "MessagesRequest",
19
21
  });
20
22
  });
@@ -45,6 +45,10 @@ export type CreatePresetsResponsesRequest = {
45
45
  * URL-safe slug identifying the preset. Created if it does not exist.
46
46
  */
47
47
  slug: string;
48
+ /**
49
+ * Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.
50
+ */
51
+ workspaceId?: string | undefined;
48
52
  responsesRequest: models.ResponsesRequest;
49
53
  };
50
54
  /** @internal */
@@ -53,6 +57,7 @@ export type CreatePresetsResponsesRequest$Outbound = {
53
57
  appTitle?: string | undefined;
54
58
  appCategories?: string | undefined;
55
59
  slug: string;
60
+ workspace_id?: string | undefined;
56
61
  ResponsesRequest: models.ResponsesRequest$Outbound;
57
62
  };
58
63
  /** @internal */
@@ -11,10 +11,12 @@ export const CreatePresetsResponsesRequest$outboundSchema = z.object({
11
11
  appTitle: z.string().optional(),
12
12
  appCategories: z.string().optional(),
13
13
  slug: z.string(),
14
+ workspaceId: z.string().optional(),
14
15
  responsesRequest: models_ResponsesRequest$outboundSchema,
15
16
  }).transform((v) => {
16
17
  return remap$(v, {
17
18
  httpReferer: "HTTP-Referer",
19
+ workspaceId: "workspace_id",
18
20
  responsesRequest: "ResponsesRequest",
19
21
  });
20
22
  });
@@ -23,21 +23,21 @@ export declare class Presets extends ClientSDK {
23
23
  * Create a preset from a chat-completions request body
24
24
  *
25
25
  * @remarks
26
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
26
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
27
27
  */
28
28
  createPresetsChatCompletions(request: operations.CreatePresetsChatCompletionsRequest, options?: RequestOptions): Promise<models.CreatePresetFromInferenceResponse>;
29
29
  /**
30
30
  * Create a preset from a messages request body
31
31
  *
32
32
  * @remarks
33
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
33
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
34
34
  */
35
35
  createPresetsMessages(request: operations.CreatePresetsMessagesRequest, options?: RequestOptions): Promise<models.CreatePresetFromInferenceResponse>;
36
36
  /**
37
37
  * Create a preset from a responses request body
38
38
  *
39
39
  * @remarks
40
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
40
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
41
41
  */
42
42
  createPresetsResponses(request: operations.CreatePresetsResponsesRequest, options?: RequestOptions): Promise<models.CreatePresetFromInferenceResponse>;
43
43
  /**
@@ -35,7 +35,7 @@ export class Presets extends ClientSDK {
35
35
  * Create a preset from a chat-completions request body
36
36
  *
37
37
  * @remarks
38
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
38
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
39
39
  */
40
40
  async createPresetsChatCompletions(request, options) {
41
41
  return unwrapAsync(presetsCreatePresetsChatCompletions(this, request, options));
@@ -44,7 +44,7 @@ export class Presets extends ClientSDK {
44
44
  * Create a preset from a messages request body
45
45
  *
46
46
  * @remarks
47
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
47
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
48
48
  */
49
49
  async createPresetsMessages(request, options) {
50
50
  return unwrapAsync(presetsCreatePresetsMessages(this, request, options));
@@ -53,7 +53,7 @@ export class Presets extends ClientSDK {
53
53
  * Create a preset from a responses request body
54
54
  *
55
55
  * @remarks
56
- * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.
56
+ * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. Requires a read-write [management key](/docs/guides/overview/auth/management-api-keys); inference API keys are rejected.
57
57
  */
58
58
  async createPresetsResponses(request, options) {
59
59
  return unwrapAsync(presetsCreatePresetsResponses(this, request, options));
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.5.62",
5
+ "version": "1.5.63",
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.5.62",
3
+ "version": "1.5.63",
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,12 +75,12 @@
75
75
  "prepublishOnly": "npm run build",
76
76
  "postinstall": "node scripts/check-types.js || true",
77
77
  "prepare": "npm run build",
78
- "test": "vitest --run --project unit",
79
78
  "test:transit": "exit 0",
80
- "compile": "tsc && node scripts/unbarrel-imports.js",
81
- "test:e2e": "vitest --run --project e2e",
82
79
  "test:watch": "vitest --watch --project unit",
83
80
  "typecheck": "tsc --noEmit",
81
+ "compile": "tsc && node scripts/unbarrel-imports.js",
82
+ "test": "vitest --run --project unit",
83
+ "test:e2e": "vitest --run --project e2e",
84
84
  "typecheck:transit": "exit 0"
85
85
  },
86
86
  "peerDependencies": {