@openrouter/sdk 0.3.11 → 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 (70) hide show
  1. package/esm/index.d.ts +1 -0
  2. package/esm/index.js +2 -0
  3. package/esm/lib/anthropic-compat.test.js +3 -0
  4. package/esm/lib/chat-compat.test.js +3 -0
  5. package/esm/lib/config.d.ts +2 -2
  6. package/esm/lib/config.js +2 -2
  7. package/esm/lib/model-result.d.ts +8 -3
  8. package/esm/lib/model-result.js +57 -35
  9. package/esm/lib/tool-event-broadcaster.d.ts +44 -0
  10. package/esm/lib/tool-event-broadcaster.js +146 -0
  11. package/esm/lib/tool-executor.d.ts +21 -6
  12. package/esm/lib/tool-executor.js +57 -8
  13. package/esm/lib/tool-types.d.ts +18 -18
  14. package/esm/lib/tool.d.ts +16 -16
  15. package/esm/models/chatgenerationparams.d.ts +93 -12
  16. package/esm/models/chatgenerationparams.js +75 -6
  17. package/esm/models/chatgenerationtokenusage.d.ts +1 -0
  18. package/esm/models/chatgenerationtokenusage.js +2 -0
  19. package/esm/models/chatmessagetokenlogprob.d.ts +4 -4
  20. package/esm/models/chatmessagetokenlogprob.js +4 -5
  21. package/esm/models/index.d.ts +7 -0
  22. package/esm/models/index.js +7 -0
  23. package/esm/models/openairesponsesinputunion.d.ts +15 -5
  24. package/esm/models/openairesponsesinputunion.js +5 -5
  25. package/esm/models/openresponseseasyinputmessage.d.ts +41 -16
  26. package/esm/models/openresponseseasyinputmessage.js +38 -13
  27. package/esm/models/openresponsesinputmessageitem.d.ts +37 -12
  28. package/esm/models/openresponsesinputmessageitem.js +33 -9
  29. package/esm/models/openresponsesnonstreamingresponse.d.ts +5 -2
  30. package/esm/models/openresponsesnonstreamingresponse.js +8 -2
  31. package/esm/models/openresponsesreasoning.d.ts +1 -0
  32. package/esm/models/openresponsesreasoning.js +1 -0
  33. package/esm/models/openresponsesrequest.d.ts +61 -24
  34. package/esm/models/openresponsesrequest.js +39 -6
  35. package/esm/models/operations/getgeneration.d.ts +4 -0
  36. package/esm/models/operations/getgeneration.js +1 -0
  37. package/esm/models/percentilelatencycutoffs.d.ts +33 -0
  38. package/esm/models/percentilelatencycutoffs.js +16 -0
  39. package/esm/models/percentilestats.d.ts +28 -0
  40. package/esm/models/percentilestats.js +17 -0
  41. package/esm/models/percentilethroughputcutoffs.d.ts +33 -0
  42. package/esm/models/percentilethroughputcutoffs.js +16 -0
  43. package/esm/models/preferredmaxlatency.d.ts +12 -0
  44. package/esm/models/preferredmaxlatency.js +12 -0
  45. package/esm/models/preferredminthroughput.d.ts +12 -0
  46. package/esm/models/preferredminthroughput.js +12 -0
  47. package/esm/models/providername.d.ts +3 -2
  48. package/esm/models/providername.js +3 -2
  49. package/esm/models/providerpreferences.d.ts +8 -20
  50. package/esm/models/providerpreferences.js +6 -6
  51. package/esm/models/publicendpoint.d.ts +6 -0
  52. package/esm/models/publicendpoint.js +5 -0
  53. package/esm/models/responseinputimage.d.ts +11 -3
  54. package/esm/models/responseinputimage.js +9 -2
  55. package/esm/models/responseinputvideo.d.ts +20 -0
  56. package/esm/models/responseinputvideo.js +19 -0
  57. package/esm/models/responseoutputtext.d.ts +38 -0
  58. package/esm/models/responseoutputtext.js +50 -0
  59. package/esm/models/responsesoutputitemreasoning.d.ts +30 -1
  60. package/esm/models/responsesoutputitemreasoning.js +22 -0
  61. package/esm/models/responsesoutputmodality.d.ts +10 -0
  62. package/esm/models/responsesoutputmodality.js +12 -0
  63. package/esm/models/schema0.d.ts +3 -2
  64. package/esm/models/schema0.js +3 -2
  65. package/esm/models/schema3.d.ts +1 -0
  66. package/esm/models/schema3.js +1 -0
  67. package/jsr.json +1 -1
  68. package/package.json +6 -7
  69. package/vitest.config.ts +25 -16
  70. package/.zed/settings.json +0 -10
