@openrouter/sdk 0.3.12 → 0.3.14

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.
Files changed (59) hide show
  1. package/esm/lib/anthropic-compat.test.js +3 -0
  2. package/esm/lib/chat-compat.test.js +3 -0
  3. package/esm/lib/config.d.ts +2 -2
  4. package/esm/lib/config.js +2 -2
  5. package/esm/lib/tool-types.d.ts +1 -1
  6. package/esm/models/chatgenerationparams.d.ts +93 -12
  7. package/esm/models/chatgenerationparams.js +75 -6
  8. package/esm/models/chatgenerationtokenusage.d.ts +1 -0
  9. package/esm/models/chatgenerationtokenusage.js +2 -0
  10. package/esm/models/chatmessagetokenlogprob.d.ts +4 -4
  11. package/esm/models/chatmessagetokenlogprob.js +4 -5
  12. package/esm/models/index.d.ts +7 -0
  13. package/esm/models/index.js +7 -0
  14. package/esm/models/openairesponsesinputunion.d.ts +15 -5
  15. package/esm/models/openairesponsesinputunion.js +5 -5
  16. package/esm/models/openresponseseasyinputmessage.d.ts +41 -16
  17. package/esm/models/openresponseseasyinputmessage.js +38 -13
  18. package/esm/models/openresponsesinputmessageitem.d.ts +37 -12
  19. package/esm/models/openresponsesinputmessageitem.js +33 -9
  20. package/esm/models/openresponsesnonstreamingresponse.d.ts +5 -2
  21. package/esm/models/openresponsesnonstreamingresponse.js +8 -2
  22. package/esm/models/openresponsesreasoning.d.ts +1 -0
  23. package/esm/models/openresponsesreasoning.js +1 -0
  24. package/esm/models/openresponsesrequest.d.ts +61 -24
  25. package/esm/models/openresponsesrequest.js +39 -6
  26. package/esm/models/operations/getgeneration.d.ts +4 -0
  27. package/esm/models/operations/getgeneration.js +1 -0
  28. package/esm/models/percentilelatencycutoffs.d.ts +33 -0
  29. package/esm/models/percentilelatencycutoffs.js +16 -0
  30. package/esm/models/percentilestats.d.ts +28 -0
  31. package/esm/models/percentilestats.js +17 -0
  32. package/esm/models/percentilethroughputcutoffs.d.ts +33 -0
  33. package/esm/models/percentilethroughputcutoffs.js +16 -0
  34. package/esm/models/preferredmaxlatency.d.ts +12 -0
  35. package/esm/models/preferredmaxlatency.js +12 -0
  36. package/esm/models/preferredminthroughput.d.ts +12 -0
  37. package/esm/models/preferredminthroughput.js +12 -0
  38. package/esm/models/providername.d.ts +3 -2
  39. package/esm/models/providername.js +3 -2
  40. package/esm/models/providerpreferences.d.ts +8 -20
  41. package/esm/models/providerpreferences.js +6 -6
  42. package/esm/models/publicendpoint.d.ts +6 -0
  43. package/esm/models/publicendpoint.js +5 -0
  44. package/esm/models/responseinputimage.d.ts +11 -3
  45. package/esm/models/responseinputimage.js +9 -2
  46. package/esm/models/responseinputvideo.d.ts +20 -0
  47. package/esm/models/responseinputvideo.js +19 -0
  48. package/esm/models/responseoutputtext.d.ts +38 -0
  49. package/esm/models/responseoutputtext.js +50 -0
  50. package/esm/models/responsesoutputitemreasoning.d.ts +30 -1
  51. package/esm/models/responsesoutputitemreasoning.js +22 -0
  52. package/esm/models/responsesoutputmodality.d.ts +10 -0
  53. package/esm/models/responsesoutputmodality.js +12 -0
  54. package/esm/models/schema0.d.ts +3 -2
  55. package/esm/models/schema0.js +3 -2
  56. package/esm/models/schema3.d.ts +1 -0
  57. package/esm/models/schema3.js +1 -0
  58. package/jsr.json +1 -1
  59. package/package.json +1 -1
