@openrouter/sdk 0.12.18 → 0.12.19

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.18";
52
+ readonly sdkVersion: "0.12.19";
53
53
  readonly genVersion: "2.879.1";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.12.18 2.879.1 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.12.19 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.18",
29
+ sdkVersion: "0.12.19",
30
30
  genVersion: "2.879.1",
31
- userAgent: "speakeasy-sdk/typescript 0.12.18 2.879.1 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.12.19 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
  ]);
@@ -101,6 +101,10 @@ export type GenerationResponseData = {
101
101
  * Native reasoning tokens as reported by provider
102
102
  */
103
103
  nativeTokensReasoning: number | null;
104
+ /**
105
+ * Number of web fetches performed
106
+ */
107
+ numFetches: number | null;
104
108
  /**
105
109
  * Number of audio inputs in the prompt
106
110
  */
@@ -42,6 +42,7 @@ export const GenerationResponseData$inboundSchema = z.object({
42
42
  native_tokens_completion_images: z.nullable(z.int()),
43
43
  native_tokens_prompt: z.nullable(z.int()),
44
44
  native_tokens_reasoning: z.nullable(z.int()),
45
+ num_fetches: z.nullable(z.int()),
45
46
  num_input_audio_prompt: z.nullable(z.int()),
46
47
  num_media_completion: z.nullable(z.int()),
47
48
  num_media_prompt: z.nullable(z.int()),
@@ -79,6 +80,7 @@ export const GenerationResponseData$inboundSchema = z.object({
79
80
  "native_tokens_completion_images": "nativeTokensCompletionImages",
80
81
  "native_tokens_prompt": "nativeTokensPrompt",
81
82
  "native_tokens_reasoning": "nativeTokensReasoning",
83
+ "num_fetches": "numFetches",
82
84
  "num_input_audio_prompt": "numInputAudioPrompt",
83
85
  "num_media_completion": "numMediaCompletion",
84
86
  "num_media_prompt": "numMediaPrompt",
@@ -272,6 +272,9 @@ export * from "./videogenerationresponse.js";
272
272
  export * from "./videogenerationusage.js";
273
273
  export * from "./videomodel.js";
274
274
  export * from "./videomodelslistresponse.js";
275
+ export * from "./webfetchengineenum.js";
276
+ export * from "./webfetchservertool.js";
277
+ export * from "./webfetchservertoolconfig.js";
275
278
  export * from "./websearchcallcompletedevent.js";
276
279
  export * from "./websearchcallinprogressevent.js";
277
280
  export * from "./websearchcallsearchingevent.js";
@@ -276,6 +276,9 @@ export * from "./videogenerationresponse.js";
276
276
  export * from "./videogenerationusage.js";
277
277
  export * from "./videomodel.js";
278
278
  export * from "./videomodelslistresponse.js";
279
+ export * from "./webfetchengineenum.js";
280
+ export * from "./webfetchservertool.js";
281
+ export * from "./webfetchservertoolconfig.js";
279
282
  export * from "./websearchcallcompletedevent.js";
280
283
  export * from "./websearchcallinprogressevent.js";
281
284
  export * from "./websearchcallsearchingevent.js";
@@ -32,6 +32,7 @@ import { ShellServerTool, ShellServerTool$Outbound } from "./shellservertool.js"
32
32
  import { StoredPromptTemplate, StoredPromptTemplate$Outbound } from "./storedprompttemplate.js";
33
33
  import { TextExtendedConfig, TextExtendedConfig$Outbound } from "./textextendedconfig.js";
34
34
  import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
35
+ import { WebFetchServerTool, WebFetchServerTool$Outbound } from "./webfetchservertool.js";
35
36
  import { WebSearchPlugin, WebSearchPlugin$Outbound } from "./websearchplugin.js";
36
37
  import { WebSearchServerTool, WebSearchServerTool$Outbound } from "./websearchservertool.js";
37
38
  import { WebSearchServerToolOpenRouter, WebSearchServerToolOpenRouter$Outbound } from "./websearchservertoolopenrouter.js";
@@ -62,6 +63,8 @@ export type ResponsesRequestToolUnion = ResponsesRequestToolFunction | PreviewWe
62
63
  type: "openrouter:image_generation";
63
64
  }) | (ChatSearchModelsServerTool & {
64
65
  type: "openrouter:experimental__search_models";
66
+ }) | (WebFetchServerTool & {
67
+ type: "openrouter:web_fetch";
65
68
  }) | WebSearchServerToolOpenRouter;
66
69
  /**
67
70
  * Request schema for Responses endpoint
@@ -132,6 +135,8 @@ export type ResponsesRequest = {
132
135
  type: "openrouter:image_generation";
133
136
  }) | (ChatSearchModelsServerTool & {
134
137
  type: "openrouter:experimental__search_models";
138
+ }) | (WebFetchServerTool & {
139
+ type: "openrouter:web_fetch";
135
140
  }) | WebSearchServerToolOpenRouter> | undefined;
136
141
  topK?: number | undefined;
137
142
  topLogprobs?: number | null | undefined;
@@ -173,6 +178,8 @@ export type ResponsesRequestToolUnion$Outbound = ResponsesRequestToolFunction$Ou
173
178
  type: "openrouter:image_generation";
174
179
  }) | (ChatSearchModelsServerTool$Outbound & {
175
180
  type: "openrouter:experimental__search_models";
181
+ }) | (WebFetchServerTool$Outbound & {
182
+ type: "openrouter:web_fetch";
176
183
  }) | WebSearchServerToolOpenRouter$Outbound;
177
184
  /** @internal */
178
185
  export declare const ResponsesRequestToolUnion$outboundSchema: z.ZodType<ResponsesRequestToolUnion$Outbound, ResponsesRequestToolUnion>;
@@ -217,6 +224,8 @@ export type ResponsesRequest$Outbound = {
217
224
  type: "openrouter:image_generation";
218
225
  }) | (ChatSearchModelsServerTool$Outbound & {
219
226
  type: "openrouter:experimental__search_models";
227
+ }) | (WebFetchServerTool$Outbound & {
228
+ type: "openrouter:web_fetch";
220
229
  }) | WebSearchServerToolOpenRouter$Outbound> | undefined;
221
230
  top_k?: number | undefined;
222
231
  top_logprobs?: number | null | undefined;
@@ -37,6 +37,7 @@ import { ShellServerTool$outboundSchema, } from "./shellservertool.js";
37
37
  import { StoredPromptTemplate$outboundSchema, } from "./storedprompttemplate.js";
38
38
  import { TextExtendedConfig$outboundSchema, } from "./textextendedconfig.js";
39
39
  import { TraceConfig$outboundSchema, } from "./traceconfig.js";
40
+ import { WebFetchServerTool$outboundSchema, } from "./webfetchservertool.js";
40
41
  import { WebSearchPlugin$outboundSchema, } from "./websearchplugin.js";
41
42
  import { WebSearchServerTool$outboundSchema, } from "./websearchservertool.js";
42
43
  import { WebSearchServerToolOpenRouter$outboundSchema, } from "./websearchservertoolopenrouter.js";
@@ -92,6 +93,7 @@ export const ResponsesRequestToolUnion$outboundSchema = z.union([
92
93
  DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
93
94
  ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
94
95
  ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
96
+ WebFetchServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:web_fetch") })),
95
97
  WebSearchServerToolOpenRouter$outboundSchema,
96
98
  ]);
97
99
  export function responsesRequestToolUnionToJSON(responsesRequestToolUnion) {
@@ -153,6 +155,7 @@ export const ResponsesRequest$outboundSchema = z.object({
153
155
  DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
154
156
  ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
155
157
  ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
158
+ WebFetchServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:web_fetch") })),
156
159
  WebSearchServerToolOpenRouter$outboundSchema,
157
160
  ])).optional(),
158
161
  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.18",
5
+ "version": "0.12.19",
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.18",
3
+ "version": "0.12.19",
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
- "test:e2e": "vitest --run --project e2e",
73
- "test:transit": "exit 0",
74
- "typecheck": "tsc --noEmit",
75
- "typecheck:transit": "exit 0",
76
72
  "compile": "tsc",
77
73
  "postinstall": "node scripts/check-types.js || true",
74
+ "prepare": "npm run build",
78
75
  "test": "vitest --run --project unit",
76
+ "test:transit": "exit 0",
79
77
  "test:watch": "vitest --watch --project unit",
80
- "prepare": "npm run build"
78
+ "typecheck": "tsc --noEmit",
79
+ "test:e2e": "vitest --run --project e2e",
80
+ "typecheck:transit": "exit 0"
81
81
  },
82
82
  "peerDependencies": {},
83
83
  "devDependencies": {