@openrouter/sdk 0.12.5 → 0.12.6

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.12.5";
52
+ readonly sdkVersion: "0.12.6";
53
53
  readonly genVersion: "2.879.1";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.12.5 2.879.1 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.12.6 2.879.1 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.12.5",
29
+ sdkVersion: "0.12.6",
30
30
  genVersion: "2.879.1",
31
- userAgent: "speakeasy-sdk/typescript 0.12.5 2.879.1 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.12.6 2.879.1 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -6,6 +6,7 @@ import { ChatWebSearchShorthand, ChatWebSearchShorthand$Outbound } from "./chatw
6
6
  import { DatetimeServerTool, DatetimeServerTool$Outbound } from "./datetimeservertool.js";
7
7
  import { ImageGenerationServerToolOpenRouter, ImageGenerationServerToolOpenRouter$Outbound } from "./imagegenerationservertoolopenrouter.js";
8
8
  import { OpenRouterWebSearchServerTool, OpenRouterWebSearchServerTool$Outbound } from "./openrouterwebsearchservertool.js";
9
+ import { WebFetchServerTool, WebFetchServerTool$Outbound } from "./webfetchservertool.js";
9
10
  /**
10
11
  * Function definition for tool calling
11
12
  */
@@ -47,7 +48,7 @@ export type ChatFunctionToolFunction = {
47
48
  /**
48
49
  * Tool definition for function calling (regular function or OpenRouter built-in server tool)
49
50
  */
50
- export type ChatFunctionTool = ChatFunctionToolFunction | DatetimeServerTool | ImageGenerationServerToolOpenRouter | ChatSearchModelsServerTool | OpenRouterWebSearchServerTool | ChatWebSearchShorthand;
51
+ export type ChatFunctionTool = ChatFunctionToolFunction | DatetimeServerTool | ImageGenerationServerToolOpenRouter | ChatSearchModelsServerTool | WebFetchServerTool | OpenRouterWebSearchServerTool | ChatWebSearchShorthand;
51
52
  /** @internal */
52
53
  export type ChatFunctionToolFunctionFunction$Outbound = {
53
54
  description?: string | undefined;
@@ -72,7 +73,7 @@ export type ChatFunctionToolFunction$Outbound = {
72
73
  export declare const ChatFunctionToolFunction$outboundSchema: z.ZodType<ChatFunctionToolFunction$Outbound, ChatFunctionToolFunction>;
73
74
  export declare function chatFunctionToolFunctionToJSON(chatFunctionToolFunction: ChatFunctionToolFunction): string;
74
75
  /** @internal */
75
- export type ChatFunctionTool$Outbound = ChatFunctionToolFunction$Outbound | DatetimeServerTool$Outbound | ImageGenerationServerToolOpenRouter$Outbound | ChatSearchModelsServerTool$Outbound | OpenRouterWebSearchServerTool$Outbound | ChatWebSearchShorthand$Outbound;
76
+ export type ChatFunctionTool$Outbound = ChatFunctionToolFunction$Outbound | DatetimeServerTool$Outbound | ImageGenerationServerToolOpenRouter$Outbound | ChatSearchModelsServerTool$Outbound | WebFetchServerTool$Outbound | OpenRouterWebSearchServerTool$Outbound | ChatWebSearchShorthand$Outbound;
76
77
  /** @internal */
77
78
  export declare const ChatFunctionTool$outboundSchema: z.ZodType<ChatFunctionTool$Outbound, ChatFunctionTool>;
78
79
  export declare function chatFunctionToolToJSON(chatFunctionTool: ChatFunctionTool): string;
@@ -10,6 +10,7 @@ import { ChatWebSearchShorthand$outboundSchema, } from "./chatwebsearchshorthand
10
10
  import { DatetimeServerTool$outboundSchema, } from "./datetimeservertool.js";
11
11
  import { ImageGenerationServerToolOpenRouter$outboundSchema, } from "./imagegenerationservertoolopenrouter.js";
12
12
  import { OpenRouterWebSearchServerTool$outboundSchema, } from "./openrouterwebsearchservertool.js";
13
+ import { WebFetchServerTool$outboundSchema, } from "./webfetchservertool.js";
13
14
  export const ChatFunctionToolType = {
14
15
  Function: "function",
15
16
  };
@@ -44,6 +45,7 @@ export const ChatFunctionTool$outboundSchema = z.union([
44
45
  DatetimeServerTool$outboundSchema,
45
46
  ImageGenerationServerToolOpenRouter$outboundSchema,
46
47
  ChatSearchModelsServerTool$outboundSchema,
48
+ WebFetchServerTool$outboundSchema,
47
49
  OpenRouterWebSearchServerTool$outboundSchema,
48
50
  ChatWebSearchShorthand$outboundSchema,
49
51
  ]);
@@ -256,6 +256,9 @@ export * from "./videogenerationresponse.js";
256
256
  export * from "./videogenerationusage.js";
257
257
  export * from "./videomodel.js";
258
258
  export * from "./videomodelslistresponse.js";
259
+ export * from "./webfetchengineenum.js";
260
+ export * from "./webfetchservertool.js";
261
+ export * from "./webfetchservertoolconfig.js";
259
262
  export * from "./websearchcallcompletedevent.js";
260
263
  export * from "./websearchcallinprogressevent.js";
261
264
  export * from "./websearchcallsearchingevent.js";
@@ -260,6 +260,9 @@ export * from "./videogenerationresponse.js";
260
260
  export * from "./videogenerationusage.js";
261
261
  export * from "./videomodel.js";
262
262
  export * from "./videomodelslistresponse.js";
263
+ export * from "./webfetchengineenum.js";
264
+ export * from "./webfetchservertool.js";
265
+ export * from "./webfetchservertoolconfig.js";
263
266
  export * from "./websearchcallcompletedevent.js";
264
267
  export * from "./websearchcallinprogressevent.js";
265
268
  export * from "./websearchcallsearchingevent.js";
@@ -146,6 +146,10 @@ export type GetGenerationData = {
146
146
  * Native reasoning tokens as reported by provider
147
147
  */
148
148
  nativeTokensReasoning: number | null;
149
+ /**
150
+ * Number of web fetches performed
151
+ */
152
+ numFetches: number | null;
149
153
  /**
150
154
  * Number of audio inputs in the prompt
151
155
  */
@@ -55,6 +55,7 @@ export const GetGenerationData$inboundSchema = z.object({
55
55
  native_tokens_completion_images: z.nullable(z.int()),
56
56
  native_tokens_prompt: z.nullable(z.int()),
57
57
  native_tokens_reasoning: z.nullable(z.int()),
58
+ num_fetches: z.nullable(z.int()),
58
59
  num_input_audio_prompt: z.nullable(z.int()),
59
60
  num_media_completion: z.nullable(z.int()),
60
61
  num_media_prompt: z.nullable(z.int()),
@@ -91,6 +92,7 @@ export const GetGenerationData$inboundSchema = z.object({
91
92
  "native_tokens_completion_images": "nativeTokensCompletionImages",
92
93
  "native_tokens_prompt": "nativeTokensPrompt",
93
94
  "native_tokens_reasoning": "nativeTokensReasoning",
95
+ "num_fetches": "numFetches",
94
96
  "num_input_audio_prompt": "numInputAudioPrompt",
95
97
  "num_media_completion": "numMediaCompletion",
96
98
  "num_media_prompt": "numMediaPrompt",
@@ -31,6 +31,7 @@ import { ShellServerTool, ShellServerTool$Outbound } from "./shellservertool.js"
31
31
  import { StoredPromptTemplate, StoredPromptTemplate$Outbound } from "./storedprompttemplate.js";
32
32
  import { TextExtendedConfig, TextExtendedConfig$Outbound } from "./textextendedconfig.js";
33
33
  import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
34
+ import { WebFetchServerTool, WebFetchServerTool$Outbound } from "./webfetchservertool.js";
34
35
  import { WebSearchPlugin, WebSearchPlugin$Outbound } from "./websearchplugin.js";
35
36
  import { WebSearchServerTool, WebSearchServerTool$Outbound } from "./websearchservertool.js";
36
37
  import { WebSearchServerToolOpenRouter, WebSearchServerToolOpenRouter$Outbound } from "./websearchservertoolopenrouter.js";
@@ -61,6 +62,8 @@ export type ResponsesRequestToolUnion = ResponsesRequestToolFunction | PreviewWe
61
62
  type: "openrouter:image_generation";
62
63
  }) | (ChatSearchModelsServerTool & {
63
64
  type: "openrouter:experimental__search_models";
65
+ }) | (WebFetchServerTool & {
66
+ type: "openrouter:web_fetch";
64
67
  }) | WebSearchServerToolOpenRouter;
65
68
  /**
66
69
  * Request schema for Responses endpoint
@@ -131,6 +134,8 @@ export type ResponsesRequest = {
131
134
  type: "openrouter:image_generation";
132
135
  }) | (ChatSearchModelsServerTool & {
133
136
  type: "openrouter:experimental__search_models";
137
+ }) | (WebFetchServerTool & {
138
+ type: "openrouter:web_fetch";
134
139
  }) | WebSearchServerToolOpenRouter> | undefined;
135
140
  topK?: number | undefined;
136
141
  topLogprobs?: number | null | undefined;
@@ -172,6 +177,8 @@ export type ResponsesRequestToolUnion$Outbound = ResponsesRequestToolFunction$Ou
172
177
  type: "openrouter:image_generation";
173
178
  }) | (ChatSearchModelsServerTool$Outbound & {
174
179
  type: "openrouter:experimental__search_models";
180
+ }) | (WebFetchServerTool$Outbound & {
181
+ type: "openrouter:web_fetch";
175
182
  }) | WebSearchServerToolOpenRouter$Outbound;
176
183
  /** @internal */
177
184
  export declare const ResponsesRequestToolUnion$outboundSchema: z.ZodType<ResponsesRequestToolUnion$Outbound, ResponsesRequestToolUnion>;
@@ -216,6 +223,8 @@ export type ResponsesRequest$Outbound = {
216
223
  type: "openrouter:image_generation";
217
224
  }) | (ChatSearchModelsServerTool$Outbound & {
218
225
  type: "openrouter:experimental__search_models";
226
+ }) | (WebFetchServerTool$Outbound & {
227
+ type: "openrouter:web_fetch";
219
228
  }) | WebSearchServerToolOpenRouter$Outbound> | undefined;
220
229
  top_k?: number | undefined;
221
230
  top_logprobs?: number | null | undefined;
@@ -36,6 +36,7 @@ import { ShellServerTool$outboundSchema, } from "./shellservertool.js";
36
36
  import { StoredPromptTemplate$outboundSchema, } from "./storedprompttemplate.js";
37
37
  import { TextExtendedConfig$outboundSchema, } from "./textextendedconfig.js";
38
38
  import { TraceConfig$outboundSchema, } from "./traceconfig.js";
39
+ import { WebFetchServerTool$outboundSchema, } from "./webfetchservertool.js";
39
40
  import { WebSearchPlugin$outboundSchema, } from "./websearchplugin.js";
40
41
  import { WebSearchServerTool$outboundSchema, } from "./websearchservertool.js";
41
42
  import { WebSearchServerToolOpenRouter$outboundSchema, } from "./websearchservertoolopenrouter.js";
@@ -90,6 +91,7 @@ export const ResponsesRequestToolUnion$outboundSchema = z.union([
90
91
  DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
91
92
  ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
92
93
  ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
94
+ WebFetchServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:web_fetch") })),
93
95
  WebSearchServerToolOpenRouter$outboundSchema,
94
96
  ]);
95
97
  export function responsesRequestToolUnionToJSON(responsesRequestToolUnion) {
@@ -150,6 +152,7 @@ export const ResponsesRequest$outboundSchema = z.object({
150
152
  DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
151
153
  ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
152
154
  ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
155
+ WebFetchServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:web_fetch") })),
153
156
  WebSearchServerToolOpenRouter$outboundSchema,
154
157
  ])).optional(),
155
158
  topK: z.int().optional(),
@@ -0,0 +1,19 @@
1
+ import * as z from "zod/v4";
2
+ import { OpenEnum } from "../types/enums.js";
3
+ /**
4
+ * Which fetch engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in fetch. "exa" uses Exa Contents API (supports BYOK). "openrouter" uses direct HTTP fetch. "firecrawl" uses Firecrawl scrape (requires BYOK).
5
+ */
6
+ export declare const WebFetchEngineEnum: {
7
+ readonly Auto: "auto";
8
+ readonly Native: "native";
9
+ readonly Openrouter: "openrouter";
10
+ readonly Firecrawl: "firecrawl";
11
+ readonly Exa: "exa";
12
+ };
13
+ /**
14
+ * Which fetch engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in fetch. "exa" uses Exa Contents API (supports BYOK). "openrouter" uses direct HTTP fetch. "firecrawl" uses Firecrawl scrape (requires BYOK).
15
+ */
16
+ export type WebFetchEngineEnum = OpenEnum<typeof WebFetchEngineEnum>;
17
+ /** @internal */
18
+ export declare const WebFetchEngineEnum$outboundSchema: z.ZodType<string, WebFetchEngineEnum>;
19
+ //# sourceMappingURL=webfetchengineenum.d.ts.map
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 9cc8d81a8f6c
4
+ */
5
+ import * as openEnums from "../types/enums.js";
6
+ /**
7
+ * Which fetch engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in fetch. "exa" uses Exa Contents API (supports BYOK). "openrouter" uses direct HTTP fetch. "firecrawl" uses Firecrawl scrape (requires BYOK).
8
+ */
9
+ export const WebFetchEngineEnum = {
10
+ Auto: "auto",
11
+ Native: "native",
12
+ Openrouter: "openrouter",
13
+ Firecrawl: "firecrawl",
14
+ Exa: "exa",
15
+ };
16
+ /** @internal */
17
+ export const WebFetchEngineEnum$outboundSchema = openEnums.outboundSchema(WebFetchEngineEnum);
18
+ //# sourceMappingURL=webfetchengineenum.js.map
@@ -0,0 +1,28 @@
1
+ import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
3
+ import { WebFetchServerToolConfig, WebFetchServerToolConfig$Outbound } from "./webfetchservertoolconfig.js";
4
+ export declare const WebFetchServerToolType: {
5
+ readonly OpenrouterWebFetch: "openrouter:web_fetch";
6
+ };
7
+ export type WebFetchServerToolType = ClosedEnum<typeof WebFetchServerToolType>;
8
+ /**
9
+ * OpenRouter built-in server tool: fetches full content from a URL (web page or PDF)
10
+ */
11
+ export type WebFetchServerTool = {
12
+ /**
13
+ * Configuration for the openrouter:web_fetch server tool
14
+ */
15
+ parameters?: WebFetchServerToolConfig | undefined;
16
+ type: WebFetchServerToolType;
17
+ };
18
+ /** @internal */
19
+ export declare const WebFetchServerToolType$outboundSchema: z.ZodEnum<typeof WebFetchServerToolType>;
20
+ /** @internal */
21
+ export type WebFetchServerTool$Outbound = {
22
+ parameters?: WebFetchServerToolConfig$Outbound | undefined;
23
+ type: string;
24
+ };
25
+ /** @internal */
26
+ export declare const WebFetchServerTool$outboundSchema: z.ZodType<WebFetchServerTool$Outbound, WebFetchServerTool>;
27
+ export declare function webFetchServerToolToJSON(webFetchServerTool: WebFetchServerTool): string;
28
+ //# sourceMappingURL=webfetchservertool.d.ts.map
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 6d6cb09da873
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { WebFetchServerToolConfig$outboundSchema, } from "./webfetchservertoolconfig.js";
7
+ export const WebFetchServerToolType = {
8
+ OpenrouterWebFetch: "openrouter:web_fetch",
9
+ };
10
+ /** @internal */
11
+ export const WebFetchServerToolType$outboundSchema = z.enum(WebFetchServerToolType);
12
+ /** @internal */
13
+ export const WebFetchServerTool$outboundSchema = z.object({
14
+ parameters: WebFetchServerToolConfig$outboundSchema.optional(),
15
+ type: WebFetchServerToolType$outboundSchema,
16
+ });
17
+ export function webFetchServerToolToJSON(webFetchServerTool) {
18
+ return JSON.stringify(WebFetchServerTool$outboundSchema.parse(webFetchServerTool));
19
+ }
20
+ //# sourceMappingURL=webfetchservertool.js.map
@@ -0,0 +1,39 @@
1
+ import * as z from "zod/v4";
2
+ import { WebFetchEngineEnum } from "./webfetchengineenum.js";
3
+ /**
4
+ * Configuration for the openrouter:web_fetch server tool
5
+ */
6
+ export type WebFetchServerToolConfig = {
7
+ /**
8
+ * Only fetch from these domains.
9
+ */
10
+ allowedDomains?: Array<string> | undefined;
11
+ /**
12
+ * Never fetch from these domains.
13
+ */
14
+ blockedDomains?: Array<string> | undefined;
15
+ /**
16
+ * Which fetch engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in fetch. "exa" uses Exa Contents API (supports BYOK). "openrouter" uses direct HTTP fetch. "firecrawl" uses Firecrawl scrape (requires BYOK).
17
+ */
18
+ engine?: WebFetchEngineEnum | undefined;
19
+ /**
20
+ * Maximum content length in approximate tokens. Content exceeding this limit is truncated.
21
+ */
22
+ maxContentTokens?: number | undefined;
23
+ /**
24
+ * Maximum number of web fetches per request. Once exceeded, the tool returns an error.
25
+ */
26
+ maxUses?: number | undefined;
27
+ };
28
+ /** @internal */
29
+ export type WebFetchServerToolConfig$Outbound = {
30
+ allowed_domains?: Array<string> | undefined;
31
+ blocked_domains?: Array<string> | undefined;
32
+ engine?: string | undefined;
33
+ max_content_tokens?: number | undefined;
34
+ max_uses?: number | undefined;
35
+ };
36
+ /** @internal */
37
+ export declare const WebFetchServerToolConfig$outboundSchema: z.ZodType<WebFetchServerToolConfig$Outbound, WebFetchServerToolConfig>;
38
+ export declare function webFetchServerToolConfigToJSON(webFetchServerToolConfig: WebFetchServerToolConfig): string;
39
+ //# sourceMappingURL=webfetchservertoolconfig.d.ts.map
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: a65999aa9fc4
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { WebFetchEngineEnum$outboundSchema, } from "./webfetchengineenum.js";
8
+ /** @internal */
9
+ export const WebFetchServerToolConfig$outboundSchema = z.object({
10
+ allowedDomains: z.array(z.string()).optional(),
11
+ blockedDomains: z.array(z.string()).optional(),
12
+ engine: WebFetchEngineEnum$outboundSchema.optional(),
13
+ maxContentTokens: z.int().optional(),
14
+ maxUses: z.int().optional(),
15
+ }).transform((v) => {
16
+ return remap$(v, {
17
+ allowedDomains: "allowed_domains",
18
+ blockedDomains: "blocked_domains",
19
+ maxContentTokens: "max_content_tokens",
20
+ maxUses: "max_uses",
21
+ });
22
+ });
23
+ export function webFetchServerToolConfigToJSON(webFetchServerToolConfig) {
24
+ return JSON.stringify(WebFetchServerToolConfig$outboundSchema.parse(webFetchServerToolConfig));
25
+ }
26
+ //# sourceMappingURL=webfetchservertoolconfig.js.map
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.12.5",
5
+ "version": "0.12.6",
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.12.5",
3
+ "version": "0.12.6",
4
4
  "author": "OpenRouter",
5
5
  "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.",
6
6
  "keywords": [
@@ -69,15 +69,15 @@
69
69
  "lint": "eslint --cache --max-warnings=0 src",
70
70
  "build": "tsc",
71
71
  "prepublishOnly": "npm run build",
72
- "typecheck": "tsc --noEmit",
73
72
  "compile": "tsc",
73
+ "postinstall": "node scripts/check-types.js || true",
74
+ "prepare": "npm run build",
74
75
  "test": "vitest --run --project unit",
75
- "test:e2e": "vitest --run --project e2e",
76
76
  "test:transit": "exit 0",
77
77
  "test:watch": "vitest --watch --project unit",
78
+ "typecheck": "tsc --noEmit",
78
79
  "typecheck:transit": "exit 0",
79
- "postinstall": "node scripts/check-types.js || true",
80
- "prepare": "npm run build"
80
+ "test:e2e": "vitest --run --project e2e"
81
81
  },
82
82
  "peerDependencies": {},
83
83
  "devDependencies": {