@openrouter/sdk 0.13.54 → 0.13.56

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.
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
49
49
  export declare const SDK_METADATA: {
50
50
  readonly language: "typescript";
51
51
  readonly openapiDocVersion: "1.0.0";
52
- readonly sdkVersion: "0.13.54";
52
+ readonly sdkVersion: "0.13.56";
53
53
  readonly genVersion: "2.884.4";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.13.54 2.884.4 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.13.56 2.884.4 1.0.0 @openrouter/sdk";
55
55
  };
56
56
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
26
26
  export const SDK_METADATA = {
27
27
  language: "typescript",
28
28
  openapiDocVersion: "1.0.0",
29
- sdkVersion: "0.13.54",
29
+ sdkVersion: "0.13.56",
30
30
  genVersion: "2.884.4",
31
- userAgent: "speakeasy-sdk/typescript 0.13.54 2.884.4 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.13.56 2.884.4 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -16,6 +16,7 @@ import { ImageGenerationServerTool, ImageGenerationServerTool$Outbound } from ".
16
16
  import { ImageGenerationServerToolOpenRouter, ImageGenerationServerToolOpenRouter$Outbound } from "./imagegenerationservertoolopenrouter.js";
17
17
  import { LegacyWebSearchServerTool, LegacyWebSearchServerTool$Outbound } from "./legacywebsearchservertool.js";
18
18
  import { McpServerTool, McpServerTool$Outbound } from "./mcpservertool.js";
19
+ import { NamespaceTool, NamespaceTool$Outbound } from "./namespacetool.js";
19
20
  import { Preview20250311WebSearchServerTool, Preview20250311WebSearchServerTool$Outbound } from "./preview20250311websearchservertool.js";
20
21
  import { PreviewWebSearchServerTool, PreviewWebSearchServerTool$Outbound } from "./previewwebsearchservertool.js";
21
22
  import { SearchModelsServerToolOpenRouter, SearchModelsServerToolOpenRouter$Outbound } from "./searchmodelsservertoolopenrouter.js";
@@ -58,7 +59,7 @@ export type AdditionalToolsItemToolFunction = {
58
59
  strict?: boolean | null | undefined;
59
60
  type: AdditionalToolsItemTypeFunction;
60
61
  };
61
- export type AdditionalToolsItemToolUnion = ComputerUseServerTool | AdditionalToolsItemToolFunction | FileSearchServerTool | CodeInterpreterServerTool | McpServerTool | CustomTool | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | AdvisorServerToolOpenRouter | SubagentServerToolOpenRouter | DatetimeServerTool | FilesServerTool | FusionServerToolOpenRouter | ImageGenerationServerToolOpenRouter | SearchModelsServerToolOpenRouter | WebFetchServerTool | WebSearchServerToolOpenRouter | ApplyPatchServerToolOpenRouter | BashServerTool | ShellServerToolOpenRouter | AdditionalToolsItemTool;
62
+ export type AdditionalToolsItemToolUnion = ComputerUseServerTool | NamespaceTool | AdditionalToolsItemToolFunction | FileSearchServerTool | CodeInterpreterServerTool | McpServerTool | CustomTool | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | AdvisorServerToolOpenRouter | SubagentServerToolOpenRouter | DatetimeServerTool | FilesServerTool | FusionServerToolOpenRouter | ImageGenerationServerToolOpenRouter | SearchModelsServerToolOpenRouter | WebFetchServerTool | WebSearchServerToolOpenRouter | ApplyPatchServerToolOpenRouter | BashServerTool | ShellServerToolOpenRouter | AdditionalToolsItemTool;
62
63
  export declare const TypeAdditionalTools: {
63
64
  readonly AdditionalTools: "additional_tools";
64
65
  };
@@ -69,7 +70,7 @@ export type TypeAdditionalTools = ClosedEnum<typeof TypeAdditionalTools>;
69
70
  export type AdditionalToolsItem = {
70
71
  id?: string | null | undefined;
71
72
  role: AdditionalToolsItemRole;
72
- tools: Array<ComputerUseServerTool | AdditionalToolsItemToolFunction | FileSearchServerTool | CodeInterpreterServerTool | McpServerTool | CustomTool | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | AdvisorServerToolOpenRouter | SubagentServerToolOpenRouter | DatetimeServerTool | FilesServerTool | FusionServerToolOpenRouter | ImageGenerationServerToolOpenRouter | SearchModelsServerToolOpenRouter | WebFetchServerTool | WebSearchServerToolOpenRouter | ApplyPatchServerToolOpenRouter | BashServerTool | ShellServerToolOpenRouter | AdditionalToolsItemTool>;
73
+ tools: Array<ComputerUseServerTool | NamespaceTool | AdditionalToolsItemToolFunction | FileSearchServerTool | CodeInterpreterServerTool | McpServerTool | CustomTool | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | AdvisorServerToolOpenRouter | SubagentServerToolOpenRouter | DatetimeServerTool | FilesServerTool | FusionServerToolOpenRouter | ImageGenerationServerToolOpenRouter | SearchModelsServerToolOpenRouter | WebFetchServerTool | WebSearchServerToolOpenRouter | ApplyPatchServerToolOpenRouter | BashServerTool | ShellServerToolOpenRouter | AdditionalToolsItemTool>;
73
74
  type: TypeAdditionalTools;
74
75
  };
75
76
  /** @internal */
@@ -98,7 +99,7 @@ export type AdditionalToolsItemToolFunction$Outbound = {
98
99
  export declare const AdditionalToolsItemToolFunction$outboundSchema: z.ZodType<AdditionalToolsItemToolFunction$Outbound, AdditionalToolsItemToolFunction>;
99
100
  export declare function additionalToolsItemToolFunctionToJSON(additionalToolsItemToolFunction: AdditionalToolsItemToolFunction): string;
100
101
  /** @internal */
101
- export type AdditionalToolsItemToolUnion$Outbound = ComputerUseServerTool$Outbound | AdditionalToolsItemToolFunction$Outbound | FileSearchServerTool$Outbound | CodeInterpreterServerTool$Outbound | McpServerTool$Outbound | CustomTool$Outbound | PreviewWebSearchServerTool$Outbound | Preview20250311WebSearchServerTool$Outbound | LegacyWebSearchServerTool$Outbound | WebSearchServerTool$Outbound | ImageGenerationServerTool$Outbound | CodexLocalShellTool$Outbound | ShellServerTool$Outbound | ApplyPatchServerTool$Outbound | AdvisorServerToolOpenRouter$Outbound | SubagentServerToolOpenRouter$Outbound | DatetimeServerTool$Outbound | FilesServerTool$Outbound | FusionServerToolOpenRouter$Outbound | ImageGenerationServerToolOpenRouter$Outbound | SearchModelsServerToolOpenRouter$Outbound | WebFetchServerTool$Outbound | WebSearchServerToolOpenRouter$Outbound | ApplyPatchServerToolOpenRouter$Outbound | BashServerTool$Outbound | ShellServerToolOpenRouter$Outbound | AdditionalToolsItemTool$Outbound;
102
+ export type AdditionalToolsItemToolUnion$Outbound = ComputerUseServerTool$Outbound | NamespaceTool$Outbound | AdditionalToolsItemToolFunction$Outbound | FileSearchServerTool$Outbound | CodeInterpreterServerTool$Outbound | McpServerTool$Outbound | CustomTool$Outbound | PreviewWebSearchServerTool$Outbound | Preview20250311WebSearchServerTool$Outbound | LegacyWebSearchServerTool$Outbound | WebSearchServerTool$Outbound | ImageGenerationServerTool$Outbound | CodexLocalShellTool$Outbound | ShellServerTool$Outbound | ApplyPatchServerTool$Outbound | AdvisorServerToolOpenRouter$Outbound | SubagentServerToolOpenRouter$Outbound | DatetimeServerTool$Outbound | FilesServerTool$Outbound | FusionServerToolOpenRouter$Outbound | ImageGenerationServerToolOpenRouter$Outbound | SearchModelsServerToolOpenRouter$Outbound | WebFetchServerTool$Outbound | WebSearchServerToolOpenRouter$Outbound | ApplyPatchServerToolOpenRouter$Outbound | BashServerTool$Outbound | ShellServerToolOpenRouter$Outbound | AdditionalToolsItemTool$Outbound;
102
103
  /** @internal */
103
104
  export declare const AdditionalToolsItemToolUnion$outboundSchema: z.ZodType<AdditionalToolsItemToolUnion$Outbound, AdditionalToolsItemToolUnion>;
104
105
  export declare function additionalToolsItemToolUnionToJSON(additionalToolsItemToolUnion: AdditionalToolsItemToolUnion): string;
@@ -108,7 +109,7 @@ export declare const TypeAdditionalTools$outboundSchema: z.ZodEnum<typeof TypeAd
108
109
  export type AdditionalToolsItem$Outbound = {
109
110
  id?: string | null | undefined;
110
111
  role: string;
111
- tools: Array<ComputerUseServerTool$Outbound | AdditionalToolsItemToolFunction$Outbound | FileSearchServerTool$Outbound | CodeInterpreterServerTool$Outbound | McpServerTool$Outbound | CustomTool$Outbound | PreviewWebSearchServerTool$Outbound | Preview20250311WebSearchServerTool$Outbound | LegacyWebSearchServerTool$Outbound | WebSearchServerTool$Outbound | ImageGenerationServerTool$Outbound | CodexLocalShellTool$Outbound | ShellServerTool$Outbound | ApplyPatchServerTool$Outbound | AdvisorServerToolOpenRouter$Outbound | SubagentServerToolOpenRouter$Outbound | DatetimeServerTool$Outbound | FilesServerTool$Outbound | FusionServerToolOpenRouter$Outbound | ImageGenerationServerToolOpenRouter$Outbound | SearchModelsServerToolOpenRouter$Outbound | WebFetchServerTool$Outbound | WebSearchServerToolOpenRouter$Outbound | ApplyPatchServerToolOpenRouter$Outbound | BashServerTool$Outbound | ShellServerToolOpenRouter$Outbound | AdditionalToolsItemTool$Outbound>;
112
+ tools: Array<ComputerUseServerTool$Outbound | NamespaceTool$Outbound | AdditionalToolsItemToolFunction$Outbound | FileSearchServerTool$Outbound | CodeInterpreterServerTool$Outbound | McpServerTool$Outbound | CustomTool$Outbound | PreviewWebSearchServerTool$Outbound | Preview20250311WebSearchServerTool$Outbound | LegacyWebSearchServerTool$Outbound | WebSearchServerTool$Outbound | ImageGenerationServerTool$Outbound | CodexLocalShellTool$Outbound | ShellServerTool$Outbound | ApplyPatchServerTool$Outbound | AdvisorServerToolOpenRouter$Outbound | SubagentServerToolOpenRouter$Outbound | DatetimeServerTool$Outbound | FilesServerTool$Outbound | FusionServerToolOpenRouter$Outbound | ImageGenerationServerToolOpenRouter$Outbound | SearchModelsServerToolOpenRouter$Outbound | WebFetchServerTool$Outbound | WebSearchServerToolOpenRouter$Outbound | ApplyPatchServerToolOpenRouter$Outbound | BashServerTool$Outbound | ShellServerToolOpenRouter$Outbound | AdditionalToolsItemTool$Outbound>;
112
113
  type: string;
113
114
  };
114
115
  /** @internal */
@@ -21,6 +21,7 @@ import { ImageGenerationServerTool$outboundSchema, } from "./imagegenerationserv
21
21
  import { ImageGenerationServerToolOpenRouter$outboundSchema, } from "./imagegenerationservertoolopenrouter.js";
22
22
  import { LegacyWebSearchServerTool$outboundSchema, } from "./legacywebsearchservertool.js";
23
23
  import { McpServerTool$outboundSchema, } from "./mcpservertool.js";
24
+ import { NamespaceTool$outboundSchema, } from "./namespacetool.js";
24
25
  import { Preview20250311WebSearchServerTool$outboundSchema, } from "./preview20250311websearchservertool.js";
25
26
  import { PreviewWebSearchServerTool$outboundSchema, } from "./previewwebsearchservertool.js";
26
27
  import { SearchModelsServerToolOpenRouter$outboundSchema, } from "./searchmodelsservertoolopenrouter.js";
@@ -79,6 +80,7 @@ export function additionalToolsItemToolFunctionToJSON(additionalToolsItemToolFun
79
80
  /** @internal */
80
81
  export const AdditionalToolsItemToolUnion$outboundSchema = z.union([
81
82
  ComputerUseServerTool$outboundSchema,
83
+ NamespaceTool$outboundSchema,
82
84
  z.lazy(() => AdditionalToolsItemToolFunction$outboundSchema),
83
85
  FileSearchServerTool$outboundSchema,
84
86
  CodeInterpreterServerTool$outboundSchema,
@@ -117,6 +119,7 @@ export const AdditionalToolsItem$outboundSchema = z.object({
117
119
  role: AdditionalToolsItemRole$outboundSchema,
118
120
  tools: z.array(z.union([
119
121
  ComputerUseServerTool$outboundSchema,
122
+ NamespaceTool$outboundSchema,
120
123
  z.lazy(() => AdditionalToolsItemToolFunction$outboundSchema),
121
124
  FileSearchServerTool$outboundSchema,
122
125
  CodeInterpreterServerTool$outboundSchema,
@@ -19,6 +19,7 @@ import { FusionPlugin, FusionPlugin$Outbound } from "./fusionplugin.js";
19
19
  import { ImageConfig, ImageConfig$Outbound } from "./imageconfig.js";
20
20
  import { ModerationPlugin, ModerationPlugin$Outbound } from "./moderationplugin.js";
21
21
  import { ParetoRouterPlugin, ParetoRouterPlugin$Outbound } from "./paretorouterplugin.js";
22
+ import { Prediction, Prediction$Outbound } from "./prediction.js";
22
23
  import { PromptCacheOptions, PromptCacheOptions$Outbound } from "./promptcacheoptions.js";
23
24
  import { ProviderPreferences, ProviderPreferences$Outbound } from "./providerpreferences.js";
24
25
  import { ResponseHealingPlugin, ResponseHealingPlugin$Outbound } from "./responsehealingplugin.js";
@@ -171,6 +172,10 @@ export type ChatRequest = {
171
172
  * Plugins you want to enable for this request, including their settings.
172
173
  */
173
174
  plugins?: Array<AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | FusionPlugin | ModerationPlugin | ParetoRouterPlugin | ResponseHealingPlugin | WebSearchPlugin | WebFetchPlugin> | undefined;
175
+ /**
176
+ * Static predicted output content. Supported models can use this to reduce latency when much of the response is known in advance.
177
+ */
178
+ prediction?: Prediction | null | undefined;
174
179
  /**
175
180
  * Presence penalty (-2.0 to 2.0)
176
181
  */
@@ -320,6 +325,7 @@ export type ChatRequest$Outbound = {
320
325
  models?: Array<string> | undefined;
321
326
  parallel_tool_calls?: boolean | null | undefined;
322
327
  plugins?: Array<AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | FusionPlugin$Outbound | ModerationPlugin$Outbound | ParetoRouterPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound | WebFetchPlugin$Outbound> | undefined;
328
+ prediction?: Prediction$Outbound | null | undefined;
323
329
  presence_penalty?: number | null | undefined;
324
330
  prompt_cache_key?: string | null | undefined;
325
331
  prompt_cache_options?: PromptCacheOptions$Outbound | null | undefined;
@@ -24,6 +24,7 @@ import { FusionPlugin$outboundSchema, } from "./fusionplugin.js";
24
24
  import { ImageConfig$outboundSchema, } from "./imageconfig.js";
25
25
  import { ModerationPlugin$outboundSchema, } from "./moderationplugin.js";
26
26
  import { ParetoRouterPlugin$outboundSchema, } from "./paretorouterplugin.js";
27
+ import { Prediction$outboundSchema, } from "./prediction.js";
27
28
  import { PromptCacheOptions$outboundSchema, } from "./promptcacheoptions.js";
28
29
  import { ProviderPreferences$outboundSchema, } from "./providerpreferences.js";
29
30
  import { ResponseHealingPlugin$outboundSchema, } from "./responsehealingplugin.js";
@@ -151,6 +152,7 @@ export const ChatRequest$outboundSchema = z.object({
151
152
  WebSearchPlugin$outboundSchema,
152
153
  WebFetchPlugin$outboundSchema,
153
154
  ])).optional(),
155
+ prediction: z.nullable(Prediction$outboundSchema).optional(),
154
156
  presencePenalty: z.nullable(z.number()).optional(),
155
157
  promptCacheKey: z.nullable(z.string()).optional(),
156
158
  promptCacheOptions: z.nullable(PromptCacheOptions$outboundSchema).optional(),
@@ -310,6 +310,8 @@ export * from "./modelscountresponse.js";
310
310
  export * from "./modelslistresponse.js";
311
311
  export * from "./moderationplugin.js";
312
312
  export * from "./multimodalmedia.js";
313
+ export * from "./namespacefunctiontool.js";
314
+ export * from "./namespacetool.js";
313
315
  export * from "./notfoundresponseerrordata.js";
314
316
  export * from "./observabilityarizedestination.js";
315
317
  export * from "./observabilitybraintrustdestination.js";
@@ -394,6 +396,8 @@ export * from "./percentilethroughputcutoffs.js";
394
396
  export * from "./perrequestlimits.js";
395
397
  export * from "./pipelinestage.js";
396
398
  export * from "./pipelinestagetype.js";
399
+ export * from "./prediction.js";
400
+ export * from "./predictioncontenttext.js";
397
401
  export * from "./preferredmaxlatency.js";
398
402
  export * from "./preferredminthroughput.js";
399
403
  export * from "./preset.js";
@@ -314,6 +314,8 @@ export * from "./modelscountresponse.js";
314
314
  export * from "./modelslistresponse.js";
315
315
  export * from "./moderationplugin.js";
316
316
  export * from "./multimodalmedia.js";
317
+ export * from "./namespacefunctiontool.js";
318
+ export * from "./namespacetool.js";
317
319
  export * from "./notfoundresponseerrordata.js";
318
320
  export * from "./observabilityarizedestination.js";
319
321
  export * from "./observabilitybraintrustdestination.js";
@@ -398,6 +400,8 @@ export * from "./percentilethroughputcutoffs.js";
398
400
  export * from "./perrequestlimits.js";
399
401
  export * from "./pipelinestage.js";
400
402
  export * from "./pipelinestagetype.js";
403
+ export * from "./prediction.js";
404
+ export * from "./predictioncontenttext.js";
401
405
  export * from "./preferredmaxlatency.js";
402
406
  export * from "./preferredminthroughput.js";
403
407
  export * from "./preset.js";
@@ -0,0 +1,52 @@
1
+ import * as z from "zod/v4";
2
+ import { OpenEnum } from "../types/enums.js";
3
+ import { Result as SafeParseResult } from "../types/fp.js";
4
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ export declare const AllowedCaller: {
6
+ readonly Direct: "direct";
7
+ readonly Programmatic: "programmatic";
8
+ };
9
+ export type AllowedCaller = OpenEnum<typeof AllowedCaller>;
10
+ /**
11
+ * A function tool grouped inside a namespace tool
12
+ */
13
+ export type NamespaceFunctionTool = {
14
+ allowedCallers?: Array<AllowedCaller> | null | undefined;
15
+ deferLoading?: boolean | undefined;
16
+ description?: string | null | undefined;
17
+ name: string;
18
+ outputSchema?: {
19
+ [k: string]: any | null;
20
+ } | null | undefined;
21
+ parameters?: {
22
+ [k: string]: any | null;
23
+ } | null | undefined;
24
+ strict?: boolean | null | undefined;
25
+ type: "function";
26
+ };
27
+ /** @internal */
28
+ export declare const AllowedCaller$inboundSchema: z.ZodType<AllowedCaller, unknown>;
29
+ /** @internal */
30
+ export declare const AllowedCaller$outboundSchema: z.ZodType<string, AllowedCaller>;
31
+ /** @internal */
32
+ export declare const NamespaceFunctionTool$inboundSchema: z.ZodType<NamespaceFunctionTool, unknown>;
33
+ /** @internal */
34
+ export type NamespaceFunctionTool$Outbound = {
35
+ allowed_callers?: Array<string> | null | undefined;
36
+ defer_loading?: boolean | undefined;
37
+ description?: string | null | undefined;
38
+ name: string;
39
+ output_schema?: {
40
+ [k: string]: any | null;
41
+ } | null | undefined;
42
+ parameters?: {
43
+ [k: string]: any | null;
44
+ } | null | undefined;
45
+ strict?: boolean | null | undefined;
46
+ type: "function";
47
+ };
48
+ /** @internal */
49
+ export declare const NamespaceFunctionTool$outboundSchema: z.ZodType<NamespaceFunctionTool$Outbound, NamespaceFunctionTool>;
50
+ export declare function namespaceFunctionToolToJSON(namespaceFunctionTool: NamespaceFunctionTool): string;
51
+ export declare function namespaceFunctionToolFromJSON(jsonString: string): SafeParseResult<NamespaceFunctionTool, SDKValidationError>;
52
+ //# sourceMappingURL=namespacefunctiontool.d.ts.map
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: ca0cabda8e0a
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { safeParse } from "../lib/schemas.js";
8
+ import * as openEnums from "../types/enums.js";
9
+ export const AllowedCaller = {
10
+ Direct: "direct",
11
+ Programmatic: "programmatic",
12
+ };
13
+ /** @internal */
14
+ export const AllowedCaller$inboundSchema = openEnums.inboundSchema(AllowedCaller);
15
+ /** @internal */
16
+ export const AllowedCaller$outboundSchema = openEnums.outboundSchema(AllowedCaller);
17
+ /** @internal */
18
+ export const NamespaceFunctionTool$inboundSchema = z.object({
19
+ allowed_callers: z.nullable(z.array(AllowedCaller$inboundSchema)).optional(),
20
+ defer_loading: z.boolean().optional(),
21
+ description: z.nullable(z.string()).optional(),
22
+ name: z.string(),
23
+ output_schema: z.nullable(z.record(z.string(), z.nullable(z.any())))
24
+ .optional(),
25
+ parameters: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
26
+ strict: z.nullable(z.boolean()).optional(),
27
+ type: z.literal("function"),
28
+ }).transform((v) => {
29
+ return remap$(v, {
30
+ "allowed_callers": "allowedCallers",
31
+ "defer_loading": "deferLoading",
32
+ "output_schema": "outputSchema",
33
+ });
34
+ });
35
+ /** @internal */
36
+ export const NamespaceFunctionTool$outboundSchema = z.object({
37
+ allowedCallers: z.nullable(z.array(AllowedCaller$outboundSchema)).optional(),
38
+ deferLoading: z.boolean().optional(),
39
+ description: z.nullable(z.string()).optional(),
40
+ name: z.string(),
41
+ outputSchema: z.nullable(z.record(z.string(), z.nullable(z.any())))
42
+ .optional(),
43
+ parameters: z.nullable(z.record(z.string(), z.nullable(z.any()))).optional(),
44
+ strict: z.nullable(z.boolean()).optional(),
45
+ type: z.literal("function"),
46
+ }).transform((v) => {
47
+ return remap$(v, {
48
+ allowedCallers: "allowed_callers",
49
+ deferLoading: "defer_loading",
50
+ outputSchema: "output_schema",
51
+ });
52
+ });
53
+ export function namespaceFunctionToolToJSON(namespaceFunctionTool) {
54
+ return JSON.stringify(NamespaceFunctionTool$outboundSchema.parse(namespaceFunctionTool));
55
+ }
56
+ export function namespaceFunctionToolFromJSON(jsonString) {
57
+ return safeParse(jsonString, (x) => NamespaceFunctionTool$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NamespaceFunctionTool' from JSON`);
58
+ }
59
+ //# sourceMappingURL=namespacefunctiontool.js.map
@@ -0,0 +1,55 @@
1
+ import * as z from "zod/v4";
2
+ import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
3
+ import { ClosedEnum } from "../types/enums.js";
4
+ import { Result as SafeParseResult } from "../types/fp.js";
5
+ import { CustomTool, CustomTool$Outbound } from "./customtool.js";
6
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
7
+ import { NamespaceFunctionTool, NamespaceFunctionTool$Outbound } from "./namespacefunctiontool.js";
8
+ export type NamespaceToolTool = NamespaceFunctionTool | (CustomTool & {
9
+ type: "custom";
10
+ }) | discriminatedUnionTypes.Unknown<"type">;
11
+ export declare const NamespaceToolType: {
12
+ readonly Namespace: "namespace";
13
+ };
14
+ export type NamespaceToolType = ClosedEnum<typeof NamespaceToolType>;
15
+ /**
16
+ * Groups function/custom tools under a shared namespace
17
+ */
18
+ export type NamespaceTool = {
19
+ description: string;
20
+ name: string;
21
+ tools: Array<NamespaceFunctionTool | (CustomTool & {
22
+ type: "custom";
23
+ }) | discriminatedUnionTypes.Unknown<"type">>;
24
+ type: NamespaceToolType;
25
+ };
26
+ /** @internal */
27
+ export declare const NamespaceToolTool$inboundSchema: z.ZodType<NamespaceToolTool, unknown>;
28
+ /** @internal */
29
+ export type NamespaceToolTool$Outbound = NamespaceFunctionTool$Outbound | (CustomTool$Outbound & {
30
+ type: "custom";
31
+ });
32
+ /** @internal */
33
+ export declare const NamespaceToolTool$outboundSchema: z.ZodType<NamespaceToolTool$Outbound, NamespaceToolTool>;
34
+ export declare function namespaceToolToolToJSON(namespaceToolTool: NamespaceToolTool): string;
35
+ export declare function namespaceToolToolFromJSON(jsonString: string): SafeParseResult<NamespaceToolTool, SDKValidationError>;
36
+ /** @internal */
37
+ export declare const NamespaceToolType$inboundSchema: z.ZodEnum<typeof NamespaceToolType>;
38
+ /** @internal */
39
+ export declare const NamespaceToolType$outboundSchema: z.ZodEnum<typeof NamespaceToolType>;
40
+ /** @internal */
41
+ export declare const NamespaceTool$inboundSchema: z.ZodType<NamespaceTool, unknown>;
42
+ /** @internal */
43
+ export type NamespaceTool$Outbound = {
44
+ description: string;
45
+ name: string;
46
+ tools: Array<NamespaceFunctionTool$Outbound | (CustomTool$Outbound & {
47
+ type: "custom";
48
+ })>;
49
+ type: string;
50
+ };
51
+ /** @internal */
52
+ export declare const NamespaceTool$outboundSchema: z.ZodType<NamespaceTool$Outbound, NamespaceTool>;
53
+ export declare function namespaceToolToJSON(namespaceTool: NamespaceTool): string;
54
+ export declare function namespaceToolFromJSON(jsonString: string): SafeParseResult<NamespaceTool, SDKValidationError>;
55
+ //# sourceMappingURL=namespacetool.d.ts.map
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: b430de21d6c4
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { discriminatedUnion } from "../types/discriminatedUnion.js";
8
+ import { CustomTool$inboundSchema, CustomTool$outboundSchema, } from "./customtool.js";
9
+ import { NamespaceFunctionTool$inboundSchema, NamespaceFunctionTool$outboundSchema, } from "./namespacefunctiontool.js";
10
+ export const NamespaceToolType = {
11
+ Namespace: "namespace",
12
+ };
13
+ /** @internal */
14
+ export const NamespaceToolTool$inboundSchema = discriminatedUnion("type", {
15
+ function: NamespaceFunctionTool$inboundSchema,
16
+ custom: CustomTool$inboundSchema.and(z.object({ type: z.literal("custom") })),
17
+ });
18
+ /** @internal */
19
+ export const NamespaceToolTool$outboundSchema = z.union([
20
+ NamespaceFunctionTool$outboundSchema,
21
+ CustomTool$outboundSchema.and(z.object({ type: z.literal("custom") })),
22
+ ]);
23
+ export function namespaceToolToolToJSON(namespaceToolTool) {
24
+ return JSON.stringify(NamespaceToolTool$outboundSchema.parse(namespaceToolTool));
25
+ }
26
+ export function namespaceToolToolFromJSON(jsonString) {
27
+ return safeParse(jsonString, (x) => NamespaceToolTool$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NamespaceToolTool' from JSON`);
28
+ }
29
+ /** @internal */
30
+ export const NamespaceToolType$inboundSchema = z.enum(NamespaceToolType);
31
+ /** @internal */
32
+ export const NamespaceToolType$outboundSchema = NamespaceToolType$inboundSchema;
33
+ /** @internal */
34
+ export const NamespaceTool$inboundSchema = z
35
+ .object({
36
+ description: z.string(),
37
+ name: z.string(),
38
+ tools: z.array(discriminatedUnion("type", {
39
+ function: NamespaceFunctionTool$inboundSchema,
40
+ custom: CustomTool$inboundSchema.and(z.object({ type: z.literal("custom") })),
41
+ })),
42
+ type: NamespaceToolType$inboundSchema,
43
+ });
44
+ /** @internal */
45
+ export const NamespaceTool$outboundSchema = z.object({
46
+ description: z.string(),
47
+ name: z.string(),
48
+ tools: z.array(z.union([
49
+ NamespaceFunctionTool$outboundSchema,
50
+ CustomTool$outboundSchema.and(z.object({ type: z.literal("custom") })),
51
+ ])),
52
+ type: NamespaceToolType$outboundSchema,
53
+ });
54
+ export function namespaceToolToJSON(namespaceTool) {
55
+ return JSON.stringify(NamespaceTool$outboundSchema.parse(namespaceTool));
56
+ }
57
+ export function namespaceToolFromJSON(jsonString) {
58
+ return safeParse(jsonString, (x) => NamespaceTool$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NamespaceTool' from JSON`);
59
+ }
60
+ //# sourceMappingURL=namespacetool.js.map
@@ -16,6 +16,7 @@ import { ImageGenerationServerTool } from "./imagegenerationservertool.js";
16
16
  import { IncompleteDetails } from "./incompletedetails.js";
17
17
  import { LegacyWebSearchServerTool } from "./legacywebsearchservertool.js";
18
18
  import { McpServerTool } from "./mcpservertool.js";
19
+ import { NamespaceTool } from "./namespacetool.js";
19
20
  import { OpenAIResponsesResponseStatus } from "./openairesponsesresponsestatus.js";
20
21
  import { OpenAIResponsesToolChoiceUnion } from "./openairesponsestoolchoiceunion.js";
21
22
  import { OpenRouterMetadata } from "./openroutermetadata.js";
@@ -71,6 +72,8 @@ export type OpenResponsesResultToolUnion = OpenResponsesResultToolFunction | (Pr
71
72
  type: "apply_patch";
72
73
  }) | (CustomTool & {
73
74
  type: "custom";
75
+ }) | (NamespaceTool & {
76
+ type: "namespace";
74
77
  }) | discriminatedUnionTypes.Unknown<"type">;
75
78
  /**
76
79
  * Complete non-streaming response from the Responses API
@@ -141,6 +144,8 @@ export type OpenResponsesResult = {
141
144
  type: "apply_patch";
142
145
  }) | (CustomTool & {
143
146
  type: "custom";
147
+ }) | (NamespaceTool & {
148
+ type: "namespace";
144
149
  }) | discriminatedUnionTypes.Unknown<"type">>;
145
150
  topLogprobs?: number | null | undefined;
146
151
  topP: number | null;
@@ -19,6 +19,7 @@ import { ImageGenerationServerTool$inboundSchema, } from "./imagegenerationserve
19
19
  import { IncompleteDetails$inboundSchema, } from "./incompletedetails.js";
20
20
  import { LegacyWebSearchServerTool$inboundSchema, } from "./legacywebsearchservertool.js";
21
21
  import { McpServerTool$inboundSchema } from "./mcpservertool.js";
22
+ import { NamespaceTool$inboundSchema } from "./namespacetool.js";
22
23
  import { OpenAIResponsesResponseStatus$inboundSchema, } from "./openairesponsesresponsestatus.js";
23
24
  import { OpenAIResponsesToolChoiceUnion$inboundSchema, } from "./openairesponsestoolchoiceunion.js";
24
25
  import { OpenRouterMetadata$inboundSchema, } from "./openroutermetadata.js";
@@ -64,6 +65,7 @@ export const OpenResponsesResultToolUnion$inboundSchema = discriminatedUnion("ty
64
65
  shell: ShellServerTool$inboundSchema.and(z.object({ type: z.literal("shell") })),
65
66
  apply_patch: ApplyPatchServerTool$inboundSchema.and(z.object({ type: z.literal("apply_patch") })),
66
67
  custom: CustomTool$inboundSchema.and(z.object({ type: z.literal("custom") })),
68
+ namespace: NamespaceTool$inboundSchema.and(z.object({ type: z.literal("namespace") })),
67
69
  });
68
70
  export function openResponsesResultToolUnionFromJSON(jsonString) {
69
71
  return safeParse(jsonString, (x) => OpenResponsesResultToolUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenResponsesResultToolUnion' from JSON`);
@@ -113,6 +115,7 @@ export const OpenResponsesResult$inboundSchema = z.object({
113
115
  shell: ShellServerTool$inboundSchema.and(z.object({ type: z.literal("shell") })),
114
116
  apply_patch: ApplyPatchServerTool$inboundSchema.and(z.object({ type: z.literal("apply_patch") })),
115
117
  custom: CustomTool$inboundSchema.and(z.object({ type: z.literal("custom") })),
118
+ namespace: NamespaceTool$inboundSchema.and(z.object({ type: z.literal("namespace") })),
116
119
  })),
117
120
  top_logprobs: z.nullable(z.int()).optional(),
118
121
  top_p: z.nullable(z.number()),
@@ -14,6 +14,7 @@ export declare const Parameter: {
14
14
  readonly LogitBias: "logit_bias";
15
15
  readonly Logprobs: "logprobs";
16
16
  readonly TopLogprobs: "top_logprobs";
17
+ readonly Prediction: "prediction";
17
18
  readonly Seed: "seed";
18
19
  readonly ResponseFormat: "response_format";
19
20
  readonly StructuredOutputs: "structured_outputs";
@@ -17,6 +17,7 @@ export const Parameter = {
17
17
  LogitBias: "logit_bias",
18
18
  Logprobs: "logprobs",
19
19
  TopLogprobs: "top_logprobs",
20
+ Prediction: "prediction",
20
21
  Seed: "seed",
21
22
  ResponseFormat: "response_format",
22
23
  StructuredOutputs: "structured_outputs",
@@ -0,0 +1,31 @@
1
+ import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
3
+ import { PredictionContentText, PredictionContentText$Outbound } from "./predictioncontenttext.js";
4
+ export type PredictionContent = string | Array<PredictionContentText>;
5
+ export declare const PredictionType: {
6
+ readonly Content: "content";
7
+ };
8
+ export type PredictionType = ClosedEnum<typeof PredictionType>;
9
+ /**
10
+ * Static predicted output content. Supported models can use this to reduce latency when much of the response is known in advance.
11
+ */
12
+ export type Prediction = {
13
+ content: string | Array<PredictionContentText>;
14
+ type: PredictionType;
15
+ };
16
+ /** @internal */
17
+ export type PredictionContent$Outbound = string | Array<PredictionContentText$Outbound>;
18
+ /** @internal */
19
+ export declare const PredictionContent$outboundSchema: z.ZodType<PredictionContent$Outbound, PredictionContent>;
20
+ export declare function predictionContentToJSON(predictionContent: PredictionContent): string;
21
+ /** @internal */
22
+ export declare const PredictionType$outboundSchema: z.ZodEnum<typeof PredictionType>;
23
+ /** @internal */
24
+ export type Prediction$Outbound = {
25
+ content: string | Array<PredictionContentText$Outbound>;
26
+ type: string;
27
+ };
28
+ /** @internal */
29
+ export declare const Prediction$outboundSchema: z.ZodType<Prediction$Outbound, Prediction>;
30
+ export declare function predictionToJSON(prediction: Prediction): string;
31
+ //# sourceMappingURL=prediction.d.ts.map
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 4fcc379ba382
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { PredictionContentText$outboundSchema, } from "./predictioncontenttext.js";
7
+ export const PredictionType = {
8
+ Content: "content",
9
+ };
10
+ /** @internal */
11
+ export const PredictionContent$outboundSchema = z.union([z.string(), z.array(PredictionContentText$outboundSchema)]);
12
+ export function predictionContentToJSON(predictionContent) {
13
+ return JSON.stringify(PredictionContent$outboundSchema.parse(predictionContent));
14
+ }
15
+ /** @internal */
16
+ export const PredictionType$outboundSchema = z
17
+ .enum(PredictionType);
18
+ /** @internal */
19
+ export const Prediction$outboundSchema = z.object({
20
+ content: z.union([z.string(), z.array(PredictionContentText$outboundSchema)]),
21
+ type: PredictionType$outboundSchema,
22
+ });
23
+ export function predictionToJSON(prediction) {
24
+ return JSON.stringify(Prediction$outboundSchema.parse(prediction));
25
+ }
26
+ //# sourceMappingURL=prediction.js.map
@@ -0,0 +1,24 @@
1
+ import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
3
+ export declare const PredictionContentTextType: {
4
+ readonly Text: "text";
5
+ };
6
+ export type PredictionContentTextType = ClosedEnum<typeof PredictionContentTextType>;
7
+ /**
8
+ * Text content part for a predicted output.
9
+ */
10
+ export type PredictionContentText = {
11
+ text: string;
12
+ type: PredictionContentTextType;
13
+ };
14
+ /** @internal */
15
+ export declare const PredictionContentTextType$outboundSchema: z.ZodEnum<typeof PredictionContentTextType>;
16
+ /** @internal */
17
+ export type PredictionContentText$Outbound = {
18
+ text: string;
19
+ type: string;
20
+ };
21
+ /** @internal */
22
+ export declare const PredictionContentText$outboundSchema: z.ZodType<PredictionContentText$Outbound, PredictionContentText>;
23
+ export declare function predictionContentTextToJSON(predictionContentText: PredictionContentText): string;
24
+ //# sourceMappingURL=predictioncontenttext.d.ts.map
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: e7414b3545df
4
+ */
5
+ import * as z from "zod/v4";
6
+ export const PredictionContentTextType = {
7
+ Text: "text",
8
+ };
9
+ /** @internal */
10
+ export const PredictionContentTextType$outboundSchema = z.enum(PredictionContentTextType);
11
+ /** @internal */
12
+ export const PredictionContentText$outboundSchema = z.object({
13
+ text: z.string(),
14
+ type: PredictionContentTextType$outboundSchema,
15
+ });
16
+ export function predictionContentTextToJSON(predictionContentText) {
17
+ return JSON.stringify(PredictionContentText$outboundSchema.parse(predictionContentText));
18
+ }
19
+ //# sourceMappingURL=predictioncontenttext.js.map
@@ -25,6 +25,7 @@ import { InputsUnion, InputsUnion$Outbound } from "./inputsunion.js";
25
25
  import { LegacyWebSearchServerTool, LegacyWebSearchServerTool$Outbound } from "./legacywebsearchservertool.js";
26
26
  import { McpServerTool, McpServerTool$Outbound } from "./mcpservertool.js";
27
27
  import { ModerationPlugin, ModerationPlugin$Outbound } from "./moderationplugin.js";
28
+ import { NamespaceTool, NamespaceTool$Outbound } from "./namespacetool.js";
28
29
  import { OpenAIResponsesToolChoiceUnion, OpenAIResponsesToolChoiceUnion$Outbound } from "./openairesponsestoolchoiceunion.js";
29
30
  import { OpenAIResponsesTruncation } from "./openairesponsestruncation.js";
30
31
  import { OutputModalityEnum } from "./outputmodalityenum.js";
@@ -96,6 +97,8 @@ export type ResponsesRequestToolUnion = ResponsesRequestToolFunction | (PreviewW
96
97
  type: "apply_patch";
97
98
  }) | (CustomTool & {
98
99
  type: "custom";
100
+ }) | (NamespaceTool & {
101
+ type: "namespace";
99
102
  }) | (AdvisorServerToolOpenRouter & {
100
103
  type: "openrouter:advisor";
101
104
  }) | (SubagentServerToolOpenRouter & {
@@ -226,6 +229,8 @@ export type ResponsesRequest = {
226
229
  type: "apply_patch";
227
230
  }) | (CustomTool & {
228
231
  type: "custom";
232
+ }) | (NamespaceTool & {
233
+ type: "namespace";
229
234
  }) | (AdvisorServerToolOpenRouter & {
230
235
  type: "openrouter:advisor";
231
236
  }) | (SubagentServerToolOpenRouter & {
@@ -311,6 +316,8 @@ export type ResponsesRequestToolUnion$Outbound = ResponsesRequestToolFunction$Ou
311
316
  type: "apply_patch";
312
317
  }) | (CustomTool$Outbound & {
313
318
  type: "custom";
319
+ }) | (NamespaceTool$Outbound & {
320
+ type: "namespace";
314
321
  }) | (AdvisorServerToolOpenRouter$Outbound & {
315
322
  type: "openrouter:advisor";
316
323
  }) | (SubagentServerToolOpenRouter$Outbound & {
@@ -403,6 +410,8 @@ export type ResponsesRequest$Outbound = {
403
410
  type: "apply_patch";
404
411
  }) | (CustomTool$Outbound & {
405
412
  type: "custom";
413
+ }) | (NamespaceTool$Outbound & {
414
+ type: "namespace";
406
415
  }) | (AdvisorServerToolOpenRouter$Outbound & {
407
416
  type: "openrouter:advisor";
408
417
  }) | (SubagentServerToolOpenRouter$Outbound & {
@@ -30,6 +30,7 @@ import { InputsUnion$outboundSchema, } from "./inputsunion.js";
30
30
  import { LegacyWebSearchServerTool$outboundSchema, } from "./legacywebsearchservertool.js";
31
31
  import { McpServerTool$outboundSchema, } from "./mcpservertool.js";
32
32
  import { ModerationPlugin$outboundSchema, } from "./moderationplugin.js";
33
+ import { NamespaceTool$outboundSchema, } from "./namespacetool.js";
33
34
  import { OpenAIResponsesToolChoiceUnion$outboundSchema, } from "./openairesponsestoolchoiceunion.js";
34
35
  import { OpenAIResponsesTruncation$outboundSchema, } from "./openairesponsestruncation.js";
35
36
  import { OutputModalityEnum$outboundSchema, } from "./outputmodalityenum.js";
@@ -105,6 +106,7 @@ export const ResponsesRequestToolUnion$outboundSchema = z.union([
105
106
  ShellServerTool$outboundSchema.and(z.object({ type: z.literal("shell") })),
106
107
  ApplyPatchServerTool$outboundSchema.and(z.object({ type: z.literal("apply_patch") })),
107
108
  CustomTool$outboundSchema.and(z.object({ type: z.literal("custom") })),
109
+ NamespaceTool$outboundSchema.and(z.object({ type: z.literal("namespace") })),
108
110
  AdvisorServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:advisor") })),
109
111
  SubagentServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:subagent") })),
110
112
  DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
@@ -181,6 +183,7 @@ export const ResponsesRequest$outboundSchema = z.object({
181
183
  ShellServerTool$outboundSchema.and(z.object({ type: z.literal("shell") })),
182
184
  ApplyPatchServerTool$outboundSchema.and(z.object({ type: z.literal("apply_patch") })),
183
185
  CustomTool$outboundSchema.and(z.object({ type: z.literal("custom") })),
186
+ NamespaceTool$outboundSchema.and(z.object({ type: z.literal("namespace") })),
184
187
  AdvisorServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:advisor") })),
185
188
  SubagentServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:subagent") })),
186
189
  DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.13.54",
5
+ "version": "0.13.56",
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": "0.13.54",
3
+ "version": "0.13.56",
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,14 +73,14 @@
73
73
  "lint": "eslint --cache --max-warnings=0 src",
74
74
  "build": "tsc",
75
75
  "prepublishOnly": "npm run build",
76
- "compile": "tsc",
77
- "postinstall": "node scripts/check-types.js || true",
78
- "prepare": "npm run build",
79
76
  "test": "vitest --run --project unit",
80
77
  "test:e2e": "vitest --run --project e2e",
81
78
  "test:transit": "exit 0",
82
- "typecheck:transit": "exit 0",
83
79
  "test:watch": "vitest --watch --project unit",
80
+ "typecheck:transit": "exit 0",
81
+ "compile": "tsc",
82
+ "postinstall": "node scripts/check-types.js || true",
83
+ "prepare": "npm run build",
84
84
  "typecheck": "tsc --noEmit"
85
85
  },
86
86
  "peerDependencies": {},