@openrouter/sdk 0.12.4 → 0.12.5

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.4";
52
+ readonly sdkVersion: "0.12.5";
53
53
  readonly genVersion: "2.879.1";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.12.4 2.879.1 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.12.5 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.4",
29
+ sdkVersion: "0.12.5",
30
30
  genVersion: "2.879.1",
31
- userAgent: "speakeasy-sdk/typescript 0.12.4 2.879.1 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.12.5 2.879.1 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -4,6 +4,7 @@ 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";
8
9
  /**
9
10
  * Function definition for tool calling
@@ -46,7 +47,7 @@ export type ChatFunctionToolFunction = {
46
47
  /**
47
48
  * Tool definition for function calling (regular function or OpenRouter built-in server tool)
48
49
  */
49
- export type ChatFunctionTool = ChatFunctionToolFunction | DatetimeServerTool | ChatSearchModelsServerTool | OpenRouterWebSearchServerTool | ChatWebSearchShorthand;
50
+ export type ChatFunctionTool = ChatFunctionToolFunction | DatetimeServerTool | ImageGenerationServerToolOpenRouter | ChatSearchModelsServerTool | OpenRouterWebSearchServerTool | ChatWebSearchShorthand;
50
51
  /** @internal */
51
52
  export type ChatFunctionToolFunctionFunction$Outbound = {
52
53
  description?: string | undefined;
@@ -71,7 +72,7 @@ export type ChatFunctionToolFunction$Outbound = {
71
72
  export declare const ChatFunctionToolFunction$outboundSchema: z.ZodType<ChatFunctionToolFunction$Outbound, ChatFunctionToolFunction>;
72
73
  export declare function chatFunctionToolFunctionToJSON(chatFunctionToolFunction: ChatFunctionToolFunction): string;
73
74
  /** @internal */
74
- export type ChatFunctionTool$Outbound = ChatFunctionToolFunction$Outbound | DatetimeServerTool$Outbound | ChatSearchModelsServerTool$Outbound | OpenRouterWebSearchServerTool$Outbound | ChatWebSearchShorthand$Outbound;
75
+ export type ChatFunctionTool$Outbound = ChatFunctionToolFunction$Outbound | DatetimeServerTool$Outbound | ImageGenerationServerToolOpenRouter$Outbound | ChatSearchModelsServerTool$Outbound | OpenRouterWebSearchServerTool$Outbound | ChatWebSearchShorthand$Outbound;
75
76
  /** @internal */
76
77
  export declare const ChatFunctionTool$outboundSchema: z.ZodType<ChatFunctionTool$Outbound, ChatFunctionTool>;
77
78
  export declare function chatFunctionToolToJSON(chatFunctionTool: ChatFunctionTool): string;
@@ -8,6 +8,7 @@ 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";
12
13
  export const ChatFunctionToolType = {
13
14
  Function: "function",
@@ -41,6 +42,7 @@ export function chatFunctionToolFunctionToJSON(chatFunctionToolFunction) {
41
42
  export const ChatFunctionTool$outboundSchema = z.union([
42
43
  z.lazy(() => ChatFunctionToolFunction$outboundSchema),
43
44
  DatetimeServerTool$outboundSchema,
45
+ ImageGenerationServerToolOpenRouter$outboundSchema,
44
46
  ChatSearchModelsServerTool$outboundSchema,
45
47
  OpenRouterWebSearchServerTool$outboundSchema,
46
48
  ChatWebSearchShorthand$outboundSchema,
@@ -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]: string | number | Array<any | null>;
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]: string | number | Array<any | null>;
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(), z.union([z.string(), z.number(), z.array(z.nullable(z.any()))])).optional(),
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
@@ -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";
@@ -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";
@@ -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";
@@ -32,7 +34,6 @@ import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
32
34
  import { WebSearchPlugin, WebSearchPlugin$Outbound } from "./websearchplugin.js";
33
35
  import { WebSearchServerTool, WebSearchServerTool$Outbound } from "./websearchservertool.js";
34
36
  import { WebSearchServerToolOpenRouter, WebSearchServerToolOpenRouter$Outbound } from "./websearchservertoolopenrouter.js";
35
- export type ResponsesRequestImageConfig = string | number;
36
37
  export type ResponsesRequestPlugin = AutoRouterPlugin | ContextCompressionPlugin | FileParserPlugin | ModerationPlugin | ResponseHealingPlugin | WebSearchPlugin;
37
38
  export declare const ResponsesRequestServiceTier: {
38
39
  readonly Auto: "auto";
@@ -56,6 +57,8 @@ export type ResponsesRequestToolFunction = {
56
57
  };
57
58
  export type ResponsesRequestToolUnion = ResponsesRequestToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | (DatetimeServerTool & {
58
59
  type: "openrouter:datetime";
60
+ }) | (ImageGenerationServerToolOpenRouter & {
61
+ type: "openrouter:image_generation";
59
62
  }) | (ChatSearchModelsServerTool & {
60
63
  type: "openrouter:experimental__search_models";
61
64
  }) | WebSearchServerToolOpenRouter;
@@ -66,10 +69,10 @@ export type ResponsesRequest = {
66
69
  background?: boolean | null | undefined;
67
70
  frequencyPenalty?: number | null | undefined;
68
71
  /**
69
- * Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details.
72
+ * 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
73
  */
71
74
  imageConfig?: {
72
- [k: string]: string | number;
75
+ [k: string]: ImageConfig;
73
76
  } | undefined;
74
77
  include?: Array<ResponseIncludesEnum> | null | undefined;
75
78
  /**
@@ -124,6 +127,8 @@ export type ResponsesRequest = {
124
127
  toolChoice?: OpenAIResponsesToolChoiceUnion | undefined;
125
128
  tools?: Array<ResponsesRequestToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | (DatetimeServerTool & {
126
129
  type: "openrouter:datetime";
130
+ }) | (ImageGenerationServerToolOpenRouter & {
131
+ type: "openrouter:image_generation";
127
132
  }) | (ChatSearchModelsServerTool & {
128
133
  type: "openrouter:experimental__search_models";
129
134
  }) | WebSearchServerToolOpenRouter> | undefined;
@@ -141,11 +146,6 @@ export type ResponsesRequest = {
141
146
  user?: string | undefined;
142
147
  };
143
148
  /** @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
149
  export type ResponsesRequestPlugin$Outbound = AutoRouterPlugin$Outbound | ContextCompressionPlugin$Outbound | FileParserPlugin$Outbound | ModerationPlugin$Outbound | ResponseHealingPlugin$Outbound | WebSearchPlugin$Outbound;
150
150
  /** @internal */
151
151
  export declare const ResponsesRequestPlugin$outboundSchema: z.ZodType<ResponsesRequestPlugin$Outbound, ResponsesRequestPlugin>;
@@ -168,6 +168,8 @@ export declare function responsesRequestToolFunctionToJSON(responsesRequestToolF
168
168
  /** @internal */
169
169
  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
170
  type: "openrouter:datetime";
171
+ }) | (ImageGenerationServerToolOpenRouter$Outbound & {
172
+ type: "openrouter:image_generation";
171
173
  }) | (ChatSearchModelsServerTool$Outbound & {
172
174
  type: "openrouter:experimental__search_models";
173
175
  }) | WebSearchServerToolOpenRouter$Outbound;
@@ -179,7 +181,7 @@ export type ResponsesRequest$Outbound = {
179
181
  background?: boolean | null | undefined;
180
182
  frequency_penalty?: number | null | undefined;
181
183
  image_config?: {
182
- [k: string]: string | number;
184
+ [k: string]: ImageConfig$Outbound;
183
185
  } | undefined;
184
186
  include?: Array<string> | null | undefined;
185
187
  input?: InputsUnion$Outbound | undefined;
@@ -210,6 +212,8 @@ export type ResponsesRequest$Outbound = {
210
212
  tool_choice?: OpenAIResponsesToolChoiceUnion$Outbound | undefined;
211
213
  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
214
  type: "openrouter:datetime";
215
+ }) | (ImageGenerationServerToolOpenRouter$Outbound & {
216
+ type: "openrouter:image_generation";
213
217
  }) | (ChatSearchModelsServerTool$Outbound & {
214
218
  type: "openrouter:experimental__search_models";
215
219
  }) | WebSearchServerToolOpenRouter$Outbound> | 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";
@@ -45,11 +47,6 @@ export const ResponsesRequestServiceTier = {
45
47
  Scale: "scale",
46
48
  };
47
49
  /** @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
50
  export const ResponsesRequestPlugin$outboundSchema = z.union([
54
51
  AutoRouterPlugin$outboundSchema,
55
52
  ContextCompressionPlugin$outboundSchema,
@@ -91,6 +88,7 @@ export const ResponsesRequestToolUnion$outboundSchema = z.union([
91
88
  ApplyPatchServerTool$outboundSchema,
92
89
  CustomTool$outboundSchema,
93
90
  DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
91
+ ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
94
92
  ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
95
93
  WebSearchServerToolOpenRouter$outboundSchema,
96
94
  ]);
@@ -101,8 +99,7 @@ export function responsesRequestToolUnionToJSON(responsesRequestToolUnion) {
101
99
  export const ResponsesRequest$outboundSchema = z.object({
102
100
  background: z.nullable(z.boolean()).optional(),
103
101
  frequencyPenalty: z.nullable(z.number()).optional(),
104
- imageConfig: z.record(z.string(), z.union([z.string(), z.number()]))
105
- .optional(),
102
+ imageConfig: z.record(z.string(), ImageConfig$outboundSchema).optional(),
106
103
  include: z.nullable(z.array(ResponseIncludesEnum$outboundSchema)).optional(),
107
104
  input: InputsUnion$outboundSchema.optional(),
108
105
  instructions: z.nullable(z.string()).optional(),
@@ -151,6 +148,7 @@ export const ResponsesRequest$outboundSchema = z.object({
151
148
  ApplyPatchServerTool$outboundSchema,
152
149
  CustomTool$outboundSchema,
153
150
  DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
151
+ ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
154
152
  ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
155
153
  WebSearchServerToolOpenRouter$outboundSchema,
156
154
  ])).optional(),
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.12.4",
5
+ "version": "0.12.5",
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.4",
3
+ "version": "0.12.5",
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
72
  "typecheck": "tsc --noEmit",
74
73
  "compile": "tsc",
75
- "postinstall": "node scripts/check-types.js || true",
76
74
  "test": "vitest --run --project unit",
77
75
  "test:e2e": "vitest --run --project e2e",
78
76
  "test:transit": "exit 0",
79
77
  "test:watch": "vitest --watch --project unit",
80
- "typecheck:transit": "exit 0"
78
+ "typecheck:transit": "exit 0",
79
+ "postinstall": "node scripts/check-types.js || true",
80
+ "prepare": "npm run build"
81
81
  },
82
82
  "peerDependencies": {},
83
83
  "devDependencies": {