@openrouter/sdk 1.0.14 → 1.0.17
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 +5 -0
- package/esm/models/chatwebsearchshorthand.js +2 -0
- package/esm/models/createguardrailrequest.d.ts +5 -0
- package/esm/models/createguardrailrequest.js +2 -0
- package/esm/models/guardrail.d.ts +4 -0
- package/esm/models/guardrail.js +2 -0
- package/esm/models/legacywebsearchservertool.d.ts +5 -0
- package/esm/models/legacywebsearchservertool.js +4 -0
- package/esm/models/preview20250311websearchservertool.d.ts +5 -0
- package/esm/models/preview20250311websearchservertool.js +4 -0
- package/esm/models/previewwebsearchservertool.d.ts +5 -0
- package/esm/models/previewwebsearchservertool.js +4 -0
- package/esm/models/updateguardrailrequest.d.ts +5 -0
- package/esm/models/updateguardrailrequest.js +2 -0
- package/esm/models/websearchconfig.d.ts +5 -0
- package/esm/models/websearchconfig.js +2 -0
- package/esm/models/websearchservertool.d.ts +5 -0
- package/esm/models/websearchservertool.js +4 -0
- package/esm/models/websearchservertoolconfig.d.ts +5 -0
- package/esm/models/websearchservertoolconfig.js +2 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
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: "1.0.
|
|
52
|
+
readonly sdkVersion: "1.0.17";
|
|
53
53
|
readonly genVersion: "2.914.0";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.0.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.0.17 2.914.0 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: "1.0.
|
|
29
|
+
sdkVersion: "1.0.17",
|
|
30
30
|
genVersion: "2.914.0",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 1.0.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 1.0.17 2.914.0 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -39,6 +39,10 @@ export type ChatWebSearchShorthand = {
|
|
|
39
39
|
* 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. Defaults to 50 when not specified.
|
|
40
40
|
*/
|
|
41
41
|
maxTotalResults?: number | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.
|
|
44
|
+
*/
|
|
45
|
+
maxUses?: number | undefined;
|
|
42
46
|
parameters?: WebSearchConfig | undefined;
|
|
43
47
|
/**
|
|
44
48
|
* How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.
|
|
@@ -60,6 +64,7 @@ export type ChatWebSearchShorthand$Outbound = {
|
|
|
60
64
|
max_characters?: number | undefined;
|
|
61
65
|
max_results?: number | undefined;
|
|
62
66
|
max_total_results?: number | undefined;
|
|
67
|
+
max_uses?: number | undefined;
|
|
63
68
|
parameters?: WebSearchConfig$Outbound | undefined;
|
|
64
69
|
search_context_size?: string | undefined;
|
|
65
70
|
type: string;
|
|
@@ -25,6 +25,7 @@ export const ChatWebSearchShorthand$outboundSchema = z.object({
|
|
|
25
25
|
maxCharacters: z.int().optional(),
|
|
26
26
|
maxResults: z.int().optional(),
|
|
27
27
|
maxTotalResults: z.int().optional(),
|
|
28
|
+
maxUses: z.int().optional(),
|
|
28
29
|
parameters: WebSearchConfig$outboundSchema.optional(),
|
|
29
30
|
searchContextSize: SearchQualityLevel$outboundSchema.optional(),
|
|
30
31
|
type: ChatWebSearchShorthandType$outboundSchema,
|
|
@@ -36,6 +37,7 @@ export const ChatWebSearchShorthand$outboundSchema = z.object({
|
|
|
36
37
|
maxCharacters: "max_characters",
|
|
37
38
|
maxResults: "max_results",
|
|
38
39
|
maxTotalResults: "max_total_results",
|
|
40
|
+
maxUses: "max_uses",
|
|
39
41
|
searchContextSize: "search_context_size",
|
|
40
42
|
userLocation: "user_location",
|
|
41
43
|
});
|
|
@@ -57,6 +57,10 @@ export type CreateGuardrailRequest = {
|
|
|
57
57
|
* List of provider IDs to exclude from routing
|
|
58
58
|
*/
|
|
59
59
|
ignoredProviders?: Array<string> | null | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false.
|
|
62
|
+
*/
|
|
63
|
+
includeByokInBudgets?: boolean | undefined;
|
|
60
64
|
/**
|
|
61
65
|
* Spending limit in USD
|
|
62
66
|
*/
|
|
@@ -89,6 +93,7 @@ export type CreateGuardrailRequest$Outbound = {
|
|
|
89
93
|
enforce_zdr_xai?: boolean | null | undefined;
|
|
90
94
|
ignored_models?: Array<string> | null | undefined;
|
|
91
95
|
ignored_providers?: Array<string> | null | undefined;
|
|
96
|
+
include_byok_in_budgets?: boolean | undefined;
|
|
92
97
|
limit_usd?: number | null | undefined;
|
|
93
98
|
name: string;
|
|
94
99
|
reset_interval?: string | null | undefined;
|
|
@@ -23,6 +23,7 @@ export const CreateGuardrailRequest$outboundSchema = z.object({
|
|
|
23
23
|
enforceZdrXai: z.nullable(z.boolean()).optional(),
|
|
24
24
|
ignoredModels: z.nullable(z.array(z.string())).optional(),
|
|
25
25
|
ignoredProviders: z.nullable(z.array(z.string())).optional(),
|
|
26
|
+
includeByokInBudgets: z.boolean().optional(),
|
|
26
27
|
limitUsd: z.nullable(z.number()).optional(),
|
|
27
28
|
name: z.string(),
|
|
28
29
|
resetInterval: z.nullable(GuardrailInterval$outboundSchema).optional(),
|
|
@@ -41,6 +42,7 @@ export const CreateGuardrailRequest$outboundSchema = z.object({
|
|
|
41
42
|
enforceZdrXai: "enforce_zdr_xai",
|
|
42
43
|
ignoredModels: "ignored_models",
|
|
43
44
|
ignoredProviders: "ignored_providers",
|
|
45
|
+
includeByokInBudgets: "include_byok_in_budgets",
|
|
44
46
|
limitUsd: "limit_usd",
|
|
45
47
|
resetInterval: "reset_interval",
|
|
46
48
|
workspaceId: "workspace_id",
|
|
@@ -67,6 +67,10 @@ export type Guardrail = {
|
|
|
67
67
|
* List of provider IDs to exclude from routing
|
|
68
68
|
*/
|
|
69
69
|
ignoredProviders?: Array<string> | null | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend.
|
|
72
|
+
*/
|
|
73
|
+
includeByokInBudgets: boolean;
|
|
70
74
|
/**
|
|
71
75
|
* Spending limit in USD
|
|
72
76
|
*/
|
package/esm/models/guardrail.js
CHANGED
|
@@ -26,6 +26,7 @@ export const Guardrail$inboundSchema = z.object({
|
|
|
26
26
|
id: z.string(),
|
|
27
27
|
ignored_models: z.nullable(z.array(z.string())).optional(),
|
|
28
28
|
ignored_providers: z.nullable(z.array(z.string())).optional(),
|
|
29
|
+
include_byok_in_budgets: z.boolean(),
|
|
29
30
|
limit_usd: z.nullable(z.number()).optional(),
|
|
30
31
|
name: z.string(),
|
|
31
32
|
reset_interval: z.nullable(GuardrailInterval$inboundSchema).optional(),
|
|
@@ -46,6 +47,7 @@ export const Guardrail$inboundSchema = z.object({
|
|
|
46
47
|
"enforce_zdr_xai": "enforceZdrXai",
|
|
47
48
|
"ignored_models": "ignoredModels",
|
|
48
49
|
"ignored_providers": "ignoredProviders",
|
|
50
|
+
"include_byok_in_budgets": "includeByokInBudgets",
|
|
49
51
|
"limit_usd": "limitUsd",
|
|
50
52
|
"reset_interval": "resetInterval",
|
|
51
53
|
"updated_at": "updatedAt",
|
|
@@ -23,6 +23,10 @@ export type LegacyWebSearchServerTool = {
|
|
|
23
23
|
* Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.
|
|
24
24
|
*/
|
|
25
25
|
maxResults?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.
|
|
28
|
+
*/
|
|
29
|
+
maxUses?: number | undefined;
|
|
26
30
|
/**
|
|
27
31
|
* Size of the search context for web search tools
|
|
28
32
|
*/
|
|
@@ -44,6 +48,7 @@ export type LegacyWebSearchServerTool$Outbound = {
|
|
|
44
48
|
engine?: string | undefined;
|
|
45
49
|
filters?: WebSearchDomainFilter$Outbound | null | undefined;
|
|
46
50
|
max_results?: number | undefined;
|
|
51
|
+
max_uses?: number | undefined;
|
|
47
52
|
search_context_size?: string | undefined;
|
|
48
53
|
type: string;
|
|
49
54
|
user_location?: WebSearchUserLocation$Outbound | null | undefined;
|
|
@@ -21,12 +21,14 @@ export const LegacyWebSearchServerTool$inboundSchema = z.object({
|
|
|
21
21
|
engine: WebSearchEngineEnum$inboundSchema.optional(),
|
|
22
22
|
filters: z.nullable(WebSearchDomainFilter$inboundSchema).optional(),
|
|
23
23
|
max_results: z.int().optional(),
|
|
24
|
+
max_uses: z.int().optional(),
|
|
24
25
|
search_context_size: SearchContextSizeEnum$inboundSchema.optional(),
|
|
25
26
|
type: LegacyWebSearchServerToolType$inboundSchema,
|
|
26
27
|
user_location: z.nullable(WebSearchUserLocation$inboundSchema).optional(),
|
|
27
28
|
}).transform((v) => {
|
|
28
29
|
return remap$(v, {
|
|
29
30
|
"max_results": "maxResults",
|
|
31
|
+
"max_uses": "maxUses",
|
|
30
32
|
"search_context_size": "searchContextSize",
|
|
31
33
|
"user_location": "userLocation",
|
|
32
34
|
});
|
|
@@ -36,12 +38,14 @@ export const LegacyWebSearchServerTool$outboundSchema = z.object({
|
|
|
36
38
|
engine: WebSearchEngineEnum$outboundSchema.optional(),
|
|
37
39
|
filters: z.nullable(WebSearchDomainFilter$outboundSchema).optional(),
|
|
38
40
|
maxResults: z.int().optional(),
|
|
41
|
+
maxUses: z.int().optional(),
|
|
39
42
|
searchContextSize: SearchContextSizeEnum$outboundSchema.optional(),
|
|
40
43
|
type: LegacyWebSearchServerToolType$outboundSchema,
|
|
41
44
|
userLocation: z.nullable(WebSearchUserLocation$outboundSchema).optional(),
|
|
42
45
|
}).transform((v) => {
|
|
43
46
|
return remap$(v, {
|
|
44
47
|
maxResults: "max_results",
|
|
48
|
+
maxUses: "max_uses",
|
|
45
49
|
searchContextSize: "search_context_size",
|
|
46
50
|
userLocation: "user_location",
|
|
47
51
|
});
|
|
@@ -23,6 +23,10 @@ export type Preview20250311WebSearchServerTool = {
|
|
|
23
23
|
* Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.
|
|
24
24
|
*/
|
|
25
25
|
maxResults?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.
|
|
28
|
+
*/
|
|
29
|
+
maxUses?: number | undefined;
|
|
26
30
|
/**
|
|
27
31
|
* Size of the search context for web search tools
|
|
28
32
|
*/
|
|
@@ -41,6 +45,7 @@ export type Preview20250311WebSearchServerTool$Outbound = {
|
|
|
41
45
|
engine?: string | undefined;
|
|
42
46
|
filters?: WebSearchDomainFilter$Outbound | null | undefined;
|
|
43
47
|
max_results?: number | undefined;
|
|
48
|
+
max_uses?: number | undefined;
|
|
44
49
|
search_context_size?: string | undefined;
|
|
45
50
|
type: string;
|
|
46
51
|
user_location?: PreviewWebSearchUserLocation$Outbound | null | undefined;
|
|
@@ -21,6 +21,7 @@ export const Preview20250311WebSearchServerTool$inboundSchema = z.object({
|
|
|
21
21
|
engine: WebSearchEngineEnum$inboundSchema.optional(),
|
|
22
22
|
filters: z.nullable(WebSearchDomainFilter$inboundSchema).optional(),
|
|
23
23
|
max_results: z.int().optional(),
|
|
24
|
+
max_uses: z.int().optional(),
|
|
24
25
|
search_context_size: SearchContextSizeEnum$inboundSchema.optional(),
|
|
25
26
|
type: Preview20250311WebSearchServerToolType$inboundSchema,
|
|
26
27
|
user_location: z.nullable(PreviewWebSearchUserLocation$inboundSchema)
|
|
@@ -28,6 +29,7 @@ export const Preview20250311WebSearchServerTool$inboundSchema = z.object({
|
|
|
28
29
|
}).transform((v) => {
|
|
29
30
|
return remap$(v, {
|
|
30
31
|
"max_results": "maxResults",
|
|
32
|
+
"max_uses": "maxUses",
|
|
31
33
|
"search_context_size": "searchContextSize",
|
|
32
34
|
"user_location": "userLocation",
|
|
33
35
|
});
|
|
@@ -37,6 +39,7 @@ export const Preview20250311WebSearchServerTool$outboundSchema = z.object({
|
|
|
37
39
|
engine: WebSearchEngineEnum$outboundSchema.optional(),
|
|
38
40
|
filters: z.nullable(WebSearchDomainFilter$outboundSchema).optional(),
|
|
39
41
|
maxResults: z.int().optional(),
|
|
42
|
+
maxUses: z.int().optional(),
|
|
40
43
|
searchContextSize: SearchContextSizeEnum$outboundSchema.optional(),
|
|
41
44
|
type: Preview20250311WebSearchServerToolType$outboundSchema,
|
|
42
45
|
userLocation: z.nullable(PreviewWebSearchUserLocation$outboundSchema)
|
|
@@ -44,6 +47,7 @@ export const Preview20250311WebSearchServerTool$outboundSchema = z.object({
|
|
|
44
47
|
}).transform((v) => {
|
|
45
48
|
return remap$(v, {
|
|
46
49
|
maxResults: "max_results",
|
|
50
|
+
maxUses: "max_uses",
|
|
47
51
|
searchContextSize: "search_context_size",
|
|
48
52
|
userLocation: "user_location",
|
|
49
53
|
});
|
|
@@ -23,6 +23,10 @@ export type PreviewWebSearchServerTool = {
|
|
|
23
23
|
* Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.
|
|
24
24
|
*/
|
|
25
25
|
maxResults?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.
|
|
28
|
+
*/
|
|
29
|
+
maxUses?: number | undefined;
|
|
26
30
|
/**
|
|
27
31
|
* Size of the search context for web search tools
|
|
28
32
|
*/
|
|
@@ -41,6 +45,7 @@ export type PreviewWebSearchServerTool$Outbound = {
|
|
|
41
45
|
engine?: string | undefined;
|
|
42
46
|
filters?: WebSearchDomainFilter$Outbound | null | undefined;
|
|
43
47
|
max_results?: number | undefined;
|
|
48
|
+
max_uses?: number | undefined;
|
|
44
49
|
search_context_size?: string | undefined;
|
|
45
50
|
type: string;
|
|
46
51
|
user_location?: PreviewWebSearchUserLocation$Outbound | null | undefined;
|
|
@@ -21,6 +21,7 @@ export const PreviewWebSearchServerTool$inboundSchema = z.object({
|
|
|
21
21
|
engine: WebSearchEngineEnum$inboundSchema.optional(),
|
|
22
22
|
filters: z.nullable(WebSearchDomainFilter$inboundSchema).optional(),
|
|
23
23
|
max_results: z.int().optional(),
|
|
24
|
+
max_uses: z.int().optional(),
|
|
24
25
|
search_context_size: SearchContextSizeEnum$inboundSchema.optional(),
|
|
25
26
|
type: PreviewWebSearchServerToolType$inboundSchema,
|
|
26
27
|
user_location: z.nullable(PreviewWebSearchUserLocation$inboundSchema)
|
|
@@ -28,6 +29,7 @@ export const PreviewWebSearchServerTool$inboundSchema = z.object({
|
|
|
28
29
|
}).transform((v) => {
|
|
29
30
|
return remap$(v, {
|
|
30
31
|
"max_results": "maxResults",
|
|
32
|
+
"max_uses": "maxUses",
|
|
31
33
|
"search_context_size": "searchContextSize",
|
|
32
34
|
"user_location": "userLocation",
|
|
33
35
|
});
|
|
@@ -37,6 +39,7 @@ export const PreviewWebSearchServerTool$outboundSchema = z.object({
|
|
|
37
39
|
engine: WebSearchEngineEnum$outboundSchema.optional(),
|
|
38
40
|
filters: z.nullable(WebSearchDomainFilter$outboundSchema).optional(),
|
|
39
41
|
maxResults: z.int().optional(),
|
|
42
|
+
maxUses: z.int().optional(),
|
|
40
43
|
searchContextSize: SearchContextSizeEnum$outboundSchema.optional(),
|
|
41
44
|
type: PreviewWebSearchServerToolType$outboundSchema,
|
|
42
45
|
userLocation: z.nullable(PreviewWebSearchUserLocation$outboundSchema)
|
|
@@ -44,6 +47,7 @@ export const PreviewWebSearchServerTool$outboundSchema = z.object({
|
|
|
44
47
|
}).transform((v) => {
|
|
45
48
|
return remap$(v, {
|
|
46
49
|
maxResults: "max_results",
|
|
50
|
+
maxUses: "max_uses",
|
|
47
51
|
searchContextSize: "search_context_size",
|
|
48
52
|
userLocation: "user_location",
|
|
49
53
|
});
|
|
@@ -57,6 +57,10 @@ export type UpdateGuardrailRequest = {
|
|
|
57
57
|
* List of provider IDs to exclude from routing
|
|
58
58
|
*/
|
|
59
59
|
ignoredProviders?: Array<string> | null | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Omit to leave unchanged.
|
|
62
|
+
*/
|
|
63
|
+
includeByokInBudgets?: boolean | undefined;
|
|
60
64
|
/**
|
|
61
65
|
* New spending limit in USD
|
|
62
66
|
*/
|
|
@@ -85,6 +89,7 @@ export type UpdateGuardrailRequest$Outbound = {
|
|
|
85
89
|
enforce_zdr_xai?: boolean | null | undefined;
|
|
86
90
|
ignored_models?: Array<string> | null | undefined;
|
|
87
91
|
ignored_providers?: Array<string> | null | undefined;
|
|
92
|
+
include_byok_in_budgets?: boolean | undefined;
|
|
88
93
|
limit_usd?: number | null | undefined;
|
|
89
94
|
name?: string | undefined;
|
|
90
95
|
reset_interval?: string | null | undefined;
|
|
@@ -23,6 +23,7 @@ export const UpdateGuardrailRequest$outboundSchema = z.object({
|
|
|
23
23
|
enforceZdrXai: z.nullable(z.boolean()).optional(),
|
|
24
24
|
ignoredModels: z.nullable(z.array(z.string())).optional(),
|
|
25
25
|
ignoredProviders: z.nullable(z.array(z.string())).optional(),
|
|
26
|
+
includeByokInBudgets: z.boolean().optional(),
|
|
26
27
|
limitUsd: z.nullable(z.number()).optional(),
|
|
27
28
|
name: z.string().optional(),
|
|
28
29
|
resetInterval: z.nullable(GuardrailInterval$outboundSchema).optional(),
|
|
@@ -40,6 +41,7 @@ export const UpdateGuardrailRequest$outboundSchema = z.object({
|
|
|
40
41
|
enforceZdrXai: "enforce_zdr_xai",
|
|
41
42
|
ignoredModels: "ignored_models",
|
|
42
43
|
ignoredProviders: "ignored_providers",
|
|
44
|
+
includeByokInBudgets: "include_byok_in_budgets",
|
|
43
45
|
limitUsd: "limit_usd",
|
|
44
46
|
resetInterval: "reset_interval",
|
|
45
47
|
});
|
|
@@ -27,6 +27,10 @@ export type WebSearchConfig = {
|
|
|
27
27
|
* 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. Defaults to 50 when not specified.
|
|
28
28
|
*/
|
|
29
29
|
maxTotalResults?: number | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.
|
|
32
|
+
*/
|
|
33
|
+
maxUses?: number | undefined;
|
|
30
34
|
/**
|
|
31
35
|
* How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.
|
|
32
36
|
*/
|
|
@@ -44,6 +48,7 @@ export type WebSearchConfig$Outbound = {
|
|
|
44
48
|
max_characters?: number | undefined;
|
|
45
49
|
max_results?: number | undefined;
|
|
46
50
|
max_total_results?: number | undefined;
|
|
51
|
+
max_uses?: number | undefined;
|
|
47
52
|
search_context_size?: string | undefined;
|
|
48
53
|
user_location?: WebSearchUserLocationServerTool$Outbound | undefined;
|
|
49
54
|
};
|
|
@@ -15,6 +15,7 @@ export const WebSearchConfig$outboundSchema = z.object({
|
|
|
15
15
|
maxCharacters: z.int().optional(),
|
|
16
16
|
maxResults: z.int().optional(),
|
|
17
17
|
maxTotalResults: z.int().optional(),
|
|
18
|
+
maxUses: z.int().optional(),
|
|
18
19
|
searchContextSize: SearchQualityLevel$outboundSchema.optional(),
|
|
19
20
|
userLocation: WebSearchUserLocationServerTool$outboundSchema.optional(),
|
|
20
21
|
}).transform((v) => {
|
|
@@ -24,6 +25,7 @@ export const WebSearchConfig$outboundSchema = z.object({
|
|
|
24
25
|
maxCharacters: "max_characters",
|
|
25
26
|
maxResults: "max_results",
|
|
26
27
|
maxTotalResults: "max_total_results",
|
|
28
|
+
maxUses: "max_uses",
|
|
27
29
|
searchContextSize: "search_context_size",
|
|
28
30
|
userLocation: "user_location",
|
|
29
31
|
});
|
|
@@ -23,6 +23,10 @@ export type WebSearchServerTool = {
|
|
|
23
23
|
* Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.
|
|
24
24
|
*/
|
|
25
25
|
maxResults?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.
|
|
28
|
+
*/
|
|
29
|
+
maxUses?: number | undefined;
|
|
26
30
|
/**
|
|
27
31
|
* Size of the search context for web search tools
|
|
28
32
|
*/
|
|
@@ -44,6 +48,7 @@ export type WebSearchServerTool$Outbound = {
|
|
|
44
48
|
engine?: string | undefined;
|
|
45
49
|
filters?: WebSearchDomainFilter$Outbound | null | undefined;
|
|
46
50
|
max_results?: number | undefined;
|
|
51
|
+
max_uses?: number | undefined;
|
|
47
52
|
search_context_size?: string | undefined;
|
|
48
53
|
type: string;
|
|
49
54
|
user_location?: WebSearchUserLocation$Outbound | null | undefined;
|
|
@@ -21,12 +21,14 @@ export const WebSearchServerTool$inboundSchema = z.object({
|
|
|
21
21
|
engine: WebSearchEngineEnum$inboundSchema.optional(),
|
|
22
22
|
filters: z.nullable(WebSearchDomainFilter$inboundSchema).optional(),
|
|
23
23
|
max_results: z.int().optional(),
|
|
24
|
+
max_uses: z.int().optional(),
|
|
24
25
|
search_context_size: SearchContextSizeEnum$inboundSchema.optional(),
|
|
25
26
|
type: WebSearchServerToolType$inboundSchema,
|
|
26
27
|
user_location: z.nullable(WebSearchUserLocation$inboundSchema).optional(),
|
|
27
28
|
}).transform((v) => {
|
|
28
29
|
return remap$(v, {
|
|
29
30
|
"max_results": "maxResults",
|
|
31
|
+
"max_uses": "maxUses",
|
|
30
32
|
"search_context_size": "searchContextSize",
|
|
31
33
|
"user_location": "userLocation",
|
|
32
34
|
});
|
|
@@ -36,12 +38,14 @@ export const WebSearchServerTool$outboundSchema = z.object({
|
|
|
36
38
|
engine: WebSearchEngineEnum$outboundSchema.optional(),
|
|
37
39
|
filters: z.nullable(WebSearchDomainFilter$outboundSchema).optional(),
|
|
38
40
|
maxResults: z.int().optional(),
|
|
41
|
+
maxUses: z.int().optional(),
|
|
39
42
|
searchContextSize: SearchContextSizeEnum$outboundSchema.optional(),
|
|
40
43
|
type: WebSearchServerToolType$outboundSchema,
|
|
41
44
|
userLocation: z.nullable(WebSearchUserLocation$outboundSchema).optional(),
|
|
42
45
|
}).transform((v) => {
|
|
43
46
|
return remap$(v, {
|
|
44
47
|
maxResults: "max_results",
|
|
48
|
+
maxUses: "max_uses",
|
|
45
49
|
searchContextSize: "search_context_size",
|
|
46
50
|
userLocation: "user_location",
|
|
47
51
|
});
|
|
@@ -30,6 +30,10 @@ export type WebSearchServerToolConfig = {
|
|
|
30
30
|
* 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. Defaults to 50 when not specified.
|
|
31
31
|
*/
|
|
32
32
|
maxTotalResults?: number | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.
|
|
35
|
+
*/
|
|
36
|
+
maxUses?: number | undefined;
|
|
33
37
|
/**
|
|
34
38
|
* How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.
|
|
35
39
|
*/
|
|
@@ -47,6 +51,7 @@ export type WebSearchServerToolConfig$Outbound = {
|
|
|
47
51
|
max_characters?: number | undefined;
|
|
48
52
|
max_results?: number | undefined;
|
|
49
53
|
max_total_results?: number | undefined;
|
|
54
|
+
max_uses?: number | undefined;
|
|
50
55
|
search_context_size?: string | undefined;
|
|
51
56
|
user_location?: WebSearchUserLocationServerTool$Outbound | undefined;
|
|
52
57
|
};
|
|
@@ -15,6 +15,7 @@ export const WebSearchServerToolConfig$outboundSchema = z.object({
|
|
|
15
15
|
maxCharacters: z.int().optional(),
|
|
16
16
|
maxResults: z.int().optional(),
|
|
17
17
|
maxTotalResults: z.int().optional(),
|
|
18
|
+
maxUses: z.int().optional(),
|
|
18
19
|
searchContextSize: SearchQualityLevel$outboundSchema.optional(),
|
|
19
20
|
userLocation: WebSearchUserLocationServerTool$outboundSchema.optional(),
|
|
20
21
|
}).transform((v) => {
|
|
@@ -24,6 +25,7 @@ export const WebSearchServerToolConfig$outboundSchema = z.object({
|
|
|
24
25
|
maxCharacters: "max_characters",
|
|
25
26
|
maxResults: "max_results",
|
|
26
27
|
maxTotalResults: "max_total_results",
|
|
28
|
+
maxUses: "max_uses",
|
|
27
29
|
searchContextSize: "search_context_size",
|
|
28
30
|
userLocation: "user_location",
|
|
29
31
|
});
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
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,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
+
"test:transit": "exit 0",
|
|
77
|
+
"test:watch": "vitest --watch --project unit",
|
|
76
78
|
"compile": "tsc",
|
|
79
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
80
|
+
"typecheck": "tsc --noEmit",
|
|
81
|
+
"typecheck:transit": "exit 0",
|
|
77
82
|
"prepare": "npm run build",
|
|
78
83
|
"test": "vitest --run --project unit",
|
|
79
|
-
"test:e2e": "vitest --run --project e2e"
|
|
80
|
-
"typecheck:transit": "exit 0",
|
|
81
|
-
"postinstall": "node scripts/check-types.js || true",
|
|
82
|
-
"test:transit": "exit 0",
|
|
83
|
-
"test:watch": "vitest --watch --project unit",
|
|
84
|
-
"typecheck": "tsc --noEmit"
|
|
84
|
+
"test:e2e": "vitest --run --project e2e"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|