@@ -12,10 +12,13 @@ import { OpenResponsesWebSearchPreview20250311Tool, OpenResponsesWebSearchPrevie
12
12
  import { OpenResponsesWebSearchPreviewTool, OpenResponsesWebSearchPreviewTool$Outbound } from "./openresponseswebsearchpreviewtool.js";
13
13
  import { OpenResponsesWebSearchTool, OpenResponsesWebSearchTool$Outbound } from "./openresponseswebsearchtool.js";
14
14
  import { PDFParserOptions, PDFParserOptions$Outbound } from "./pdfparseroptions.js";
15
+ import { PreferredMaxLatency, PreferredMaxLatency$Outbound } from "./preferredmaxlatency.js";
16
+ import { PreferredMinThroughput, PreferredMinThroughput$Outbound } from "./preferredminthroughput.js";
15
17
  import { ProviderName } from "./providername.js";
16
18
  import { ProviderSort } from "./providersort.js";
17
19
  import { ProviderSortConfig, ProviderSortConfig$Outbound } from "./providersortconfig.js";
18
20
  import { Quantization } from "./quantization.js";
21
+ import { ResponsesOutputModality } from "./responsesoutputmodality.js";
19
22
  import { WebSearchEngine } from "./websearchengine.js";
20
23
  /**
21
24
  * Function tool definition
@@ -30,6 +33,7 @@ export type OpenResponsesRequestToolFunction = {
30
33
  } | null;
31
34
  };
32
35
  export type OpenResponsesRequestToolUnion = OpenResponsesRequestToolFunction | OpenResponsesWebSearchPreviewTool | OpenResponsesWebSearchPreview20250311Tool | OpenResponsesWebSearchTool | OpenResponsesWebSearch20250826Tool;
36
+ export type OpenResponsesRequestImageConfig = string | number;
33
37
  export declare const ServiceTier: {
34
38
  readonly Auto: "auto";
35
39
  };
@@ -129,25 +133,13 @@ export type OpenResponsesRequestProvider = {
129
133
  */
130
134
  maxPrice?: OpenResponsesRequestMaxPrice | undefined;
131
135
  /**
132
- * Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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.
136
+ * 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.
133
137
  */
134
- preferredMinThroughput?: number | null | undefined;
138
+ preferredMinThroughput?: PreferredMinThroughput | null | undefined;
135
139
  /**
136
- * Preferred maximum latency (in seconds). Endpoints above this threshold 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.
140
+ * 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.
137
141
  */
138
- preferredMaxLatency?: number | null | undefined;
139
- /**
140
- * **DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput.
141
- *
142
- * @deprecated field: Use preferred_min_throughput instead..
143
- */
144
- minThroughput?: number | null | undefined;
145
- /**
146
- * **DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency.
147
- *
148
- * @deprecated field: Use preferred_max_latency instead..
149
- */
150
- maxLatency?: number | null | undefined;
142
+ preferredMaxLatency?: PreferredMaxLatency | null | undefined;
151
143
  };
