@openrouter/sdk 0.12.4 → 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.
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/chatfunctiontool.d.ts +4 -2
- package/esm/models/chatfunctiontool.js +4 -0
- package/esm/models/chatrequest.d.ts +3 -8
- package/esm/models/chatrequest.js +2 -6
- package/esm/models/imageconfig.d.ts +8 -0
- package/esm/models/imageconfig.js +11 -0
- package/esm/models/imagegenerationservertoolconfig.d.ts +23 -0
- package/esm/models/imagegenerationservertoolconfig.js +23 -0
- package/esm/models/imagegenerationservertoolconfigunion.d.ts +8 -0
- package/esm/models/imagegenerationservertoolconfigunion.js +11 -0
- package/esm/models/imagegenerationservertoolopenrouter.d.ts +28 -0
- package/esm/models/imagegenerationservertoolopenrouter.js +20 -0
- package/esm/models/index.d.ts +7 -0
- package/esm/models/index.js +7 -0
- package/esm/models/operations/getgeneration.d.ts +4 -0
- package/esm/models/operations/getgeneration.js +2 -0
- package/esm/models/responsesrequest.d.ts +22 -9
- package/esm/models/responsesrequest.js +8 -7
- package/esm/models/webfetchengineenum.d.ts +19 -0
- package/esm/models/webfetchengineenum.js +18 -0
- package/esm/models/webfetchservertool.d.ts +28 -0
- package/esm/models/webfetchservertool.js +20 -0
- package/esm/models/webfetchservertoolconfig.d.ts +39 -0
- package/esm/models/webfetchservertoolconfig.js +26 -0
- package/jsr.json +1 -1
- package/package.json +5 -5
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.6";
|
|
53
53
|
readonly genVersion: "2.879.1";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.12.
|
|
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.
|
|
29
|
+
sdkVersion: "0.12.6",
|
|
30
30
|
genVersion: "2.879.1",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 0.12.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 0.12.6 2.879.1 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -4,7 +4,9 @@ import { ChatContentCacheControl, ChatContentCacheControl$Outbound } from "./cha
|
|
|
4
4
|
import { ChatSearchModelsServerTool, ChatSearchModelsServerTool$Outbound } from "./chatsearchmodelsservertool.js";
|
|
5
5
|
import { ChatWebSearchShorthand, ChatWebSearchShorthand$Outbound } from "./chatwebsearchshorthand.js";
|
|
6
6
|
import { DatetimeServerTool, DatetimeServerTool$Outbound } from "./datetimeservertool.js";
|
|
7
|
+
import { ImageGenerationServerToolOpenRouter, ImageGenerationServerToolOpenRouter$Outbound } from "./imagegenerationservertoolopenrouter.js";
|
|
7
8
|
import { OpenRouterWebSearchServerTool, OpenRouterWebSearchServerTool$Outbound } from "./openrouterwebsearchservertool.js";
|
|
9
|
+
import { WebFetchServerTool, WebFetchServerTool$Outbound } from "./webfetchservertool.js";
|
|
8
10
|
/**
|
|
9
11
|
* Function definition for tool calling
|
|
10
12
|
*/
|
|
@@ -46,7 +48,7 @@ export type ChatFunctionToolFunction = {
|
|
|
46
48
|
/**
|
|
47
49
|
* Tool definition for function calling (regular function or OpenRouter built-in server tool)
|
|
48
50
|
*/
|
|
49
|
-
export type ChatFunctionTool = ChatFunctionToolFunction | DatetimeServerTool | ChatSearchModelsServerTool | OpenRouterWebSearchServerTool | ChatWebSearchShorthand;
|
|
51
|
+
export type ChatFunctionTool = ChatFunctionToolFunction | DatetimeServerTool | ImageGenerationServerToolOpenRouter | ChatSearchModelsServerTool | WebFetchServerTool | OpenRouterWebSearchServerTool | ChatWebSearchShorthand;
|
|
50
52
|
/** @internal */
|
|
51
53
|
export type ChatFunctionToolFunctionFunction$Outbound = {
|
|
52
54
|
description?: string | undefined;
|
|
@@ -71,7 +73,7 @@ export type ChatFunctionToolFunction$Outbound = {
|
|
|
71
73
|
export declare const ChatFunctionToolFunction$outboundSchema: z.ZodType<ChatFunctionToolFunction$Outbound, ChatFunctionToolFunction>;
|
|
72
74
|
export declare function chatFunctionToolFunctionToJSON(chatFunctionToolFunction: ChatFunctionToolFunction): string;
|
|
73
75
|
/** @internal */
|
|
74
|
-
export type ChatFunctionTool$Outbound = ChatFunctionToolFunction$Outbound | DatetimeServerTool$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;
|
|
75
77
|
/** @internal */
|
|
76
78
|
export declare const ChatFunctionTool$outboundSchema: z.ZodType<ChatFunctionTool$Outbound, ChatFunctionTool>;
|
|
77
79
|
export declare function chatFunctionToolToJSON(chatFunctionTool: ChatFunctionTool): string;
|
|
@@ -8,7 +8,9 @@ import { ChatContentCacheControl$outboundSchema, } from "./chatcontentcachecontr
|
|
|
8
8
|
import { ChatSearchModelsServerTool$outboundSchema, } from "./chatsearchmodelsservertool.js";
|
|
9
9
|
import { ChatWebSearchShorthand$outboundSchema, } from "./chatwebsearchshorthand.js";
|
|
10
10
|
import { DatetimeServerTool$outboundSchema, } from "./datetimeservertool.js";
|
|
11
|
+
import { ImageGenerationServerToolOpenRouter$outboundSchema, } from "./imagegenerationservertoolopenrouter.js";
|
|
11
12
|
import { OpenRouterWebSearchServerTool$outboundSchema, } from "./openrouterwebsearchservertool.js";
|
|
13
|
+
import { WebFetchServerTool$outboundSchema, } from "./webfetchservertool.js";
|
|
12
14
|
export const ChatFunctionToolType = {
|
|
13
15
|
Function: "function",
|
|
14
16
|
};
|
|
@@ -41,7 +43,9 @@ export function chatFunctionToolFunctionToJSON(chatFunctionToolFunction) {
|
|
|
41
43
|
export const ChatFunctionTool$outboundSchema = z.union([
|
|
42
44
|
z.lazy(() => ChatFunctionToolFunction$outboundSchema),
|
|
43
45
|
DatetimeServerTool$outboundSchema,
|
|
46
|
+
ImageGenerationServerToolOpenRouter$outboundSchema,
|
|
44
47
|
ChatSearchModelsServerTool$outboundSchema,
|
|
48
|
+
WebFetchServerTool$outboundSchema,
|
|
45
49
|
OpenRouterWebSearchServerTool$outboundSchema,
|
|
46
50
|
ChatWebSearchShorthand$outboundSchema,
|
|
47
51
|
]);
|
|
@@ -15,12 +15,12 @@ import { ChatToolChoice, ChatToolChoice$Outbound } from "./chattoolchoice.js";
|
|
|
15
15
|
import { ContextCompressionPlugin, ContextCompressionPlugin$Outbound } from "./contextcompressionplugin.js";
|
|
16
16
|
import { FileParserPlugin, FileParserPlugin$Outbound } from "./fileparserplugin.js";
|
|
17
17
|
import { FormatJsonObjectConfig, FormatJsonObjectConfig$Outbound } from "./formatjsonobjectconfig.js";
|
|
18
|
+
import { ImageConfig, ImageConfig$Outbound } from "./imageconfig.js";
|
|
18
19
|
import { ModerationPlugin, ModerationPlugin$Outbound } from "./moderationplugin.js";
|
|
19
20
|
import { ProviderPreferences, ProviderPreferences$Outbound } from "./providerpreferences.js";
|
|
20
21
|
import { ResponseHealingPlugin, ResponseHealingPlugin$Outbound } from "./responsehealingplugin.js";
|
|
21
22
|
import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
|
|
22
23
|
import { WebSearchPlugin, WebSearchPlugin$Outbound } from "./websearchplugin.js";
|
|
23
|
-
export type ChatRequestImageConfig = string | number | Array<any | null>;
|
|
24
24
|
export declare const Modality: {
|
|
25
25
|
readonly Text: "text";
|
|
26
26
|
readonly Image: "image";
|
|
@@ -92,7 +92,7 @@ export type ChatRequest = {
|
|
|
92
92
|
* Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
|
|
93
93
|
*/
|
|
94
94
|
imageConfig?: {
|
|
95
|
-
[k: string]:
|
|
95
|
+
[k: string]: ImageConfig;
|
|
96
96
|
} | undefined;
|
|
97
97
|
/**
|
|
98
98
|
* Token logit bias adjustments
|
|
@@ -212,11 +212,6 @@ export type ChatRequest = {
|
|
|
212
212
|
user?: string | undefined;
|
|
213
213
|
};
|
|
214
214
|
/** @internal */
|
|
215
|
-
export type ChatRequestImageConfig$Outbound = string | number | Array<any | null>;
|
|
216
|
-
/** @internal */
|
|
217
|
-
export declare const ChatRequestImageConfig$outboundSchema: z.ZodType<ChatRequestImageConfig$Outbound, ChatRequestImageConfig>;
|
|
218
|
-
export declare function chatRequestImageConfigToJSON(chatRequestImageConfig: ChatRequestImageConfig): string;
|
|
219
|
-
/** @internal */
|
|
220
215
|
export declare const Modality$outboundSchema: z.ZodType<string, Modality>;
|
|
221
216
|
/** @internal */
|
|
222
217
|
export type ChatRequestPlugin$Outbound = AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | ModerationPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound;
|
|
@@ -251,7 +246,7 @@ export type ChatRequest$Outbound = {
|
|
|
251
246
|
debug?: ChatDebugOptions$Outbound | undefined;
|
|
252
247
|
frequency_penalty?: number | null | undefined;
|
|
253
248
|
image_config?: {
|
|
254
|
-
[k: string]:
|
|
249
|
+
[k: string]: ImageConfig$Outbound;
|
|
255
250
|
} | undefined;
|
|
256
251
|
logit_bias?: {
|
|
257
252
|
[k: string]: number;
|
|
@@ -20,6 +20,7 @@ import { ChatToolChoice$outboundSchema, } from "./chattoolchoice.js";
|
|
|
20
20
|
import { ContextCompressionPlugin$outboundSchema, } from "./contextcompressionplugin.js";
|
|
21
21
|
import { FileParserPlugin$outboundSchema, } from "./fileparserplugin.js";
|
|
22
22
|
import { FormatJsonObjectConfig$outboundSchema, } from "./formatjsonobjectconfig.js";
|
|
23
|
+
import { ImageConfig$outboundSchema, } from "./imageconfig.js";
|
|
23
24
|
import { ModerationPlugin$outboundSchema, } from "./moderationplugin.js";
|
|
24
25
|
import { ProviderPreferences$outboundSchema, } from "./providerpreferences.js";
|
|
25
26
|
import { ResponseHealingPlugin$outboundSchema, } from "./responsehealingplugin.js";
|
|
@@ -52,11 +53,6 @@ export const ChatRequestServiceTier = {
|
|
|
52
53
|
Scale: "scale",
|
|
53
54
|
};
|
|
54
55
|
/** @internal */
|
|
55
|
-
export const ChatRequestImageConfig$outboundSchema = z.union([z.string(), z.number(), z.array(z.nullable(z.any()))]);
|
|
56
|
-
export function chatRequestImageConfigToJSON(chatRequestImageConfig) {
|
|
57
|
-
return JSON.stringify(ChatRequestImageConfig$outboundSchema.parse(chatRequestImageConfig));
|
|
58
|
-
}
|
|
59
|
-
/** @internal */
|
|
60
56
|
export const Modality$outboundSchema = openEnums
|
|
61
57
|
.outboundSchema(Modality);
|
|
62
58
|
/** @internal */
|
|
@@ -110,7 +106,7 @@ export const ChatRequest$outboundSchema = z.object({
|
|
|
110
106
|
cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
|
|
111
107
|
debug: ChatDebugOptions$outboundSchema.optional(),
|
|
112
108
|
frequencyPenalty: z.nullable(z.number()).optional(),
|
|
113
|
-
imageConfig: z.record(z.string(),
|
|
109
|
+
imageConfig: z.record(z.string(), ImageConfig$outboundSchema).optional(),
|
|
114
110
|
logitBias: z.nullable(z.record(z.string(), z.number())).optional(),
|
|
115
111
|
logprobs: z.nullable(z.boolean()).optional(),
|
|
116
112
|
maxCompletionTokens: z.nullable(z.int()).optional(),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type ImageConfig = string | number | Array<any | null>;
|
|
3
|
+
/** @internal */
|
|
4
|
+
export type ImageConfig$Outbound = string | number | Array<any | null>;
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare const ImageConfig$outboundSchema: z.ZodType<ImageConfig$Outbound, ImageConfig>;
|
|
7
|
+
export declare function imageConfigToJSON(imageConfig: ImageConfig): string;
|
|
8
|
+
//# sourceMappingURL=imageconfig.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 9b3ec0cba621
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const ImageConfig$outboundSchema = z.union([z.string(), z.number(), z.array(z.nullable(z.any()))]);
|
|
8
|
+
export function imageConfigToJSON(imageConfig) {
|
|
9
|
+
return JSON.stringify(ImageConfig$outboundSchema.parse(imageConfig));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=imageconfig.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ImageGenerationServerToolConfigUnion } from "./imagegenerationservertoolconfigunion.js";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the openrouter:image_generation server tool. Accepts all image_config params (aspect_ratio, quality, size, background, output_format, output_compression, moderation, etc.) plus a model field.
|
|
5
|
+
*/
|
|
6
|
+
export type ImageGenerationServerToolConfig = {
|
|
7
|
+
/**
|
|
8
|
+
* Which image generation model to use (e.g. "openai/gpt-image-1"). Defaults to "openai/gpt-image-1".
|
|
9
|
+
*/
|
|
10
|
+
model?: string | undefined;
|
|
11
|
+
additionalProperties?: {
|
|
12
|
+
[k: string]: ImageGenerationServerToolConfigUnion;
|
|
13
|
+
} | undefined;
|
|
14
|
+
};
|
|
15
|
+
/** @internal */
|
|
16
|
+
export type ImageGenerationServerToolConfig$Outbound = {
|
|
17
|
+
model?: string | undefined;
|
|
18
|
+
[additionalProperties: string]: unknown;
|
|
19
|
+
};
|
|
20
|
+
/** @internal */
|
|
21
|
+
export declare const ImageGenerationServerToolConfig$outboundSchema: z.ZodType<ImageGenerationServerToolConfig$Outbound, ImageGenerationServerToolConfig>;
|
|
22
|
+
export declare function imageGenerationServerToolConfigToJSON(imageGenerationServerToolConfig: ImageGenerationServerToolConfig): string;
|
|
23
|
+
//# sourceMappingURL=imagegenerationservertoolconfig.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 1d04d0100527
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { ImageGenerationServerToolConfigUnion$outboundSchema, } from "./imagegenerationservertoolconfigunion.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const ImageGenerationServerToolConfig$outboundSchema = z.object({
|
|
10
|
+
model: z.string().optional(),
|
|
11
|
+
additionalProperties: z.record(z.string(), ImageGenerationServerToolConfigUnion$outboundSchema).optional(),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return {
|
|
14
|
+
...v.additionalProperties,
|
|
15
|
+
...remap$(v, {
|
|
16
|
+
additionalProperties: null,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
export function imageGenerationServerToolConfigToJSON(imageGenerationServerToolConfig) {
|
|
21
|
+
return JSON.stringify(ImageGenerationServerToolConfig$outboundSchema.parse(imageGenerationServerToolConfig));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=imagegenerationservertoolconfig.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type ImageGenerationServerToolConfigUnion = string | number | Array<any | null>;
|
|
3
|
+
/** @internal */
|
|
4
|
+
export type ImageGenerationServerToolConfigUnion$Outbound = string | number | Array<any | null>;
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare const ImageGenerationServerToolConfigUnion$outboundSchema: z.ZodType<ImageGenerationServerToolConfigUnion$Outbound, ImageGenerationServerToolConfigUnion>;
|
|
7
|
+
export declare function imageGenerationServerToolConfigUnionToJSON(imageGenerationServerToolConfigUnion: ImageGenerationServerToolConfigUnion): string;
|
|
8
|
+
//# sourceMappingURL=imagegenerationservertoolconfigunion.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 7215dce3dfc7
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const ImageGenerationServerToolConfigUnion$outboundSchema = z.union([z.string(), z.number(), z.array(z.nullable(z.any()))]);
|
|
8
|
+
export function imageGenerationServerToolConfigUnionToJSON(imageGenerationServerToolConfigUnion) {
|
|
9
|
+
return JSON.stringify(ImageGenerationServerToolConfigUnion$outboundSchema.parse(imageGenerationServerToolConfigUnion));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=imagegenerationservertoolconfigunion.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { ImageGenerationServerToolConfig, ImageGenerationServerToolConfig$Outbound } from "./imagegenerationservertoolconfig.js";
|
|
4
|
+
export declare const ImageGenerationServerToolOpenRouterType: {
|
|
5
|
+
readonly OpenrouterImageGeneration: "openrouter:image_generation";
|
|
6
|
+
};
|
|
7
|
+
export type ImageGenerationServerToolOpenRouterType = ClosedEnum<typeof ImageGenerationServerToolOpenRouterType>;
|
|
8
|
+
/**
|
|
9
|
+
* OpenRouter built-in server tool: generates images from text prompts using an image generation model
|
|
10
|
+
*/
|
|
11
|
+
export type ImageGenerationServerToolOpenRouter = {
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for the openrouter:image_generation server tool. Accepts all image_config params (aspect_ratio, quality, size, background, output_format, output_compression, moderation, etc.) plus a model field.
|
|
14
|
+
*/
|
|
15
|
+
parameters?: ImageGenerationServerToolConfig | undefined;
|
|
16
|
+
type: ImageGenerationServerToolOpenRouterType;
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const ImageGenerationServerToolOpenRouterType$outboundSchema: z.ZodEnum<typeof ImageGenerationServerToolOpenRouterType>;
|
|
20
|
+
/** @internal */
|
|
21
|
+
export type ImageGenerationServerToolOpenRouter$Outbound = {
|
|
22
|
+
parameters?: ImageGenerationServerToolConfig$Outbound | undefined;
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const ImageGenerationServerToolOpenRouter$outboundSchema: z.ZodType<ImageGenerationServerToolOpenRouter$Outbound, ImageGenerationServerToolOpenRouter>;
|
|
27
|
+
export declare function imageGenerationServerToolOpenRouterToJSON(imageGenerationServerToolOpenRouter: ImageGenerationServerToolOpenRouter): string;
|
|
28
|
+
//# sourceMappingURL=imagegenerationservertoolopenrouter.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: dcbe3d0a09ac
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { ImageGenerationServerToolConfig$outboundSchema, } from "./imagegenerationservertoolconfig.js";
|
|
7
|
+
export const ImageGenerationServerToolOpenRouterType = {
|
|
8
|
+
OpenrouterImageGeneration: "openrouter:image_generation",
|
|
9
|
+
};
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const ImageGenerationServerToolOpenRouterType$outboundSchema = z.enum(ImageGenerationServerToolOpenRouterType);
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const ImageGenerationServerToolOpenRouter$outboundSchema = z.object({
|
|
14
|
+
parameters: ImageGenerationServerToolConfig$outboundSchema.optional(),
|
|
15
|
+
type: ImageGenerationServerToolOpenRouterType$outboundSchema,
|
|
16
|
+
});
|
|
17
|
+
export function imageGenerationServerToolOpenRouterToJSON(imageGenerationServerToolOpenRouter) {
|
|
18
|
+
return JSON.stringify(ImageGenerationServerToolOpenRouter$outboundSchema.parse(imageGenerationServerToolOpenRouter));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=imagegenerationservertoolopenrouter.js.map
|
package/esm/models/index.d.ts
CHANGED
|
@@ -96,11 +96,15 @@ export * from "./functioncalloutputitem.js";
|
|
|
96
96
|
export * from "./getguardrailresponse.js";
|
|
97
97
|
export * from "./guardrail.js";
|
|
98
98
|
export * from "./guardrailinterval.js";
|
|
99
|
+
export * from "./imageconfig.js";
|
|
99
100
|
export * from "./imagegencallcompletedevent.js";
|
|
100
101
|
export * from "./imagegencallgeneratingevent.js";
|
|
101
102
|
export * from "./imagegencallinprogressevent.js";
|
|
102
103
|
export * from "./imagegencallpartialimageevent.js";
|
|
103
104
|
export * from "./imagegenerationservertool.js";
|
|
105
|
+
export * from "./imagegenerationservertoolconfig.js";
|
|
106
|
+
export * from "./imagegenerationservertoolconfigunion.js";
|
|
107
|
+
export * from "./imagegenerationservertoolopenrouter.js";
|
|
104
108
|
export * from "./imagegenerationstatus.js";
|
|
105
109
|
export * from "./incompletedetails.js";
|
|
106
110
|
export * from "./inputaudio.js";
|
|
@@ -252,6 +256,9 @@ export * from "./videogenerationresponse.js";
|
|
|
252
256
|
export * from "./videogenerationusage.js";
|
|
253
257
|
export * from "./videomodel.js";
|
|
254
258
|
export * from "./videomodelslistresponse.js";
|
|
259
|
+
export * from "./webfetchengineenum.js";
|
|
260
|
+
export * from "./webfetchservertool.js";
|
|
261
|
+
export * from "./webfetchservertoolconfig.js";
|
|
255
262
|
export * from "./websearchcallcompletedevent.js";
|
|
256
263
|
export * from "./websearchcallinprogressevent.js";
|
|
257
264
|
export * from "./websearchcallsearchingevent.js";
|
package/esm/models/index.js
CHANGED
|
@@ -100,11 +100,15 @@ export * from "./functioncalloutputitem.js";
|
|
|
100
100
|
export * from "./getguardrailresponse.js";
|
|
101
101
|
export * from "./guardrail.js";
|
|
102
102
|
export * from "./guardrailinterval.js";
|
|
103
|
+
export * from "./imageconfig.js";
|
|
103
104
|
export * from "./imagegencallcompletedevent.js";
|
|
104
105
|
export * from "./imagegencallgeneratingevent.js";
|
|
105
106
|
export * from "./imagegencallinprogressevent.js";
|
|
106
107
|
export * from "./imagegencallpartialimageevent.js";
|
|
107
108
|
export * from "./imagegenerationservertool.js";
|
|
109
|
+
export * from "./imagegenerationservertoolconfig.js";
|
|
110
|
+
export * from "./imagegenerationservertoolconfigunion.js";
|
|
111
|
+
export * from "./imagegenerationservertoolopenrouter.js";
|
|
108
112
|
export * from "./imagegenerationstatus.js";
|
|
109
113
|
export * from "./incompletedetails.js";
|
|
110
114
|
export * from "./inputaudio.js";
|
|
@@ -256,6 +260,9 @@ export * from "./videogenerationresponse.js";
|
|
|
256
260
|
export * from "./videogenerationusage.js";
|
|
257
261
|
export * from "./videomodel.js";
|
|
258
262
|
export * from "./videomodelslistresponse.js";
|
|
263
|
+
export * from "./webfetchengineenum.js";
|
|
264
|
+
export * from "./webfetchservertool.js";
|
|
265
|
+
export * from "./webfetchservertoolconfig.js";
|
|
259
266
|
export * from "./websearchcallcompletedevent.js";
|
|
260
267
|
export * from "./websearchcallinprogressevent.js";
|
|
261
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",
|
|
@@ -11,7 +11,9 @@ import { CustomTool, CustomTool$Outbound } from "./customtool.js";
|
|
|
11
11
|
import { DatetimeServerTool, DatetimeServerTool$Outbound } from "./datetimeservertool.js";
|
|
12
12
|
import { FileParserPlugin, FileParserPlugin$Outbound } from "./fileparserplugin.js";
|
|
13
13
|
import { FileSearchServerTool, FileSearchServerTool$Outbound } from "./filesearchservertool.js";
|
|
14
|
+
import { ImageConfig, ImageConfig$Outbound } from "./imageconfig.js";
|
|
14
15
|
import { ImageGenerationServerTool, ImageGenerationServerTool$Outbound } from "./imagegenerationservertool.js";
|
|
16
|
+
import { ImageGenerationServerToolOpenRouter, ImageGenerationServerToolOpenRouter$Outbound } from "./imagegenerationservertoolopenrouter.js";
|
|
15
17
|
import { InputsUnion, InputsUnion$Outbound } from "./inputsunion.js";
|
|
16
18
|
import { LegacyWebSearchServerTool, LegacyWebSearchServerTool$Outbound } from "./legacywebsearchservertool.js";
|
|
17
19
|
import { McpServerTool, McpServerTool$Outbound } from "./mcpservertool.js";
|
|
@@ -29,10 +31,10 @@ import { ShellServerTool, ShellServerTool$Outbound } from "./shellservertool.js"
|
|
|
29
31
|
import { StoredPromptTemplate, StoredPromptTemplate$Outbound } from "./storedprompttemplate.js";
|
|
30
32
|
import { TextExtendedConfig, TextExtendedConfig$Outbound } from "./textextendedconfig.js";
|
|
31
33
|
import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
|
|
34
|
+
import { WebFetchServerTool, WebFetchServerTool$Outbound } from "./webfetchservertool.js";
|
|
32
35
|
import { WebSearchPlugin, WebSearchPlugin$Outbound } from "./websearchplugin.js";
|
|
33
36
|
import { WebSearchServerTool, WebSearchServerTool$Outbound } from "./websearchservertool.js";
|
|
34
37
|
import { WebSearchServerToolOpenRouter, WebSearchServerToolOpenRouter$Outbound } from "./websearchservertoolopenrouter.js";
|
|
35
|
-
export type ResponsesRequestImageConfig = string | number;
|
|
36
38
|
export type ResponsesRequestPlugin = AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | ModerationPlugin | ResponseHealingPlugin | WebSearchPlugin;
|
|
37
39
|
export declare const ResponsesRequestServiceTier: {
|
|
38
40
|
readonly Auto: "auto";
|
|
@@ -56,8 +58,12 @@ export type ResponsesRequestToolFunction = {
|
|
|
56
58
|
};
|
|
57
59
|
export type ResponsesRequestToolUnion = ResponsesRequestToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | (DatetimeServerTool & {
|
|
58
60
|
type: "openrouter:datetime";
|
|
61
|
+
}) | (ImageGenerationServerToolOpenRouter & {
|
|
62
|
+
type: "openrouter:image_generation";
|
|
59
63
|
}) | (ChatSearchModelsServerTool & {
|
|
60
64
|
type: "openrouter:experimental__search_models";
|
|
65
|
+
}) | (WebFetchServerTool & {
|
|
66
|
+
type: "openrouter:web_fetch";
|
|
61
67
|
}) | WebSearchServerToolOpenRouter;
|
|
62
68
|
/**
|
|
63
69
|
* Request schema for Responses endpoint
|
|
@@ -66,10 +72,10 @@ export type ResponsesRequest = {
|
|
|
66
72
|
background?: boolean | null | undefined;
|
|
67
73
|
frequencyPenalty?: number | null | undefined;
|
|
68
74
|
/**
|
|
69
|
-
* Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/
|
|
75
|
+
* Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
|
|
70
76
|
*/
|
|
71
77
|
imageConfig?: {
|
|
72
|
-
[k: string]:
|
|
78
|
+
[k: string]: ImageConfig;
|
|
73
79
|
} | undefined;
|
|
74
80
|
include?: Array<ResponseIncludesEnum> | null | undefined;
|
|
75
81
|
/**
|
|
@@ -124,8 +130,12 @@ export type ResponsesRequest = {
|
|
|
124
130
|
toolChoice?: OpenAIResponsesToolChoiceUnion | undefined;
|
|
125
131
|
tools?: Array<ResponsesRequestToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | (DatetimeServerTool & {
|
|
126
132
|
type: "openrouter:datetime";
|
|
133
|
+
}) | (ImageGenerationServerToolOpenRouter & {
|
|
134
|
+
type: "openrouter:image_generation";
|
|
127
135
|
}) | (ChatSearchModelsServerTool & {
|
|
128
136
|
type: "openrouter:experimental__search_models";
|
|
137
|
+
}) | (WebFetchServerTool & {
|
|
138
|
+
type: "openrouter:web_fetch";
|
|
129
139
|
}) | WebSearchServerToolOpenRouter> | undefined;
|
|
130
140
|
topK?: number | undefined;
|
|
131
141
|
topLogprobs?: number | null | undefined;
|
|
@@ -141,11 +151,6 @@ export type ResponsesRequest = {
|
|
|
141
151
|
user?: string | undefined;
|
|
142
152
|
};
|
|
143
153
|
/** @internal */
|
|
144
|
-
export type ResponsesRequestImageConfig$Outbound = string | number;
|
|
145
|
-
/** @internal */
|
|
146
|
-
export declare const ResponsesRequestImageConfig$outboundSchema: z.ZodType<ResponsesRequestImageConfig$Outbound, ResponsesRequestImageConfig>;
|
|
147
|
-
export declare function responsesRequestImageConfigToJSON(responsesRequestImageConfig: ResponsesRequestImageConfig): string;
|
|
148
|
-
/** @internal */
|
|
149
154
|
export type ResponsesRequestPlugin$Outbound = AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | ModerationPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound;
|
|
150
155
|
/** @internal */
|
|
151
156
|
export declare const ResponsesRequestPlugin$outboundSchema: z.ZodType<ResponsesRequestPlugin$Outbound, ResponsesRequestPlugin>;
|
|
@@ -168,8 +173,12 @@ export declare function responsesRequestToolFunctionToJSON(responsesRequestToolF
|
|
|
168
173
|
/** @internal */
|
|
169
174
|
export type ResponsesRequestToolUnion$Outbound = ResponsesRequestToolFunction$Outbound | PreviewWebSearchServerTool$Outbound | Preview20250311WebSearchServerTool$Outbound | LegacyWebSearchServerTool$Outbound | WebSearchServerTool$Outbound | FileSearchServerTool$Outbound | ComputerUseServerTool$Outbound | CodeInterpreterServerTool$Outbound | McpServerTool$Outbound | ImageGenerationServerTool$Outbound | CodexLocalShellTool$Outbound | ShellServerTool$Outbound | ApplyPatchServerTool$Outbound | CustomTool$Outbound | (DatetimeServerTool$Outbound & {
|
|
170
175
|
type: "openrouter:datetime";
|
|
176
|
+
}) | (ImageGenerationServerToolOpenRouter$Outbound & {
|
|
177
|
+
type: "openrouter:image_generation";
|
|
171
178
|
}) | (ChatSearchModelsServerTool$Outbound & {
|
|
172
179
|
type: "openrouter:experimental__search_models";
|
|
180
|
+
}) | (WebFetchServerTool$Outbound & {
|
|
181
|
+
type: "openrouter:web_fetch";
|
|
173
182
|
}) | WebSearchServerToolOpenRouter$Outbound;
|
|
174
183
|
/** @internal */
|
|
175
184
|
export declare const ResponsesRequestToolUnion$outboundSchema: z.ZodType<ResponsesRequestToolUnion$Outbound, ResponsesRequestToolUnion>;
|
|
@@ -179,7 +188,7 @@ export type ResponsesRequest$Outbound = {
|
|
|
179
188
|
background?: boolean | null | undefined;
|
|
180
189
|
frequency_penalty?: number | null | undefined;
|
|
181
190
|
image_config?: {
|
|
182
|
-
[k: string]:
|
|
191
|
+
[k: string]: ImageConfig$Outbound;
|
|
183
192
|
} | undefined;
|
|
184
193
|
include?: Array<string> | null | undefined;
|
|
185
194
|
input?: InputsUnion$Outbound | undefined;
|
|
@@ -210,8 +219,12 @@ export type ResponsesRequest$Outbound = {
|
|
|
210
219
|
tool_choice?: OpenAIResponsesToolChoiceUnion$Outbound | undefined;
|
|
211
220
|
tools?: Array<ResponsesRequestToolFunction$Outbound | PreviewWebSearchServerTool$Outbound | Preview20250311WebSearchServerTool$Outbound | LegacyWebSearchServerTool$Outbound | WebSearchServerTool$Outbound | FileSearchServerTool$Outbound | ComputerUseServerTool$Outbound | CodeInterpreterServerTool$Outbound | McpServerTool$Outbound | ImageGenerationServerTool$Outbound | CodexLocalShellTool$Outbound | ShellServerTool$Outbound | ApplyPatchServerTool$Outbound | CustomTool$Outbound | (DatetimeServerTool$Outbound & {
|
|
212
221
|
type: "openrouter:datetime";
|
|
222
|
+
}) | (ImageGenerationServerToolOpenRouter$Outbound & {
|
|
223
|
+
type: "openrouter:image_generation";
|
|
213
224
|
}) | (ChatSearchModelsServerTool$Outbound & {
|
|
214
225
|
type: "openrouter:experimental__search_models";
|
|
226
|
+
}) | (WebFetchServerTool$Outbound & {
|
|
227
|
+
type: "openrouter:web_fetch";
|
|
215
228
|
}) | WebSearchServerToolOpenRouter$Outbound> | undefined;
|
|
216
229
|
top_k?: number | undefined;
|
|
217
230
|
top_logprobs?: number | null | undefined;
|
|
@@ -16,7 +16,9 @@ import { CustomTool$outboundSchema, } from "./customtool.js";
|
|
|
16
16
|
import { DatetimeServerTool$outboundSchema, } from "./datetimeservertool.js";
|
|
17
17
|
import { FileParserPlugin$outboundSchema, } from "./fileparserplugin.js";
|
|
18
18
|
import { FileSearchServerTool$outboundSchema, } from "./filesearchservertool.js";
|
|
19
|
+
import { ImageConfig$outboundSchema, } from "./imageconfig.js";
|
|
19
20
|
import { ImageGenerationServerTool$outboundSchema, } from "./imagegenerationservertool.js";
|
|
21
|
+
import { ImageGenerationServerToolOpenRouter$outboundSchema, } from "./imagegenerationservertoolopenrouter.js";
|
|
20
22
|
import { InputsUnion$outboundSchema, } from "./inputsunion.js";
|
|
21
23
|
import { LegacyWebSearchServerTool$outboundSchema, } from "./legacywebsearchservertool.js";
|
|
22
24
|
import { McpServerTool$outboundSchema, } from "./mcpservertool.js";
|
|
@@ -34,6 +36,7 @@ import { ShellServerTool$outboundSchema, } from "./shellservertool.js";
|
|
|
34
36
|
import { StoredPromptTemplate$outboundSchema, } from "./storedprompttemplate.js";
|
|
35
37
|
import { TextExtendedConfig$outboundSchema, } from "./textextendedconfig.js";
|
|
36
38
|
import { TraceConfig$outboundSchema, } from "./traceconfig.js";
|
|
39
|
+
import { WebFetchServerTool$outboundSchema, } from "./webfetchservertool.js";
|
|
37
40
|
import { WebSearchPlugin$outboundSchema, } from "./websearchplugin.js";
|
|
38
41
|
import { WebSearchServerTool$outboundSchema, } from "./websearchservertool.js";
|
|
39
42
|
import { WebSearchServerToolOpenRouter$outboundSchema, } from "./websearchservertoolopenrouter.js";
|
|
@@ -45,11 +48,6 @@ export const ResponsesRequestServiceTier = {
|
|
|
45
48
|
Scale: "scale",
|
|
46
49
|
};
|
|
47
50
|
/** @internal */
|
|
48
|
-
export const ResponsesRequestImageConfig$outboundSchema = z.union([z.string(), z.number()]);
|
|
49
|
-
export function responsesRequestImageConfigToJSON(responsesRequestImageConfig) {
|
|
50
|
-
return JSON.stringify(ResponsesRequestImageConfig$outboundSchema.parse(responsesRequestImageConfig));
|
|
51
|
-
}
|
|
52
|
-
/** @internal */
|
|
53
51
|
export const ResponsesRequestPlugin$outboundSchema = z.union([
|
|
54
52
|
AutoRouterPlugin$outboundSchema,
|
|
55
53
|
ContextCompressionPlugin$outboundSchema,
|
|
@@ -91,7 +89,9 @@ export const ResponsesRequestToolUnion$outboundSchema = z.union([
|
|
|
91
89
|
ApplyPatchServerTool$outboundSchema,
|
|
92
90
|
CustomTool$outboundSchema,
|
|
93
91
|
DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
|
|
92
|
+
ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
|
|
94
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") })),
|
|
95
95
|
WebSearchServerToolOpenRouter$outboundSchema,
|
|
96
96
|
]);
|
|
97
97
|
export function responsesRequestToolUnionToJSON(responsesRequestToolUnion) {
|
|
@@ -101,8 +101,7 @@ export function responsesRequestToolUnionToJSON(responsesRequestToolUnion) {
|
|
|
101
101
|
export const ResponsesRequest$outboundSchema = z.object({
|
|
102
102
|
background: z.nullable(z.boolean()).optional(),
|
|
103
103
|
frequencyPenalty: z.nullable(z.number()).optional(),
|
|
104
|
-
imageConfig: z.record(z.string(),
|
|
105
|
-
.optional(),
|
|
104
|
+
imageConfig: z.record(z.string(), ImageConfig$outboundSchema).optional(),
|
|
106
105
|
include: z.nullable(z.array(ResponseIncludesEnum$outboundSchema)).optional(),
|
|
107
106
|
input: InputsUnion$outboundSchema.optional(),
|
|
108
107
|
instructions: z.nullable(z.string()).optional(),
|
|
@@ -151,7 +150,9 @@ export const ResponsesRequest$outboundSchema = z.object({
|
|
|
151
150
|
ApplyPatchServerTool$outboundSchema,
|
|
152
151
|
CustomTool$outboundSchema,
|
|
153
152
|
DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
|
|
153
|
+
ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
|
|
154
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") })),
|
|
155
156
|
WebSearchServerToolOpenRouter$outboundSchema,
|
|
156
157
|
])).optional(),
|
|
157
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "0.12.
|
|
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
|
-
"prepare": "npm run build",
|
|
73
|
-
"typecheck": "tsc --noEmit",
|
|
74
72
|
"compile": "tsc",
|
|
75
73
|
"postinstall": "node scripts/check-types.js || true",
|
|
74
|
+
"prepare": "npm run build",
|
|
76
75
|
"test": "vitest --run --project unit",
|
|
77
|
-
"test:e2e": "vitest --run --project e2e",
|
|
78
76
|
"test:transit": "exit 0",
|
|
79
77
|
"test:watch": "vitest --watch --project unit",
|
|
80
|
-
"typecheck
|
|
78
|
+
"typecheck": "tsc --noEmit",
|
|
79
|
+
"typecheck:transit": "exit 0",
|
|
80
|
+
"test:e2e": "vitest --run --project e2e"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {},
|
|
83
83
|
"devDependencies": {
|