@@ -9,12 +9,15 @@ function createMockResponse(overrides) {
9
9
  id: "resp_test",
10
10
  object: "response",
11
11
  createdAt: Date.now(),
12
+ completedAt: Date.now(),
12
13
  model: "openai/gpt-4",
13
14
  status: "completed",
14
15
  error: null,
15
16
  incompleteDetails: null,
16
17
  temperature: null,
17
18
  topP: null,
19
+ presencePenalty: null,
20
+ frequencyPenalty: null,
18
21
  metadata: null,
19
22
  tools: [],
20
23
  toolChoice: "auto",
@@ -9,12 +9,15 @@ function createMockResponse(overrides) {
9
9
  id: "resp_test",
10
10
  object: "response",
11
11
  createdAt: Date.now(),
12
+ completedAt: Date.now(),
12
13
  model: "openai/gpt-4",
13
14
  status: "completed",
14
15
  error: null,
15
16
  incompleteDetails: null,
16
17
  temperature: null,
17
18
  topP: null,
19
+ presencePenalty: null,
20
+ frequencyPenalty: null,
18
21
  metadata: null,
19
22
  tools: [],
20
23
  toolChoice: "auto",
@@ -47,8 +47,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
47
47
  export declare const SDK_METADATA: {
48
48
  readonly language: "typescript";
49
49
  readonly openapiDocVersion: "1.0.0";
50
- readonly sdkVersion: "0.3.12";
50
+ readonly sdkVersion: "0.3.14";
51
51
  readonly genVersion: "2.788.4";
52
- readonly userAgent: "speakeasy-sdk/typescript 0.3.12 2.788.4 1.0.0 @openrouter/sdk";
52
+ readonly userAgent: "speakeasy-sdk/typescript 0.3.14 2.788.4 1.0.0 @openrouter/sdk";
53
53
  };
54
54
  //# 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.3.12",
29
+ sdkVersion: "0.3.14",
30
30
  genVersion: "2.788.4",
31
- userAgent: "speakeasy-sdk/typescript 0.3.12 2.788.4 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.3.14 2.788.4 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -237,7 +237,7 @@ export interface StepResult<TTools extends readonly Tool[] = readonly Tool[]> {
237
237
  readonly toolCalls: TypedToolCallUnion<TTools>[];
238
238
  readonly toolResults: ToolExecutionResultUnion<TTools>[];
239
239
  readonly response: models.OpenResponsesNonStreamingResponse;
240
- readonly usage?: models.OpenResponsesUsage | undefined;
240
+ readonly usage?: models.OpenResponsesUsage | null | undefined;
241
241
  readonly finishReason?: string | undefined;
242
242
  readonly warnings?: Warning[] | undefined;
243
243
  readonly experimental_providerMetadata?: Record<string, unknown> | undefined;
@@ -35,6 +35,20 @@ export type ChatGenerationParamsMaxPrice = {
35
35
  audio?: any | undefined;
36
36
  request?: any | undefined;
37
37
  };
38
+ export type ChatGenerationParamsPreferredMinThroughput = {
39
+ p50?: number | null | undefined;
40
+ p75?: number | null | undefined;
41
+ p90?: number | null | undefined;
42
+ p99?: number | null | undefined;
43
+ };
44
+ export type ChatGenerationParamsPreferredMinThroughputUnion = number | ChatGenerationParamsPreferredMinThroughput;
45
+ export type ChatGenerationParamsPreferredMaxLatency = {
46
+ p50?: number | null | undefined;
47
+ p75?: number | null | undefined;
48
+ p90?: number | null | undefined;
49
+ p99?: number | null | undefined;
50
+ };
51
+ export type ChatGenerationParamsPreferredMaxLatencyUnion = number | ChatGenerationParamsPreferredMaxLatency;
38
52
  export type ChatGenerationParamsProvider = {
39
53
  /**
40
54
  * Whether to allow backup providers to serve requests
@@ -83,10 +97,14 @@ export type ChatGenerationParamsProvider = {
83
97
  * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
84
98
  */
85
99
  maxPrice?: ChatGenerationParamsMaxPrice | undefined;
86
- preferredMinThroughput?: number | null | undefined;
87
- preferredMaxLatency?: number | null | undefined;
88
- minThroughput?: number | null | undefined;
89
- maxLatency?: number | null | undefined;
100
+ /**
101
+ * Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
102
+ */
103
+ preferredMinThroughput?: number | ChatGenerationParamsPreferredMinThroughput | null | undefined;
104
+ /**
105
+ * Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
106
+ */
107
+ preferredMaxLatency?: number | ChatGenerationParamsPreferredMaxLatency | null | undefined;
90
108
  };
91
109
  export type ChatGenerationParamsPluginResponseHealing = {
92
110
  id: "response-healing";
@@ -121,7 +139,12 @@ export type ChatGenerationParamsPluginWeb = {
121
139
  export type ChatGenerationParamsPluginModeration = {
122
140
  id: "moderation";
123
141
  };
124
- export type ChatGenerationParamsPluginUnion = ChatGenerationParamsPluginModeration | ChatGenerationParamsPluginWeb | ChatGenerationParamsPluginFileParser | ChatGenerationParamsPluginResponseHealing;
142
+ export type ChatGenerationParamsPluginAutoRouter = {
143
+ id: "auto-router";
144
+ enabled?: boolean | undefined;
145
+ allowedModels?: Array<string> | undefined;
146
+ };
147
+ export type ChatGenerationParamsPluginUnion = ChatGenerationParamsPluginAutoRouter | ChatGenerationParamsPluginModeration | ChatGenerationParamsPluginWeb | ChatGenerationParamsPluginFileParser | ChatGenerationParamsPluginResponseHealing;
125
148
  export declare const Route: {
126
149
  readonly Fallback: "fallback";
127
150
  readonly Sort: "sort";
@@ -154,6 +177,12 @@ export type ChatGenerationParamsStop = string | Array<string>;
154
177
  export type Debug = {
155
178
  echoUpstreamBody?: boolean | undefined;
156
179
  };
180
+ export type ChatGenerationParamsImageConfig = string | number;
181
+ export declare const Modality: {
182
+ readonly Text: "text";
183
+ readonly Image: "image";
184
+ };
185
+ export type Modality = OpenEnum<typeof Modality>;
157
186
  export type ChatGenerationParams = {
158
187
  /**
159
188
  * When multiple model providers are available, optionally indicate your routing preference.
@@ -162,7 +191,7 @@ export type ChatGenerationParams = {
162
191
  /**
163
192
  * Plugins you want to enable for this request, including their settings.
164
193
  */
165
- plugins?: Array<ChatGenerationParamsPluginModeration | ChatGenerationParamsPluginWeb | ChatGenerationParamsPluginFileParser | ChatGenerationParamsPluginResponseHealing> | undefined;
194
+ plugins?: Array<ChatGenerationParamsPluginAutoRouter | ChatGenerationParamsPluginModeration | ChatGenerationParamsPluginWeb | ChatGenerationParamsPluginFileParser | ChatGenerationParamsPluginResponseHealing> | undefined;
166
195
  route?: Route | null | undefined;
167
196
  user?: string | undefined;
168
197
  /**
@@ -195,6 +224,10 @@ export type ChatGenerationParams = {
195
224
  tools?: Array<ToolDefinitionJson> | undefined;
196
225
  topP?: number | null | undefined;
197
226
  debug?: Debug | undefined;
227
+ imageConfig?: {
228
+ [k: string]: string | number;
229
+ } | undefined;
230
+ modalities?: Array<Modality> | undefined;
198
231
  };
199
232
  /** @internal */
200
233
  export declare const ChatGenerationParamsDataCollection$outboundSchema: z.ZodType<string, ChatGenerationParamsDataCollection>;
@@ -212,6 +245,36 @@ export type ChatGenerationParamsMaxPrice$Outbound = {
212
245
  export declare const ChatGenerationParamsMaxPrice$outboundSchema: z.ZodType<ChatGenerationParamsMaxPrice$Outbound, ChatGenerationParamsMaxPrice>;
213
246
  export declare function chatGenerationParamsMaxPriceToJSON(chatGenerationParamsMaxPrice: ChatGenerationParamsMaxPrice): string;
214
247
  /** @internal */
248
+ export type ChatGenerationParamsPreferredMinThroughput$Outbound = {
249
+ p50?: number | null | undefined;
250
+ p75?: number | null | undefined;
251
+ p90?: number | null | undefined;
252
+ p99?: number | null | undefined;
253
+ };
254
+ /** @internal */
255
+ export declare const ChatGenerationParamsPreferredMinThroughput$outboundSchema: z.ZodType<ChatGenerationParamsPreferredMinThroughput$Outbound, ChatGenerationParamsPreferredMinThroughput>;
256
+ export declare function chatGenerationParamsPreferredMinThroughputToJSON(chatGenerationParamsPreferredMinThroughput: ChatGenerationParamsPreferredMinThroughput): string;
257
+ /** @internal */
258
+ export type ChatGenerationParamsPreferredMinThroughputUnion$Outbound = number | ChatGenerationParamsPreferredMinThroughput$Outbound;
259
+ /** @internal */
260
+ export declare const ChatGenerationParamsPreferredMinThroughputUnion$outboundSchema: z.ZodType<ChatGenerationParamsPreferredMinThroughputUnion$Outbound, ChatGenerationParamsPreferredMinThroughputUnion>;
261
+ export declare function chatGenerationParamsPreferredMinThroughputUnionToJSON(chatGenerationParamsPreferredMinThroughputUnion: ChatGenerationParamsPreferredMinThroughputUnion): string;
262
+ /** @internal */
263
+ export type ChatGenerationParamsPreferredMaxLatency$Outbound = {
264
+ p50?: number | null | undefined;
265
+ p75?: number | null | undefined;
266
+ p90?: number | null | undefined;
267
+ p99?: number | null | undefined;
268
+ };
269
+ /** @internal */
270
+ export declare const ChatGenerationParamsPreferredMaxLatency$outboundSchema: z.ZodType<ChatGenerationParamsPreferredMaxLatency$Outbound, ChatGenerationParamsPreferredMaxLatency>;
271
+ export declare function chatGenerationParamsPreferredMaxLatencyToJSON(chatGenerationParamsPreferredMaxLatency: ChatGenerationParamsPreferredMaxLatency): string;
272
+ /** @internal */
273
+ export type ChatGenerationParamsPreferredMaxLatencyUnion$Outbound = number | ChatGenerationParamsPreferredMaxLatency$Outbound;
274
+ /** @internal */
275
+ export declare const ChatGenerationParamsPreferredMaxLatencyUnion$outboundSchema: z.ZodType<ChatGenerationParamsPreferredMaxLatencyUnion$Outbound, ChatGenerationParamsPreferredMaxLatencyUnion>;
276
+ export declare function chatGenerationParamsPreferredMaxLatencyUnionToJSON(chatGenerationParamsPreferredMaxLatencyUnion: ChatGenerationParamsPreferredMaxLatencyUnion): string;
277
+ /** @internal */
215
278
  export type ChatGenerationParamsProvider$Outbound = {
216
279
  allow_fallbacks?: boolean | null | undefined;
217
280
  require_parameters?: boolean | null | undefined;
@@ -224,10 +287,8 @@ export type ChatGenerationParamsProvider$Outbound = {
224
287
  quantizations?: Array<string> | null | undefined;
225
288
  sort?: ProviderSortUnion$Outbound | null | undefined;
226
289
  max_price?: ChatGenerationParamsMaxPrice$Outbound | undefined;
227
- preferred_min_throughput?: number | null | undefined;
228
- preferred_max_latency?: number | null | undefined;
229
- min_throughput?: number | null | undefined;
230
- max_latency?: number | null | undefined;
290
+ preferred_min_throughput?: number | ChatGenerationParamsPreferredMinThroughput$Outbound | null | undefined;
291
+ preferred_max_latency?: number | ChatGenerationParamsPreferredMaxLatency$Outbound | null | undefined;
231
292
  };
232
293
  /** @internal */
233
294
  export declare const ChatGenerationParamsProvider$outboundSchema: z.ZodType<ChatGenerationParamsProvider$Outbound, ChatGenerationParamsProvider>;
@@ -279,7 +340,16 @@ export type ChatGenerationParamsPluginModeration$Outbound = {
279
340
  export declare const ChatGenerationParamsPluginModeration$outboundSchema: z.ZodType<ChatGenerationParamsPluginModeration$Outbound, ChatGenerationParamsPluginModeration>;
280
341
  export declare function chatGenerationParamsPluginModerationToJSON(chatGenerationParamsPluginModeration: ChatGenerationParamsPluginModeration): string;
281
342
  /** @internal */
282
- export type ChatGenerationParamsPluginUnion$Outbound = ChatGenerationParamsPluginModeration$Outbound | ChatGenerationParamsPluginWeb$Outbound | ChatGenerationParamsPluginFileParser$Outbound | ChatGenerationParamsPluginResponseHealing$Outbound;
343
+ export type ChatGenerationParamsPluginAutoRouter$Outbound = {
344
+ id: "auto-router";
345
+ enabled?: boolean | undefined;
346
+ allowed_models?: Array<string> | undefined;
347
+ };
348
+ /** @internal */
349
+ export declare const ChatGenerationParamsPluginAutoRouter$outboundSchema: z.ZodType<ChatGenerationParamsPluginAutoRouter$Outbound, ChatGenerationParamsPluginAutoRouter>;
350
+ export declare function chatGenerationParamsPluginAutoRouterToJSON(chatGenerationParamsPluginAutoRouter: ChatGenerationParamsPluginAutoRouter): string;
351
+ /** @internal */
352
+ export type ChatGenerationParamsPluginUnion$Outbound = ChatGenerationParamsPluginAutoRouter$Outbound | ChatGenerationParamsPluginModeration$Outbound | ChatGenerationParamsPluginWeb$Outbound | ChatGenerationParamsPluginFileParser$Outbound | ChatGenerationParamsPluginResponseHealing$Outbound;
283
353
  /** @internal */
284
354
  export declare const ChatGenerationParamsPluginUnion$outboundSchema: z.ZodType<ChatGenerationParamsPluginUnion$Outbound, ChatGenerationParamsPluginUnion>;
285
355
  export declare function chatGenerationParamsPluginUnionToJSON(chatGenerationParamsPluginUnion: ChatGenerationParamsPluginUnion): string;
@@ -334,9 +404,16 @@ export type Debug$Outbound = {
334
404
  export declare const Debug$outboundSchema: z.ZodType<Debug$Outbound, Debug>;
335
405
  export declare function debugToJSON(debug: Debug): string;
336
406
  /** @internal */
407
+ export type ChatGenerationParamsImageConfig$Outbound = string | number;
408
+ /** @internal */
409
+ export declare const ChatGenerationParamsImageConfig$outboundSchema: z.ZodType<ChatGenerationParamsImageConfig$Outbound, ChatGenerationParamsImageConfig>;
410
+ export declare function chatGenerationParamsImageConfigToJSON(chatGenerationParamsImageConfig: ChatGenerationParamsImageConfig): string;
411
+ /** @internal */
412
+ export declare const Modality$outboundSchema: z.ZodType<string, Modality>;
413
+ /** @internal */
337
414
  export type ChatGenerationParams$Outbound = {
338
415
  provider?: ChatGenerationParamsProvider$Outbound | null | undefined;
339
- plugins?: Array<ChatGenerationParamsPluginModeration$Outbound | ChatGenerationParamsPluginWeb$Outbound | ChatGenerationParamsPluginFileParser$Outbound | ChatGenerationParamsPluginResponseHealing$Outbound> | undefined;
416
+ plugins?: Array<ChatGenerationParamsPluginAutoRouter$Outbound | ChatGenerationParamsPluginModeration$Outbound | ChatGenerationParamsPluginWeb$Outbound | ChatGenerationParamsPluginFileParser$Outbound | ChatGenerationParamsPluginResponseHealing$Outbound> | undefined;
340
417
  route?: string | null | undefined;
341
418
  user?: string | undefined;
342
419
  session_id?: string | undefined;
@@ -366,6 +443,10 @@ export type ChatGenerationParams$Outbound = {
366
443
  tools?: Array<ToolDefinitionJson$Outbound> | undefined;
367
444
  top_p?: number | null | undefined;
368
445
  debug?: Debug$Outbound | undefined;
446
+ image_config?: {
447
+ [k: string]: string | number;
448
+ } | undefined;
449
+ modalities?: Array<string> | undefined;
369
450
  };
370
451
  /** @internal */
371
452
  export declare const ChatGenerationParams$outboundSchema: z.ZodType<ChatGenerationParams$Outbound, ChatGenerationParams>;
@@ -49,6 +49,10 @@ export const Effort = {
49
49
  Minimal: "minimal",
50
50
  None: "none",
51
51
  };
52
+ export const Modality = {
53
+ Text: "text",
54
+ Image: "image",
55
+ };
52
56
  /** @internal */
53
57
  export const ChatGenerationParamsDataCollection$outboundSchema = openEnums.outboundSchema(ChatGenerationParamsDataCollection);
54
58
  /** @internal */
@@ -65,6 +69,42 @@ export function chatGenerationParamsMaxPriceToJSON(chatGenerationParamsMaxPrice)
65
69
  return JSON.stringify(ChatGenerationParamsMaxPrice$outboundSchema.parse(chatGenerationParamsMaxPrice));
66
70
  }
67
71
  /** @internal */
72
+ export const ChatGenerationParamsPreferredMinThroughput$outboundSchema = z.object({
73
+ p50: z.nullable(z.number()).optional(),
74
+ p75: z.nullable(z.number()).optional(),
75
+ p90: z.nullable(z.number()).optional(),
76
+ p99: z.nullable(z.number()).optional(),
77
+ });
78
+ export function chatGenerationParamsPreferredMinThroughputToJSON(chatGenerationParamsPreferredMinThroughput) {
79
+ return JSON.stringify(ChatGenerationParamsPreferredMinThroughput$outboundSchema.parse(chatGenerationParamsPreferredMinThroughput));
80
+ }
81
+ /** @internal */
82
+ export const ChatGenerationParamsPreferredMinThroughputUnion$outboundSchema = z.union([
83
+ z.number(),
84
+ z.lazy(() => ChatGenerationParamsPreferredMinThroughput$outboundSchema),
85
+ ]);
86
+ export function chatGenerationParamsPreferredMinThroughputUnionToJSON(chatGenerationParamsPreferredMinThroughputUnion) {
87
+ return JSON.stringify(ChatGenerationParamsPreferredMinThroughputUnion$outboundSchema.parse(chatGenerationParamsPreferredMinThroughputUnion));
88
+ }
89
+ /** @internal */
90
+ export const ChatGenerationParamsPreferredMaxLatency$outboundSchema = z.object({
91
+ p50: z.nullable(z.number()).optional(),
92
+ p75: z.nullable(z.number()).optional(),
93
+ p90: z.nullable(z.number()).optional(),
94
+ p99: z.nullable(z.number()).optional(),
95
+ });
96
+ export function chatGenerationParamsPreferredMaxLatencyToJSON(chatGenerationParamsPreferredMaxLatency) {
97
+ return JSON.stringify(ChatGenerationParamsPreferredMaxLatency$outboundSchema.parse(chatGenerationParamsPreferredMaxLatency));
98
+ }
99
+ /** @internal */
100
+ export const ChatGenerationParamsPreferredMaxLatencyUnion$outboundSchema = z.union([
101
+ z.number(),
102
+ z.lazy(() => ChatGenerationParamsPreferredMaxLatency$outboundSchema),
103
+ ]);
104
+ export function chatGenerationParamsPreferredMaxLatencyUnionToJSON(chatGenerationParamsPreferredMaxLatencyUnion) {
105
+ return JSON.stringify(ChatGenerationParamsPreferredMaxLatencyUnion$outboundSchema.parse(chatGenerationParamsPreferredMaxLatencyUnion));
106
+ }
107
+ /** @internal */
68
108
  export const ChatGenerationParamsProvider$outboundSchema = z.object({
69
109
  allowFallbacks: z.nullable(z.boolean()).optional(),
70
110
  requireParameters: z.nullable(z.boolean()).optional(),
@@ -79,10 +119,14 @@ export const ChatGenerationParamsProvider$outboundSchema = z.object({
79
119
  sort: z.nullable(ProviderSortUnion$outboundSchema).optional(),
80
120
  maxPrice: z.lazy(() => ChatGenerationParamsMaxPrice$outboundSchema)
81
121
  .optional(),
82
- preferredMinThroughput: z.nullable(z.number()).optional(),
83
- preferredMaxLatency: z.nullable(z.number()).optional(),
84
- minThroughput: z.nullable(z.number()).optional(),
85
- maxLatency: z.nullable(z.number()).optional(),
122
+ preferredMinThroughput: z.nullable(z.union([
123
+ z.number(),
124
+ z.lazy(() => ChatGenerationParamsPreferredMinThroughput$outboundSchema),
125
+ ])).optional(),
126
+ preferredMaxLatency: z.nullable(z.union([
127
+ z.number(),
128
+ z.lazy(() => ChatGenerationParamsPreferredMaxLatency$outboundSchema),
129
+ ])).optional(),
86
130
  }).transform((v) => {
87
131
  return remap$(v, {
88
132
  allowFallbacks: "allow_fallbacks",
@@ -92,8 +136,6 @@ export const ChatGenerationParamsProvider$outboundSchema = z.object({
92
136
  maxPrice: "max_price",
93
137
  preferredMinThroughput: "preferred_min_throughput",
94
138
  preferredMaxLatency: "preferred_max_latency",
95
- minThroughput: "min_throughput",
96
- maxLatency: "max_latency",
97
139
  });
98
140
  });
99
141
  export function chatGenerationParamsProviderToJSON(chatGenerationParamsProvider) {
@@ -153,7 +195,21 @@ export function chatGenerationParamsPluginModerationToJSON(chatGenerationParamsP
153
195
  return JSON.stringify(ChatGenerationParamsPluginModeration$outboundSchema.parse(chatGenerationParamsPluginModeration));
154
196
  }
155
197
  /** @internal */
198
+ export const ChatGenerationParamsPluginAutoRouter$outboundSchema = z.object({
199
+ id: z.literal("auto-router"),
200
+ enabled: z.boolean().optional(),
201
+ allowedModels: z.array(z.string()).optional(),
202
+ }).transform((v) => {
203
+ return remap$(v, {
204
+ allowedModels: "allowed_models",
205
+ });
206
+ });
207
+ export function chatGenerationParamsPluginAutoRouterToJSON(chatGenerationParamsPluginAutoRouter) {
208
+ return JSON.stringify(ChatGenerationParamsPluginAutoRouter$outboundSchema.parse(chatGenerationParamsPluginAutoRouter));
209
+ }
210
+ /** @internal */
156
211
  export const ChatGenerationParamsPluginUnion$outboundSchema = z.union([
212
+ z.lazy(() => ChatGenerationParamsPluginAutoRouter$outboundSchema),
157
213
  z.lazy(() => ChatGenerationParamsPluginModeration$outboundSchema),
158
214
  z.lazy(() => ChatGenerationParamsPluginWeb$outboundSchema),
159
215
  z.lazy(() => ChatGenerationParamsPluginFileParser$outboundSchema),
@@ -225,9 +281,18 @@ export function debugToJSON(debug) {
225
281
  return JSON.stringify(Debug$outboundSchema.parse(debug));
226
282
  }
227
283
  /** @internal */
284
+ export const ChatGenerationParamsImageConfig$outboundSchema = z.union([z.string(), z.number()]);
285
+ export function chatGenerationParamsImageConfigToJSON(chatGenerationParamsImageConfig) {
286
+ return JSON.stringify(ChatGenerationParamsImageConfig$outboundSchema.parse(chatGenerationParamsImageConfig));
287
+ }
288
+ /** @internal */
289
+ export const Modality$outboundSchema = openEnums
290
+ .outboundSchema(Modality);
291
+ /** @internal */
228
292
  export const ChatGenerationParams$outboundSchema = z.object({
229
293
  provider: z.nullable(z.lazy(() => ChatGenerationParamsProvider$outboundSchema)).optional(),
230
294
  plugins: z.array(z.union([
295
+ z.lazy(() => ChatGenerationParamsPluginAutoRouter$outboundSchema),
231
296
  z.lazy(() => ChatGenerationParamsPluginModeration$outboundSchema),
232
297
  z.lazy(() => ChatGenerationParamsPluginWeb$outboundSchema),
233
298
  z.lazy(() => ChatGenerationParamsPluginFileParser$outboundSchema),
@@ -264,6 +329,9 @@ export const ChatGenerationParams$outboundSchema = z.object({
264
329
  tools: z.array(ToolDefinitionJson$outboundSchema).optional(),
265
330
  topP: z.nullable(z.number()).optional(),
266
331
  debug: z.lazy(() => Debug$outboundSchema).optional(),
332
+ imageConfig: z.record(z.string(), z.union([z.string(), z.number()]))
333
+ .optional(),
334
+ modalities: z.array(Modality$outboundSchema).optional(),
267
335
  }).transform((v) => {
268
336
  return remap$(v, {
269
337
  sessionId: "session_id",
@@ -277,6 +345,7 @@ export const ChatGenerationParams$outboundSchema = z.object({
277
345
  streamOptions: "stream_options",
278
346
  toolChoice: "tool_choice",
279
347
  topP: "top_p",
348
+ imageConfig: "image_config",
280
349
  });
281
350
  });
282
351
  export function chatGenerationParamsToJSON(chatGenerationParams) {
@@ -9,6 +9,7 @@ export type CompletionTokensDetails = {
9
9
  };
10
10
  export type PromptTokensDetails = {
11
11
  cachedTokens?: number | undefined;
12
+ cacheWriteTokens?: number | undefined;
12
13
  audioTokens?: number | undefined;
13
14
  videoTokens?: number | undefined;
14
15
  };
@@ -25,11 +25,13 @@ export function completionTokensDetailsFromJSON(jsonString) {
25
25
  /** @internal */
26
26
  export const PromptTokensDetails$inboundSchema = z.object({
27
27
  cached_tokens: z.number().optional(),
28
+ cache_write_tokens: z.number().optional(),
28
29
  audio_tokens: z.number().optional(),
29
30
  video_tokens: z.number().optional(),
30
31
  }).transform((v) => {
31
32
  return remap$(v, {
32
33
  "cached_tokens": "cachedTokens",
34
+ "cache_write_tokens": "cacheWriteTokens",
33
35
  "audio_tokens": "audioTokens",
34
36
  "video_tokens": "videoTokens",
35
37
  });
@@ -1,7 +1,7 @@
1
1
  import * as z from "zod/v4";
2
2
  import { Result as SafeParseResult } from "../types/fp.js";
3
3
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
- export type TopLogprob = {
4
+ export type ChatMessageTokenLogprobTopLogprob = {
5
5
  token: string;
6
6
  logprob: number;
7
7
  bytes: Array<number> | null;
@@ -10,11 +10,11 @@ export type ChatMessageTokenLogprob = {
10
10
  token: string;
11
11
  logprob: number;
12
12
  bytes: Array<number> | null;
13
- topLogprobs: Array<TopLogprob>;
13
+ topLogprobs: Array<ChatMessageTokenLogprobTopLogprob>;
14
14
  };
15
15
  /** @internal */
16
- export declare const TopLogprob$inboundSchema: z.ZodType<TopLogprob, unknown>;
17
- export declare function topLogprobFromJSON(jsonString: string): SafeParseResult<TopLogprob, SDKValidationError>;
16
+ export declare const ChatMessageTokenLogprobTopLogprob$inboundSchema: z.ZodType<ChatMessageTokenLogprobTopLogprob, unknown>;
17
+ export declare function chatMessageTokenLogprobTopLogprobFromJSON(jsonString: string): SafeParseResult<ChatMessageTokenLogprobTopLogprob, SDKValidationError>;
18
18
  /** @internal */
19
19
  export declare const ChatMessageTokenLogprob$inboundSchema: z.ZodType<ChatMessageTokenLogprob, unknown>;
20
20
  export declare function chatMessageTokenLogprobFromJSON(jsonString: string): SafeParseResult<ChatMessageTokenLogprob, SDKValidationError>;
@@ -6,21 +6,20 @@ import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
7
  import { safeParse } from "../lib/schemas.js";
8
8
  /** @internal */
9
- export const TopLogprob$inboundSchema = z
10
- .object({
9
+ export const ChatMessageTokenLogprobTopLogprob$inboundSchema = z.object({
11
10
  token: z.string(),
12
11
  logprob: z.number(),
13
12
  bytes: z.nullable(z.array(z.number())),
14
13
  });
15
- export function topLogprobFromJSON(jsonString) {
16
- return safeParse(jsonString, (x) => TopLogprob$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TopLogprob' from JSON`);
14
+ export function chatMessageTokenLogprobTopLogprobFromJSON(jsonString) {
15
+ return safeParse(jsonString, (x) => ChatMessageTokenLogprobTopLogprob$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageTokenLogprobTopLogprob' from JSON`);
17
16
  }
18
17
  /** @internal */
19
18
  export const ChatMessageTokenLogprob$inboundSchema = z.object({
20
19
  token: z.string(),
21
20
  logprob: z.number(),
22
21
  bytes: z.nullable(z.array(z.number())),
23
- top_logprobs: z.array(z.lazy(() => TopLogprob$inboundSchema)),
22
+ top_logprobs: z.array(z.lazy(() => ChatMessageTokenLogprobTopLogprob$inboundSchema)),
24
23
  }).transform((v) => {
25
24
  return remap$(v, {
26
25
  "top_logprobs": "topLogprobs",
@@ -97,7 +97,12 @@ export * from "./payloadtoolargeresponseerrordata.js";
97
97
  export * from "./paymentrequiredresponseerrordata.js";
98
98
  export * from "./pdfparserengine.js";
99
99
  export * from "./pdfparseroptions.js";
100
+ export * from "./percentilelatencycutoffs.js";
101
+ export * from "./percentilestats.js";
102
+ export * from "./percentilethroughputcutoffs.js";
100
103
  export * from "./perrequestlimits.js";
104
+ export * from "./preferredmaxlatency.js";
105
+ export * from "./preferredminthroughput.js";
101
106
  export * from "./providername.js";
102
107
  export * from "./provideroverloadedresponseerrordata.js";
103
108
  export * from "./providerpreferences.js";
@@ -118,6 +123,7 @@ export * from "./responseinputaudio.js";
118
123
  export * from "./responseinputfile.js";
119
124
  export * from "./responseinputimage.js";
120
125
  export * from "./responseinputtext.js";
126
+ export * from "./responseinputvideo.js";
121
127
  export * from "./responseoutputtext.js";
122
128
  export * from "./responseserrorfield.js";
123
129
  export * from "./responsesformatjsonobject.js";
@@ -129,6 +135,7 @@ export * from "./responsesoutputitemfilesearchcall.js";
129
135
  export * from "./responsesoutputitemfunctioncall.js";
130
136
  export * from "./responsesoutputitemreasoning.js";
131
137
  export * from "./responsesoutputmessage.js";
138
+ export * from "./responsesoutputmodality.js";
132
139
  export * from "./responsessearchcontextsize.js";
133
140
  export * from "./responseswebsearchcalloutput.js";
134
141
  export * from "./responseswebsearchuserlocation.js";
@@ -101,7 +101,12 @@ export * from "./payloadtoolargeresponseerrordata.js";
101
101
  export * from "./paymentrequiredresponseerrordata.js";
102
102
  export * from "./pdfparserengine.js";
103
103
  export * from "./pdfparseroptions.js";
104
+ export * from "./percentilelatencycutoffs.js";
105
+ export * from "./percentilestats.js";
106
+ export * from "./percentilethroughputcutoffs.js";
104
107
  export * from "./perrequestlimits.js";
108
+ export * from "./preferredmaxlatency.js";
109
+ export * from "./preferredminthroughput.js";
105
110
  export * from "./providername.js";
106
111
  export * from "./provideroverloadedresponseerrordata.js";
107
112
  export * from "./providerpreferences.js";
@@ -122,6 +127,7 @@ export * from "./responseinputaudio.js";
122
127
  export * from "./responseinputfile.js";
123
128
  export * from "./responseinputimage.js";
124
129
  export * from "./responseinputtext.js";
130
+ export * from "./responseinputvideo.js";
125
131
  export * from "./responseoutputtext.js";
126
132
  export * from "./responseserrorfield.js";
127
133
  export * from "./responsesformatjsonobject.js";
@@ -133,6 +139,7 @@ export * from "./responsesoutputitemfilesearchcall.js";
133
139
  export * from "./responsesoutputitemfunctioncall.js";
134
140
  export * from "./responsesoutputitemreasoning.js";
135
141
  export * from "./responsesoutputmessage.js";
142
+ export * from "./responsesoutputmodality.js";
136
143
  export * from "./responsessearchcontextsize.js";
137
144
  export * from "./responseswebsearchcalloutput.js";
138
145
  export * from "./responseswebsearchuserlocation.js";
@@ -49,12 +49,16 @@ export declare const OpenAIResponsesInputRoleUser2: {
49
49
  };
50
50
  export type OpenAIResponsesInputRoleUser2 = ClosedEnum<typeof OpenAIResponsesInputRoleUser2>;
51
51
  export type OpenAIResponsesInputRoleUnion2 = OpenAIResponsesInputRoleUser2 | OpenAIResponsesInputRoleSystem2 | OpenAIResponsesInputRoleDeveloper2;
52
- export type OpenAIResponsesInputContent3 = ResponseInputText | ResponseInputImage | ResponseInputFile | ResponseInputAudio;
52
+ export type OpenAIResponsesInputContent3 = ResponseInputText | (ResponseInputImage & {
53
+ type: "input_image";
54
+ }) | ResponseInputFile | ResponseInputAudio;
53
55
  export type OpenAIResponsesInputMessage2 = {
54
56
  id: string;
55
57
  type?: OpenAIResponsesInputTypeMessage2 | undefined;
56
58
  role: OpenAIResponsesInputRoleUser2 | OpenAIResponsesInputRoleSystem2 | OpenAIResponsesInputRoleDeveloper2;
57
- content: Array<ResponseInputText | ResponseInputImage | ResponseInputFile | ResponseInputAudio>;
59
+ content: Array<ResponseInputText | (ResponseInputImage & {
60
+ type: "input_image";
61
+ }) | ResponseInputFile | ResponseInputAudio>;
58
62
  };
59
63
  export declare const OpenAIResponsesInputTypeMessage1: {
60
64
  readonly Message: "message";
@@ -77,12 +81,18 @@ export declare const OpenAIResponsesInputRoleUser1: {
77
81
  };
78
82
  export type OpenAIResponsesInputRoleUser1 = ClosedEnum<typeof OpenAIResponsesInputRoleUser1>;
79
83
  export type OpenAIResponsesInputRoleUnion1 = OpenAIResponsesInputRoleUser1 | OpenAIResponsesInputRoleSystem1 | OpenAIResponsesInputRoleAssistant | OpenAIResponsesInputRoleDeveloper1;
80
- export type OpenAIResponsesInputContent1 = ResponseInputText | ResponseInputImage | ResponseInputFile | ResponseInputAudio;
81
- export type OpenAIResponsesInputContent2 = Array<ResponseInputText | ResponseInputImage | ResponseInputFile | ResponseInputAudio> | string;
84
+ export type OpenAIResponsesInputContent1 = ResponseInputText | (ResponseInputImage & {
85
+ type: "input_image";
86
+ }) | ResponseInputFile | ResponseInputAudio;
87
+ export type OpenAIResponsesInputContent2 = Array<ResponseInputText | (ResponseInputImage & {
88
+ type: "input_image";
89
+ }) | ResponseInputFile | ResponseInputAudio> | string;
82
90
  export type OpenAIResponsesInputMessage1 = {
83
91
  type?: OpenAIResponsesInputTypeMessage1 | undefined;
84
92
  role: OpenAIResponsesInputRoleUser1 | OpenAIResponsesInputRoleSystem1 | OpenAIResponsesInputRoleAssistant | OpenAIResponsesInputRoleDeveloper1;
85
- content: Array<ResponseInputText | ResponseInputImage | ResponseInputFile | ResponseInputAudio> | string;
93
+ content: Array<ResponseInputText | (ResponseInputImage & {
94
+ type: "input_image";
95
+ }) | ResponseInputFile | ResponseInputAudio> | string;
86
96
  };
87
97
  export type OpenAIResponsesInputUnion1 = OpenAIResponsesInputFunctionCall | OutputMessage | OpenAIResponsesInputMessage2 | OpenAIResponsesInputFunctionCallOutput | OutputItemImageGenerationCall | OpenAIResponsesInputMessage1;
88
98
  export type OpenAIResponsesInputUnion = string | Array<OpenAIResponsesInputFunctionCall | OutputMessage | OpenAIResponsesInputMessage2 | OpenAIResponsesInputFunctionCallOutput | OutputItemImageGenerationCall | OpenAIResponsesInputMessage1> | any;
@@ -100,7 +100,7 @@ export function openAIResponsesInputRoleUnion2FromJSON(jsonString) {
100
100
  /** @internal */
101
101
  export const OpenAIResponsesInputContent3$inboundSchema = z.union([
102
102
  ResponseInputText$inboundSchema,
103
- ResponseInputImage$inboundSchema,
103
+ ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
104
104
  ResponseInputFile$inboundSchema,
105
105
  ResponseInputAudio$inboundSchema,
106
106
  ]);
@@ -118,7 +118,7 @@ export const OpenAIResponsesInputMessage2$inboundSchema = z.object({
118
118
  ]),
119
119
  content: z.array(z.union([
120
120
  ResponseInputText$inboundSchema,
121
- ResponseInputImage$inboundSchema,
121
+ ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
122
122
  ResponseInputFile$inboundSchema,
123
123
  ResponseInputAudio$inboundSchema,
124
124
  ])),
@@ -149,7 +149,7 @@ export function openAIResponsesInputRoleUnion1FromJSON(jsonString) {
149
149
  /** @internal */
150
150
  export const OpenAIResponsesInputContent1$inboundSchema = z.union([
151
151
  ResponseInputText$inboundSchema,
152
- ResponseInputImage$inboundSchema,
152
+ ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
153
153
  ResponseInputFile$inboundSchema,
154
154
  ResponseInputAudio$inboundSchema,
155
155
  ]);
@@ -160,7 +160,7 @@ export function openAIResponsesInputContent1FromJSON(jsonString) {
160
160
  export const OpenAIResponsesInputContent2$inboundSchema = z.union([
161
161
  z.array(z.union([
162
162
  ResponseInputText$inboundSchema,
163
- ResponseInputImage$inboundSchema,
163
+ ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
164
164
  ResponseInputFile$inboundSchema,
165
165
  ResponseInputAudio$inboundSchema,
166
166
  ])),
@@ -181,7 +181,7 @@ export const OpenAIResponsesInputMessage1$inboundSchema = z.object({
181
181
  content: z.union([
182
182
  z.array(z.union([
183
183
  ResponseInputText$inboundSchema,
184
- ResponseInputImage$inboundSchema,
184
+ ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
185
185
  ResponseInputFile$inboundSchema,
186
186
  ResponseInputAudio$inboundSchema,
187
187
  ])),