@openrouter/sdk 0.12.26 → 0.12.27
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.
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/chatwebsearchshorthand.d.ts +2 -2
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/websearchconfig.d.ts +2 -2
- package/esm/models/websearchservertoolconfig.d.ts +51 -0
- package/esm/models/websearchservertoolconfig.js +32 -0
- package/esm/models/websearchservertoolopenrouter.d.ts +6 -20
- package/esm/models/websearchservertoolopenrouter.js +2 -15
- package/jsr.json +1 -1
- package/package.json +6 -6
package/esm/lib/config.d.ts
CHANGED
|
@@ -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.
|
|
52
|
+
readonly sdkVersion: "0.12.27";
|
|
53
53
|
readonly genVersion: "2.879.1";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.12.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.12.27 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.
|
|
29
|
+
sdkVersion: "0.12.27",
|
|
30
30
|
genVersion: "2.879.1",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 0.12.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 0.12.27 2.879.1 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -16,7 +16,7 @@ export type ChatWebSearchShorthandType = OpenEnum<typeof ChatWebSearchShorthandT
|
|
|
16
16
|
*/
|
|
17
17
|
export type ChatWebSearchShorthand = {
|
|
18
18
|
/**
|
|
19
|
-
* Limit search results to these domains. Supported by Exa, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with
|
|
19
|
+
* Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.
|
|
20
20
|
*/
|
|
21
21
|
allowedDomains?: Array<string> | undefined;
|
|
22
22
|
/**
|
|
@@ -24,7 +24,7 @@ export type ChatWebSearchShorthand = {
|
|
|
24
24
|
*/
|
|
25
25
|
engine?: WebSearchEngineEnum | undefined;
|
|
26
26
|
/**
|
|
27
|
-
* Exclude search results from these domains. Supported by Exa, Parallel, Anthropic, and xAI. Not supported with
|
|
27
|
+
* Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.
|
|
28
28
|
*/
|
|
29
29
|
excludedDomains?: Array<string> | undefined;
|
|
30
30
|
/**
|
package/esm/models/index.d.ts
CHANGED
|
@@ -290,6 +290,7 @@ export * from "./websearchengine.js";
|
|
|
290
290
|
export * from "./websearchengineenum.js";
|
|
291
291
|
export * from "./websearchplugin.js";
|
|
292
292
|
export * from "./websearchservertool.js";
|
|
293
|
+
export * from "./websearchservertoolconfig.js";
|
|
293
294
|
export * from "./websearchservertoolopenrouter.js";
|
|
294
295
|
export * from "./websearchsource.js";
|
|
295
296
|
export * from "./websearchstatus.js";
|
package/esm/models/index.js
CHANGED
|
@@ -294,6 +294,7 @@ export * from "./websearchengine.js";
|
|
|
294
294
|
export * from "./websearchengineenum.js";
|
|
295
295
|
export * from "./websearchplugin.js";
|
|
296
296
|
export * from "./websearchservertool.js";
|
|
297
|
+
export * from "./websearchservertoolconfig.js";
|
|
297
298
|
export * from "./websearchservertoolopenrouter.js";
|
|
298
299
|
export * from "./websearchsource.js";
|
|
299
300
|
export * from "./websearchstatus.js";
|
|
@@ -4,7 +4,7 @@ import { WebSearchEngineEnum } from "./websearchengineenum.js";
|
|
|
4
4
|
import { WebSearchUserLocationServerTool, WebSearchUserLocationServerTool$Outbound } from "./websearchuserlocationservertool.js";
|
|
5
5
|
export type WebSearchConfig = {
|
|
6
6
|
/**
|
|
7
|
-
* Limit search results to these domains. Supported by Exa, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with
|
|
7
|
+
* Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.
|
|
8
8
|
*/
|
|
9
9
|
allowedDomains?: Array<string> | undefined;
|
|
10
10
|
/**
|
|
@@ -12,7 +12,7 @@ export type WebSearchConfig = {
|
|
|
12
12
|
*/
|
|
13
13
|
engine?: WebSearchEngineEnum | undefined;
|
|
14
14
|
/**
|
|
15
|
-
* Exclude search results from these domains. Supported by Exa, Parallel, Anthropic, and xAI. Not supported with
|
|
15
|
+
* Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.
|
|
16
16
|
*/
|
|
17
17
|
excludedDomains?: Array<string> | undefined;
|
|
18
18
|
/**
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { SearchQualityLevel } from "./searchqualitylevel.js";
|
|
3
|
+
import { WebSearchEngineEnum } from "./websearchengineenum.js";
|
|
4
|
+
import { WebSearchUserLocationServerTool, WebSearchUserLocationServerTool$Outbound } from "./websearchuserlocationservertool.js";
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for the openrouter:web_search server tool
|
|
7
|
+
*/
|
|
8
|
+
export type WebSearchServerToolConfig = {
|
|
9
|
+
/**
|
|
10
|
+
* Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.
|
|
11
|
+
*/
|
|
12
|
+
allowedDomains?: Array<string> | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API.
|
|
15
|
+
*/
|
|
16
|
+
engine?: WebSearchEngineEnum | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.
|
|
19
|
+
*/
|
|
20
|
+
excludedDomains?: Array<string> | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.
|
|
23
|
+
*/
|
|
24
|
+
maxResults?: number | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops.
|
|
27
|
+
*/
|
|
28
|
+
maxTotalResults?: number | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* How much context to retrieve per result. Defaults to medium (15000 chars). Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl.
|
|
31
|
+
*/
|
|
32
|
+
searchContextSize?: SearchQualityLevel | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Approximate user location for location-biased results.
|
|
35
|
+
*/
|
|
36
|
+
userLocation?: WebSearchUserLocationServerTool | undefined;
|
|
37
|
+
};
|
|
38
|
+
/** @internal */
|
|
39
|
+
export type WebSearchServerToolConfig$Outbound = {
|
|
40
|
+
allowed_domains?: Array<string> | undefined;
|
|
41
|
+
engine?: string | undefined;
|
|
42
|
+
excluded_domains?: Array<string> | undefined;
|
|
43
|
+
max_results?: number | undefined;
|
|
44
|
+
max_total_results?: number | undefined;
|
|
45
|
+
search_context_size?: string | undefined;
|
|
46
|
+
user_location?: WebSearchUserLocationServerTool$Outbound | undefined;
|
|
47
|
+
};
|
|
48
|
+
/** @internal */
|
|
49
|
+
export declare const WebSearchServerToolConfig$outboundSchema: z.ZodType<WebSearchServerToolConfig$Outbound, WebSearchServerToolConfig>;
|
|
50
|
+
export declare function webSearchServerToolConfigToJSON(webSearchServerToolConfig: WebSearchServerToolConfig): string;
|
|
51
|
+
//# sourceMappingURL=websearchservertoolconfig.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 900e829383d7
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { SearchQualityLevel$outboundSchema, } from "./searchqualitylevel.js";
|
|
8
|
+
import { WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
|
|
9
|
+
import { WebSearchUserLocationServerTool$outboundSchema, } from "./websearchuserlocationservertool.js";
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const WebSearchServerToolConfig$outboundSchema = z.object({
|
|
12
|
+
allowedDomains: z.array(z.string()).optional(),
|
|
13
|
+
engine: WebSearchEngineEnum$outboundSchema.optional(),
|
|
14
|
+
excludedDomains: z.array(z.string()).optional(),
|
|
15
|
+
maxResults: z.int().optional(),
|
|
16
|
+
maxTotalResults: z.int().optional(),
|
|
17
|
+
searchContextSize: SearchQualityLevel$outboundSchema.optional(),
|
|
18
|
+
userLocation: WebSearchUserLocationServerTool$outboundSchema.optional(),
|
|
19
|
+
}).transform((v) => {
|
|
20
|
+
return remap$(v, {
|
|
21
|
+
allowedDomains: "allowed_domains",
|
|
22
|
+
excludedDomains: "excluded_domains",
|
|
23
|
+
maxResults: "max_results",
|
|
24
|
+
maxTotalResults: "max_total_results",
|
|
25
|
+
searchContextSize: "search_context_size",
|
|
26
|
+
userLocation: "user_location",
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
export function webSearchServerToolConfigToJSON(webSearchServerToolConfig) {
|
|
30
|
+
return JSON.stringify(WebSearchServerToolConfig$outboundSchema.parse(webSearchServerToolConfig));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=websearchservertoolconfig.js.map
|
|
@@ -1,32 +1,18 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Maximum number of search results to return per search call. Defaults to 5.
|
|
5
|
-
*/
|
|
6
|
-
maxResults?: number | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results.
|
|
9
|
-
*/
|
|
10
|
-
maxTotalResults?: number | undefined;
|
|
11
|
-
};
|
|
2
|
+
import { WebSearchServerToolConfig, WebSearchServerToolConfig$Outbound } from "./websearchservertoolconfig.js";
|
|
12
3
|
/**
|
|
13
4
|
* OpenRouter built-in server tool: searches the web for current information
|
|
14
5
|
*/
|
|
15
6
|
export type WebSearchServerToolOpenRouter = {
|
|
16
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for the openrouter:web_search server tool
|
|
9
|
+
*/
|
|
10
|
+
parameters?: WebSearchServerToolConfig | undefined;
|
|
17
11
|
type: "openrouter:web_search";
|
|
18
12
|
};
|
|
19
13
|
/** @internal */
|
|
20
|
-
export type ParametersT$Outbound = {
|
|
21
|
-
max_results?: number | undefined;
|
|
22
|
-
max_total_results?: number | undefined;
|
|
23
|
-
};
|
|
24
|
-
/** @internal */
|
|
25
|
-
export declare const ParametersT$outboundSchema: z.ZodType<ParametersT$Outbound, ParametersT>;
|
|
26
|
-
export declare function parametersToJSON(parametersT: ParametersT): string;
|
|
27
|
-
/** @internal */
|
|
28
14
|
export type WebSearchServerToolOpenRouter$Outbound = {
|
|
29
|
-
parameters?:
|
|
15
|
+
parameters?: WebSearchServerToolConfig$Outbound | undefined;
|
|
30
16
|
type: "openrouter:web_search";
|
|
31
17
|
};
|
|
32
18
|
/** @internal */
|
|
@@ -3,23 +3,10 @@
|
|
|
3
3
|
* @generated-id: 99dffefc1c11
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
|
-
import {
|
|
7
|
-
/** @internal */
|
|
8
|
-
export const ParametersT$outboundSchema = z.object({
|
|
9
|
-
maxResults: z.int().optional(),
|
|
10
|
-
maxTotalResults: z.int().optional(),
|
|
11
|
-
}).transform((v) => {
|
|
12
|
-
return remap$(v, {
|
|
13
|
-
maxResults: "max_results",
|
|
14
|
-
maxTotalResults: "max_total_results",
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
export function parametersToJSON(parametersT) {
|
|
18
|
-
return JSON.stringify(ParametersT$outboundSchema.parse(parametersT));
|
|
19
|
-
}
|
|
6
|
+
import { WebSearchServerToolConfig$outboundSchema, } from "./websearchservertoolconfig.js";
|
|
20
7
|
/** @internal */
|
|
21
8
|
export const WebSearchServerToolOpenRouter$outboundSchema = z.object({
|
|
22
|
-
parameters:
|
|
9
|
+
parameters: WebSearchServerToolConfig$outboundSchema.optional(),
|
|
23
10
|
type: z.literal("openrouter:web_search"),
|
|
24
11
|
});
|
|
25
12
|
export function webSearchServerToolOpenRouterToJSON(webSearchServerToolOpenRouter) {
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.27",
|
|
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:watch": "vitest --watch --project unit",
|
|
73
|
-
"typecheck": "tsc --noEmit",
|
|
74
|
-
"typecheck:transit": "exit 0",
|
|
75
72
|
"compile": "tsc",
|
|
76
|
-
"postinstall": "node scripts/check-types.js || true",
|
|
77
73
|
"prepare": "npm run build",
|
|
78
74
|
"test": "vitest --run --project unit",
|
|
79
75
|
"test:e2e": "vitest --run --project e2e",
|
|
80
|
-
"test:transit": "exit 0"
|
|
76
|
+
"test:transit": "exit 0",
|
|
77
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
78
|
+
"test:watch": "vitest --watch --project unit",
|
|
79
|
+
"typecheck": "tsc --noEmit",
|
|
80
|
+
"typecheck:transit": "exit 0"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {},
|
|
83
83
|
"devDependencies": {
|