152
144
  export type OpenResponsesRequestPluginResponseHealing = {
153
145
  id: "response-healing";
@@ -183,7 +175,18 @@ export type OpenResponsesRequestPluginWeb = {
183
175
  export type OpenResponsesRequestPluginModeration = {
184
176
  id: "moderation";
185
177
  };
186
- export type OpenResponsesRequestPluginUnion = OpenResponsesRequestPluginModeration | OpenResponsesRequestPluginWeb | OpenResponsesRequestPluginFileParser | OpenResponsesRequestPluginResponseHealing;
178
+ export type OpenResponsesRequestPluginAutoRouter = {
179
+ id: "auto-router";
180
+ /**
181
+ * Set to false to disable the auto-router plugin for this request. Defaults to true.
182
+ */
183
+ enabled?: boolean | undefined;
184
+ /**
185
+ * List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list.
186
+ */
187
+ allowedModels?: Array<string> | undefined;
188
+ };
189
+ export type OpenResponsesRequestPluginUnion = OpenResponsesRequestPluginAutoRouter | OpenResponsesRequestPluginModeration | OpenResponsesRequestPluginWeb | OpenResponsesRequestPluginFileParser | OpenResponsesRequestPluginResponseHealing;
187
190
  /**
188
191
  * Request schema for Responses endpoint
189
192
  */
@@ -215,7 +218,21 @@ export type OpenResponsesRequest = {
215
218
  maxOutputTokens?: number | null | undefined;
216
219
  temperature?: number | null | undefined;
217
220
  topP?: number | null | undefined;
221
+ topLogprobs?: number | null | undefined;
222
+ maxToolCalls?: number | null | undefined;
223
+ presencePenalty?: number | null | undefined;
224
+ frequencyPenalty?: number | null | undefined;
218
225
  topK?: number | undefined;
226
+ /**
227
+ * Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details.
228
+ */
229
+ imageConfig?: {
230
+ [k: string]: string | number;
231
+ } | undefined;
232
+ /**
233
+ * Output modalities for the response. Supported values are "text" and "image".
234
+ */
235
+ modalities?: Array<ResponsesOutputModality> | undefined;
219
236
  promptCacheKey?: string | null | undefined;
220
237
  previousResponseId?: string | null | undefined;
221
238
  prompt?: OpenAIResponsesPrompt | null | undefined;
@@ -233,7 +250,7 @@ export type OpenResponsesRequest = {
233
250
  /**
234
251
  * Plugins you want to enable for this request, including their settings.
235
252
  */
236
- plugins?: Array<OpenResponsesRequestPluginModeration | OpenResponsesRequestPluginWeb | OpenResponsesRequestPluginFileParser | OpenResponsesRequestPluginResponseHealing> | undefined;
253
+ plugins?: Array<OpenResponsesRequestPluginAutoRouter | OpenResponsesRequestPluginModeration | OpenResponsesRequestPluginWeb | OpenResponsesRequestPluginFileParser | OpenResponsesRequestPluginResponseHealing> | undefined;
237
254
  /**
238
255
  * A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
239
256
  */
@@ -262,6 +279,11 @@ export type OpenResponsesRequestToolUnion$Outbound = OpenResponsesRequestToolFun
262
279
  export declare const OpenResponsesRequestToolUnion$outboundSchema: z.ZodType<OpenResponsesRequestToolUnion$Outbound, OpenResponsesRequestToolUnion>;
263
280
  export declare function openResponsesRequestToolUnionToJSON(openResponsesRequestToolUnion: OpenResponsesRequestToolUnion): string;
264
281
  /** @internal */
282
+ export type OpenResponsesRequestImageConfig$Outbound = string | number;
283
+ /** @internal */
284
+ export declare const OpenResponsesRequestImageConfig$outboundSchema: z.ZodType<OpenResponsesRequestImageConfig$Outbound, OpenResponsesRequestImageConfig>;
285
+ export declare function openResponsesRequestImageConfigToJSON(openResponsesRequestImageConfig: OpenResponsesRequestImageConfig): string;
286
+ /** @internal */
265
287
  export declare const ServiceTier$outboundSchema: z.ZodEnum<typeof ServiceTier>;
266
288
  /** @internal */
267
289
  export declare const Truncation$outboundSchema: z.ZodType<string, Truncation>;
@@ -309,10 +331,8 @@ export type OpenResponsesRequestProvider$Outbound = {
309
331
  quantizations?: Array<string> | null | undefined;
310
332
  sort?: string | ProviderSortConfig$Outbound | any | null | undefined;
311
333
  max_price?: OpenResponsesRequestMaxPrice$Outbound | undefined;
312
- preferred_min_throughput?: number | null | undefined;
313
- preferred_max_latency?: number | null | undefined;
314
- min_throughput?: number | null | undefined;
315
- max_latency?: number | null | undefined;
334
+ preferred_min_throughput?: PreferredMinThroughput$Outbound | null | undefined;
335
+ preferred_max_latency?: PreferredMaxLatency$Outbound | null | undefined;
316
336
  };
317
337
  /** @internal */
318
338
  export declare const OpenResponsesRequestProvider$outboundSchema: z.ZodType<OpenResponsesRequestProvider$Outbound, OpenResponsesRequestProvider>;
@@ -353,7 +373,16 @@ export type OpenResponsesRequestPluginModeration$Outbound = {
353
373
  export declare const OpenResponsesRequestPluginModeration$outboundSchema: z.ZodType<OpenResponsesRequestPluginModeration$Outbound, OpenResponsesRequestPluginModeration>;
354
374
  export declare function openResponsesRequestPluginModerationToJSON(openResponsesRequestPluginModeration: OpenResponsesRequestPluginModeration): string;
355
375
  /** @internal */
356
- export type OpenResponsesRequestPluginUnion$Outbound = OpenResponsesRequestPluginModeration$Outbound | OpenResponsesRequestPluginWeb$Outbound | OpenResponsesRequestPluginFileParser$Outbound | OpenResponsesRequestPluginResponseHealing$Outbound;
376
+ export type OpenResponsesRequestPluginAutoRouter$Outbound = {
377
+ id: "auto-router";
378
+ enabled?: boolean | undefined;
379
+ allowed_models?: Array<string> | undefined;
380
+ };
381
+ /** @internal */
382
+ export declare const OpenResponsesRequestPluginAutoRouter$outboundSchema: z.ZodType<OpenResponsesRequestPluginAutoRouter$Outbound, OpenResponsesRequestPluginAutoRouter>;
383
+ export declare function openResponsesRequestPluginAutoRouterToJSON(openResponsesRequestPluginAutoRouter: OpenResponsesRequestPluginAutoRouter): string;
384
+ /** @internal */
385
+ export type OpenResponsesRequestPluginUnion$Outbound = OpenResponsesRequestPluginAutoRouter$Outbound | OpenResponsesRequestPluginModeration$Outbound | OpenResponsesRequestPluginWeb$Outbound | OpenResponsesRequestPluginFileParser$Outbound | OpenResponsesRequestPluginResponseHealing$Outbound;
357
386
  /** @internal */
358
387
  export declare const OpenResponsesRequestPluginUnion$outboundSchema: z.ZodType<OpenResponsesRequestPluginUnion$Outbound, OpenResponsesRequestPluginUnion>;
359
388
  export declare function openResponsesRequestPluginUnionToJSON(openResponsesRequestPluginUnion: OpenResponsesRequestPluginUnion): string;
@@ -374,7 +403,15 @@ export type OpenResponsesRequest$Outbound = {
374
403
  max_output_tokens?: number | null | undefined;
375
404
  temperature?: number | null | undefined;
376
405
  top_p?: number | null | undefined;
406
+ top_logprobs?: number | null | undefined;
407
+ max_tool_calls?: number | null | undefined;
408
+ presence_penalty?: number | null | undefined;
409
+ frequency_penalty?: number | null | undefined;
377
410
  top_k?: number | undefined;
411
+ image_config?: {
412
+ [k: string]: string | number;
413
+ } | undefined;
414
+ modalities?: Array<string> | undefined;
378
415
  prompt_cache_key?: string | null | undefined;
379
416
  previous_response_id?: string | null | undefined;
380
417
  prompt?: OpenAIResponsesPrompt$Outbound | null | undefined;
@@ -386,7 +423,7 @@ export type OpenResponsesRequest$Outbound = {
386
423
  truncation?: string | null | undefined;
387
424
  stream: boolean;
388
425
  provider?: OpenResponsesRequestProvider$Outbound | null | undefined;
389
- plugins?: Array<OpenResponsesRequestPluginModeration$Outbound | OpenResponsesRequestPluginWeb$Outbound | OpenResponsesRequestPluginFileParser$Outbound | OpenResponsesRequestPluginResponseHealing$Outbound> | undefined;
426
+ plugins?: Array<OpenResponsesRequestPluginAutoRouter$Outbound | OpenResponsesRequestPluginModeration$Outbound | OpenResponsesRequestPluginWeb$Outbound | OpenResponsesRequestPluginFileParser$Outbound | OpenResponsesRequestPluginResponseHealing$Outbound> | undefined;
390
427
  user?: string | undefined;
391
428
  session_id?: string | undefined;
392
429
  };
@@ -17,10 +17,13 @@ import { OpenResponsesWebSearchPreview20250311Tool$outboundSchema, } from "./ope
17
17
  import { OpenResponsesWebSearchPreviewTool$outboundSchema, } from "./openresponseswebsearchpreviewtool.js";
18
18
  import { OpenResponsesWebSearchTool$outboundSchema, } from "./openresponseswebsearchtool.js";
19
19
  import { PDFParserOptions$outboundSchema, } from "./pdfparseroptions.js";
20
+ import { PreferredMaxLatency$outboundSchema, } from "./preferredmaxlatency.js";
21
+ import { PreferredMinThroughput$outboundSchema, } from "./preferredminthroughput.js";
20
22
  import { ProviderName$outboundSchema } from "./providername.js";
21
23
  import { ProviderSort$outboundSchema } from "./providersort.js";
22
24
  import { ProviderSortConfig$outboundSchema, } from "./providersortconfig.js";
23
25
  import { Quantization$outboundSchema } from "./quantization.js";
26
+ import { ResponsesOutputModality$outboundSchema, } from "./responsesoutputmodality.js";
24
27
  import { WebSearchEngine$outboundSchema, } from "./websearchengine.js";
25
28
  export const ServiceTier = {
26
29
  Auto: "auto",
@@ -52,6 +55,11 @@ export function openResponsesRequestToolUnionToJSON(openResponsesRequestToolUnio
52
55
  return JSON.stringify(OpenResponsesRequestToolUnion$outboundSchema.parse(openResponsesRequestToolUnion));
53
56
  }
54
57
  /** @internal */
58
+ export const OpenResponsesRequestImageConfig$outboundSchema = z.union([z.string(), z.number()]);
59
+ export function openResponsesRequestImageConfigToJSON(openResponsesRequestImageConfig) {
60
+ return JSON.stringify(OpenResponsesRequestImageConfig$outboundSchema.parse(openResponsesRequestImageConfig));
61
+ }
62
+ /** @internal */
55
63
  export const ServiceTier$outboundSchema = z.enum(ServiceTier);
56
64
  /** @internal */
57
65
  export const Truncation$outboundSchema = openEnums.outboundSchema(Truncation);
@@ -110,10 +118,10 @@ export const OpenResponsesRequestProvider$outboundSchema = z.object({
110
118
  ])).optional(),
111
119
  maxPrice: z.lazy(() => OpenResponsesRequestMaxPrice$outboundSchema)
112
120
  .optional(),
113
- preferredMinThroughput: z.nullable(z.number()).optional(),
114
- preferredMaxLatency: z.nullable(z.number()).optional(),
115
- minThroughput: z.nullable(z.number()).optional(),
116
- maxLatency: z.nullable(z.number()).optional(),
121
+ preferredMinThroughput: z.nullable(PreferredMinThroughput$outboundSchema)
122
+ .optional(),
123
+ preferredMaxLatency: z.nullable(PreferredMaxLatency$outboundSchema)
124
+ .optional(),
117
125
  }).transform((v) => {
118
126
  return remap$(v, {
119
127
  allowFallbacks: "allow_fallbacks",
@@ -123,8 +131,6 @@ export const OpenResponsesRequestProvider$outboundSchema = z.object({
123
131
  maxPrice: "max_price",
124
132
  preferredMinThroughput: "preferred_min_throughput",
125
133
  preferredMaxLatency: "preferred_max_latency",
126
- minThroughput: "min_throughput",
127
- maxLatency: "max_latency",
128
134
  });
129
135
  });
130
136
  export function openResponsesRequestProviderToJSON(openResponsesRequestProvider) {
@@ -171,7 +177,21 @@ export function openResponsesRequestPluginModerationToJSON(openResponsesRequestP
171
177
  return JSON.stringify(OpenResponsesRequestPluginModeration$outboundSchema.parse(openResponsesRequestPluginModeration));
172
178
  }
173
179
  /** @internal */
180
+ export const OpenResponsesRequestPluginAutoRouter$outboundSchema = z.object({
181
+ id: z.literal("auto-router"),
182
+ enabled: z.boolean().optional(),
183
+ allowedModels: z.array(z.string()).optional(),
184
+ }).transform((v) => {
185
+ return remap$(v, {
186
+ allowedModels: "allowed_models",
187
+ });
188
+ });
189
+ export function openResponsesRequestPluginAutoRouterToJSON(openResponsesRequestPluginAutoRouter) {
190
+ return JSON.stringify(OpenResponsesRequestPluginAutoRouter$outboundSchema.parse(openResponsesRequestPluginAutoRouter));
191
+ }
192
+ /** @internal */
174
193
  export const OpenResponsesRequestPluginUnion$outboundSchema = z.union([
194
+ z.lazy(() => OpenResponsesRequestPluginAutoRouter$outboundSchema),
175
195
  z.lazy(() => OpenResponsesRequestPluginModeration$outboundSchema),
176
196
  z.lazy(() => OpenResponsesRequestPluginWeb$outboundSchema),
177
197
  z.lazy(() => OpenResponsesRequestPluginFileParser$outboundSchema),
@@ -201,7 +221,14 @@ export const OpenResponsesRequest$outboundSchema = z.object({
201
221
  maxOutputTokens: z.nullable(z.number()).optional(),
202
222
  temperature: z.nullable(z.number()).optional(),
203
223
  topP: z.nullable(z.number()).optional(),
224
+ topLogprobs: z.nullable(z.int()).optional(),
225
+ maxToolCalls: z.nullable(z.int()).optional(),
226
+ presencePenalty: z.nullable(z.number()).optional(),
227
+ frequencyPenalty: z.nullable(z.number()).optional(),
204
228
  topK: z.number().optional(),
229
+ imageConfig: z.record(z.string(), z.union([z.string(), z.number()]))
230
+ .optional(),
231
+ modalities: z.array(ResponsesOutputModality$outboundSchema).optional(),
205
232
  promptCacheKey: z.nullable(z.string()).optional(),
206
233
  previousResponseId: z.nullable(z.string()).optional(),
207
234
  prompt: z.nullable(OpenAIResponsesPrompt$outboundSchema).optional(),
@@ -215,6 +242,7 @@ export const OpenResponsesRequest$outboundSchema = z.object({
215
242
  stream: z.boolean().default(false),
216
243
  provider: z.nullable(z.lazy(() => OpenResponsesRequestProvider$outboundSchema)).optional(),
217
244
  plugins: z.array(z.union([
245
+ z.lazy(() => OpenResponsesRequestPluginAutoRouter$outboundSchema),
218
246
  z.lazy(() => OpenResponsesRequestPluginModeration$outboundSchema),
219
247
  z.lazy(() => OpenResponsesRequestPluginWeb$outboundSchema),
220
248
  z.lazy(() => OpenResponsesRequestPluginFileParser$outboundSchema),
@@ -228,7 +256,12 @@ export const OpenResponsesRequest$outboundSchema = z.object({
228
256
  parallelToolCalls: "parallel_tool_calls",
229
257
  maxOutputTokens: "max_output_tokens",
230
258
  topP: "top_p",
259
+ topLogprobs: "top_logprobs",
260
+ maxToolCalls: "max_tool_calls",
261
+ presencePenalty: "presence_penalty",
262
+ frequencyPenalty: "frequency_penalty",
231
263
  topK: "top_k",
264
+ imageConfig: "image_config",
232
265
  promptCacheKey: "prompt_cache_key",
233
266
  previousResponseId: "previous_response_id",
234
267
  safetyIdentifier: "safety_identifier",
@@ -148,6 +148,10 @@ export type GetGenerationData = {
148
148
  * Type of API used for the generation
149
149
  */
150
150
  apiType: ApiType | null;
151
+ /**
152
+ * Router used for the request (e.g., openrouter/auto)
153
+ */
154
+ router: string | null;
151
155
  };
152
156
  /**
153
157
  * Generation response
@@ -57,6 +57,7 @@ export const GetGenerationData$inboundSchema = z.object({
57
57
  native_finish_reason: z.nullable(z.string()),
58
58
  external_user: z.nullable(z.string()),
59
59
  api_type: z.nullable(ApiType$inboundSchema),
60
+ router: z.nullable(z.string()),
60
61
  }).transform((v) => {
61
62
  return remap$(v, {
62
63
  "upstream_id": "upstreamId",
@@ -0,0 +1,33 @@
1
+ import * as z from "zod/v4";
2
+ /**
3
+ * Percentile-based latency cutoffs. All specified cutoffs must be met for an endpoint to be preferred.
4
+ */
5
+ export type PercentileLatencyCutoffs = {
6
+ /**
7
+ * Maximum p50 latency (seconds)
8
+ */
9
+ p50?: number | null | undefined;
10
+ /**
11
+ * Maximum p75 latency (seconds)
12
+ */
13
+ p75?: number | null | undefined;
14
+ /**
15
+ * Maximum p90 latency (seconds)
16
+ */
17
+ p90?: number | null | undefined;
18
+ /**
19
+ * Maximum p99 latency (seconds)
20
+ */
21
+ p99?: number | null | undefined;
22
+ };
23
+ /** @internal */
24
+ export type PercentileLatencyCutoffs$Outbound = {
25
+ p50?: number | null | undefined;
26
+ p75?: number | null | undefined;
27
+ p90?: number | null | undefined;
28
+ p99?: number | null | undefined;
29
+ };
30
+ /** @internal */
31
+ export declare const PercentileLatencyCutoffs$outboundSchema: z.ZodType<PercentileLatencyCutoffs$Outbound, PercentileLatencyCutoffs>;
32
+ export declare function percentileLatencyCutoffsToJSON(percentileLatencyCutoffs: PercentileLatencyCutoffs): string;
33
+ //# sourceMappingURL=percentilelatencycutoffs.d.ts.map
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 92e053096488
4
+ */
5
+ import * as z from "zod/v4";
6
+ /** @internal */
7
+ export const PercentileLatencyCutoffs$outboundSchema = z.object({
8
+ p50: z.nullable(z.number()).optional(),
9
+ p75: z.nullable(z.number()).optional(),
10
+ p90: z.nullable(z.number()).optional(),
11
+ p99: z.nullable(z.number()).optional(),
12
+ });
13
+ export function percentileLatencyCutoffsToJSON(percentileLatencyCutoffs) {
14
+ return JSON.stringify(PercentileLatencyCutoffs$outboundSchema.parse(percentileLatencyCutoffs));
15
+ }
16
+ //# sourceMappingURL=percentilelatencycutoffs.js.map
@@ -0,0 +1,28 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ /**
5
+ * Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests.
6
+ */
7
+ export type PercentileStats = {
8
+ /**
9
+ * Median (50th percentile)
10
+ */
11
+ p50: number;
12
+ /**
13
+ * 75th percentile
14
+ */
15
+ p75: number;
16
+ /**
17
+ * 90th percentile
18
+ */
19
+ p90: number;
20
+ /**
21
+ * 99th percentile
22
+ */
23
+ p99: number;
24
+ };
25
+ /** @internal */
26
+ export declare const PercentileStats$inboundSchema: z.ZodType<PercentileStats, unknown>;
27
+ export declare function percentileStatsFromJSON(jsonString: string): SafeParseResult<PercentileStats, SDKValidationError>;
28
+ //# sourceMappingURL=percentilestats.d.ts.map
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 9a6b504d3964
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ /** @internal */
8
+ export const PercentileStats$inboundSchema = z.object({
9
+ p50: z.number(),
10
+ p75: z.number(),
11
+ p90: z.number(),
12
+ p99: z.number(),
13
+ });
14
+ export function percentileStatsFromJSON(jsonString) {
15
+ return safeParse(jsonString, (x) => PercentileStats$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PercentileStats' from JSON`);
16
+ }
17
+ //# sourceMappingURL=percentilestats.js.map
@@ -0,0 +1,33 @@
1
+ import * as z from "zod/v4";
2
+ /**
3
+ * Percentile-based throughput cutoffs. All specified cutoffs must be met for an endpoint to be preferred.
4
+ */
5
+ export type PercentileThroughputCutoffs = {
6
+ /**
7
+ * Minimum p50 throughput (tokens/sec)
8
+ */
9
+ p50?: number | null | undefined;
10
+ /**
11
+ * Minimum p75 throughput (tokens/sec)
12
+ */
13
+ p75?: number | null | undefined;
14
+ /**
15
+ * Minimum p90 throughput (tokens/sec)
16
+ */
17
+ p90?: number | null | undefined;
18
+ /**
19
+ * Minimum p99 throughput (tokens/sec)
20
+ */
21
+ p99?: number | null | undefined;
22
+ };
23
+ /** @internal */
24
+ export type PercentileThroughputCutoffs$Outbound = {
25
+ p50?: number | null | undefined;
26
+ p75?: number | null | undefined;
27
+ p90?: number | null | undefined;
28
+ p99?: number | null | undefined;
29
+ };
30
+ /** @internal */
31
+ export declare const PercentileThroughputCutoffs$outboundSchema: z.ZodType<PercentileThroughputCutoffs$Outbound, PercentileThroughputCutoffs>;
32
+ export declare function percentileThroughputCutoffsToJSON(percentileThroughputCutoffs: PercentileThroughputCutoffs): string;
33
+ //# sourceMappingURL=percentilethroughputcutoffs.d.ts.map
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 847aba8ff633
4
+ */
5
+ import * as z from "zod/v4";
6
+ /** @internal */
7
+ export const PercentileThroughputCutoffs$outboundSchema = z.object({
8
+ p50: z.nullable(z.number()).optional(),
9
+ p75: z.nullable(z.number()).optional(),
10
+ p90: z.nullable(z.number()).optional(),
11
+ p99: z.nullable(z.number()).optional(),
12
+ });
13
+ export function percentileThroughputCutoffsToJSON(percentileThroughputCutoffs) {
14
+ return JSON.stringify(PercentileThroughputCutoffs$outboundSchema.parse(percentileThroughputCutoffs));
15
+ }
16
+ //# sourceMappingURL=percentilethroughputcutoffs.js.map
@@ -0,0 +1,12 @@
1
+ import * as z from "zod/v4";
2
+ import { PercentileLatencyCutoffs, PercentileLatencyCutoffs$Outbound } from "./percentilelatencycutoffs.js";
3
+ /**
4
+ * 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.
5
+ */
6
+ export type PreferredMaxLatency = number | PercentileLatencyCutoffs | any;
7
+ /** @internal */
8
+ export type PreferredMaxLatency$Outbound = number | PercentileLatencyCutoffs$Outbound | any;
9
+ /** @internal */
10
+ export declare const PreferredMaxLatency$outboundSchema: z.ZodType<PreferredMaxLatency$Outbound, PreferredMaxLatency>;
11
+ export declare function preferredMaxLatencyToJSON(preferredMaxLatency: PreferredMaxLatency): string;
12
+ //# sourceMappingURL=preferredmaxlatency.d.ts.map
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: e03f33269427
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { PercentileLatencyCutoffs$outboundSchema, } from "./percentilelatencycutoffs.js";
7
+ /** @internal */
8
+ export const PreferredMaxLatency$outboundSchema = z.union([z.number(), PercentileLatencyCutoffs$outboundSchema, z.any()]);
9
+ export function preferredMaxLatencyToJSON(preferredMaxLatency) {
10
+ return JSON.stringify(PreferredMaxLatency$outboundSchema.parse(preferredMaxLatency));
11
+ }
12
+ //# sourceMappingURL=preferredmaxlatency.js.map
@@ -0,0 +1,12 @@
1
+ import * as z from "zod/v4";
2
+ import { PercentileThroughputCutoffs, PercentileThroughputCutoffs$Outbound } from "./percentilethroughputcutoffs.js";
3
+ /**
4
+ * 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.
5
+ */
6
+ export type PreferredMinThroughput = number | PercentileThroughputCutoffs | any;
7
+ /** @internal */
8
+ export type PreferredMinThroughput$Outbound = number | PercentileThroughputCutoffs$Outbound | any;
9
+ /** @internal */
10
+ export declare const PreferredMinThroughput$outboundSchema: z.ZodType<PreferredMinThroughput$Outbound, PreferredMinThroughput>;
11
+ export declare function preferredMinThroughputToJSON(preferredMinThroughput: PreferredMinThroughput): string;
12
+ //# sourceMappingURL=preferredminthroughput.d.ts.map
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 5ff9056f1474
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { PercentileThroughputCutoffs$outboundSchema, } from "./percentilethroughputcutoffs.js";
7
+ /** @internal */
8
+ export const PreferredMinThroughput$outboundSchema = z.union([z.number(), PercentileThroughputCutoffs$outboundSchema, z.any()]);
9
+ export function preferredMinThroughputToJSON(preferredMinThroughput) {
10
+ return JSON.stringify(PreferredMinThroughput$outboundSchema.parse(preferredMinThroughput));
11
+ }
12
+ //# sourceMappingURL=preferredminthroughput.js.map
@@ -27,12 +27,12 @@ export declare const ProviderName: {
27
27
  readonly Fireworks: "Fireworks";
28
28
  readonly Friendli: "Friendli";
29
29
  readonly GMICloud: "GMICloud";
30
- readonly GoPomelo: "GoPomelo";
31
30
  readonly Google: "Google";
32
31
  readonly GoogleAIStudio: "Google AI Studio";
33
32
  readonly Groq: "Groq";
34
33
  readonly Hyperbolic: "Hyperbolic";
35
34
  readonly Inception: "Inception";
35
+ readonly Inceptron: "Inceptron";
36
36
  readonly InferenceNet: "InferenceNet";
37
37
  readonly Infermatic: "Infermatic";
38
38
  readonly Inflection: "Inflection";
@@ -57,13 +57,14 @@ export declare const ProviderName: {
57
57
  readonly Phala: "Phala";
58
58
  readonly Relace: "Relace";
59
59
  readonly SambaNova: "SambaNova";
60
+ readonly Seed: "Seed";
60
61
  readonly SiliconFlow: "SiliconFlow";
61
62
  readonly Sourceful: "Sourceful";
62
63
  readonly Stealth: "Stealth";
63
64
  readonly StreamLake: "StreamLake";
64
65
  readonly Switchpoint: "Switchpoint";
65
- readonly Targon: "Targon";
66
66
  readonly Together: "Together";
67
+ readonly Upstage: "Upstage";
67
68
  readonly Venice: "Venice";
68
69
  readonly WandB: "WandB";
69
70
  readonly Xiaomi: "Xiaomi";
@@ -30,12 +30,12 @@ export const ProviderName = {
30
30
  Fireworks: "Fireworks",
31
31
  Friendli: "Friendli",
32
32
  GMICloud: "GMICloud",
33
- GoPomelo: "GoPomelo",
34
33
  Google: "Google",
35
34
  GoogleAIStudio: "Google AI Studio",
36
35
  Groq: "Groq",
37
36
  Hyperbolic: "Hyperbolic",
38
37
  Inception: "Inception",
38
+ Inceptron: "Inceptron",
39
39
  InferenceNet: "InferenceNet",
40
40
  Infermatic: "Infermatic",
41
41
  Inflection: "Inflection",
@@ -60,13 +60,14 @@ export const ProviderName = {
60
60
  Phala: "Phala",
61
61
  Relace: "Relace",
62
62
  SambaNova: "SambaNova",
63
+ Seed: "Seed",
63
64
  SiliconFlow: "SiliconFlow",
64
65
  Sourceful: "Sourceful",
65
66
  Stealth: "Stealth",
66
67
  StreamLake: "StreamLake",
67
68
  Switchpoint: "Switchpoint",
68
- Targon: "Targon",
69
69
  Together: "Together",
70
+ Upstage: "Upstage",
70
71
  Venice: "Venice",
71
72
  WandB: "WandB",
72
73
  Xiaomi: "Xiaomi",
@@ -1,6 +1,8 @@
1
1
  import * as z from "zod/v4";
2
2
  import { ClosedEnum, OpenEnum } from "../types/enums.js";
3
3
  import { DataCollection } from "./datacollection.js";
4
+ import { PreferredMaxLatency, PreferredMaxLatency$Outbound } from "./preferredmaxlatency.js";
5
+ import { PreferredMinThroughput, PreferredMinThroughput$Outbound } from "./preferredminthroughput.js";
4
6
  import { ProviderName } from "./providername.js";
5
7
  import { ProviderSort } from "./providersort.js";
6
8
  import { Quantization } from "./quantization.js";
@@ -119,25 +121,13 @@ export type ProviderPreferences = {
119
121
  */
120
122
  maxPrice?: ProviderPreferencesMaxPrice | undefined;
121
123
  /**
122
- * Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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.
124
+ * 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.
123
125
  */
124
- preferredMinThroughput?: number | null | undefined;
126
+ preferredMinThroughput?: PreferredMinThroughput | null | undefined;
125
127
  /**
126
- * Preferred maximum latency (in seconds). Endpoints above this threshold 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.
128
+ * 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.
127
129
  */
128
- preferredMaxLatency?: number | null | undefined;
129
- /**
130
- * **DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput.
131
- *
132
- * @deprecated field: Use preferred_min_throughput instead..
133
- */
134
- minThroughput?: number | null | undefined;
135
- /**
136
- * **DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency.
137
- *
138
- * @deprecated field: Use preferred_max_latency instead..
139
- */
140
- maxLatency?: number | null | undefined;
130
+ preferredMaxLatency?: PreferredMaxLatency | null | undefined;
141
131
  };
142
132
  /** @internal */
143
133
  export type ProviderPreferencesOrder$Outbound = string | string;
@@ -204,10 +194,8 @@ export type ProviderPreferences$Outbound = {
204
194
  quantizations?: Array<string> | null | undefined;
205
195
  sort?: string | ProviderPreferencesProviderSortConfig$Outbound | string | string | null | undefined;
206
196
  max_price?: ProviderPreferencesMaxPrice$Outbound | undefined;
207
- preferred_min_throughput?: number | null | undefined;
208
- preferred_max_latency?: number | null | undefined;
209
- min_throughput?: number | null | undefined;
210
- max_latency?: number | null | undefined;
197
+ preferred_min_throughput?: PreferredMinThroughput$Outbound | null | undefined;
198
+ preferred_max_latency?: PreferredMaxLatency$Outbound | null | undefined;
211
199
  };
212
200
  /** @internal */
213
201
  export declare const ProviderPreferences$outboundSchema: z.ZodType<ProviderPreferences$Outbound, ProviderPreferences>;
@@ -6,6 +6,8 @@ import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
7
  import * as openEnums from "../types/enums.js";
8
8
  import { DataCollection$outboundSchema, } from "./datacollection.js";
9
+ import { PreferredMaxLatency$outboundSchema, } from "./preferredmaxlatency.js";
10
+ import { PreferredMinThroughput$outboundSchema, } from "./preferredminthroughput.js";
9
11
  import { ProviderName$outboundSchema } from "./providername.js";
10
12
  import { ProviderSort$outboundSchema } from "./providersort.js";
11
13
  import { Quantization$outboundSchema } from "./quantization.js";
@@ -113,10 +115,10 @@ export const ProviderPreferences$outboundSchema = z.object({
113
115
  SortEnum$outboundSchema,
114
116
  ])).optional(),
115
117
  maxPrice: z.lazy(() => ProviderPreferencesMaxPrice$outboundSchema).optional(),
116
- preferredMinThroughput: z.nullable(z.number()).optional(),
117
- preferredMaxLatency: z.nullable(z.number()).optional(),
118
- minThroughput: z.nullable(z.number()).optional(),
119
- maxLatency: z.nullable(z.number()).optional(),
118
+ preferredMinThroughput: z.nullable(PreferredMinThroughput$outboundSchema)
119
+ .optional(),
120
+ preferredMaxLatency: z.nullable(PreferredMaxLatency$outboundSchema)
121
+ .optional(),
120
122
  }).transform((v) => {
121
123
  return remap$(v, {
122
124
  allowFallbacks: "allow_fallbacks",
@@ -126,8 +128,6 @@ export const ProviderPreferences$outboundSchema = z.object({
126
128
  maxPrice: "max_price",
127
129
  preferredMinThroughput: "preferred_min_throughput",
128
130
  preferredMaxLatency: "preferred_max_latency",
129
- minThroughput: "min_throughput",
130
- maxLatency: "max_latency",
131
131
  });
132
132
  });
133
133
  export function providerPreferencesToJSON(providerPreferences) {