@openrouter/sdk 0.2.11 → 0.3.2

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 (41) hide show
  1. package/esm/lib/config.d.ts +3 -3
  2. package/esm/lib/config.js +3 -3
  3. package/esm/lib/event-streams.js +1 -1
  4. package/esm/models/chatgenerationparams.d.ts +30 -44
  5. package/esm/models/chatgenerationparams.js +27 -32
  6. package/esm/models/chatresponsechoice.d.ts +2 -0
  7. package/esm/models/chatresponsechoice.js +3 -0
  8. package/esm/models/chatstreamingmessagechunk.d.ts +2 -0
  9. package/esm/models/chatstreamingmessagechunk.js +3 -0
  10. package/esm/models/index.d.ts +7 -0
  11. package/esm/models/index.js +7 -0
  12. package/esm/models/openresponsesrequest.d.ts +51 -64
  13. package/esm/models/openresponsesrequest.js +32 -54
  14. package/esm/models/operations/createembeddings.d.ts +5 -138
  15. package/esm/models/operations/createembeddings.js +1 -65
  16. package/esm/models/operations/getparameters.d.ts +3 -75
  17. package/esm/models/operations/getparameters.js +3 -74
  18. package/esm/models/outputitemimagegenerationcall.d.ts +1 -1
  19. package/esm/models/parameter.d.ts +1 -0
  20. package/esm/models/parameter.js +1 -0
  21. package/esm/models/pdfparserengine.d.ts +17 -0
  22. package/esm/models/pdfparserengine.js +15 -0
  23. package/esm/models/pdfparseroptions.d.ts +19 -0
  24. package/esm/models/pdfparseroptions.js +13 -0
  25. package/esm/models/providerpreferences.d.ts +215 -0
  26. package/esm/models/providerpreferences.js +135 -0
  27. package/esm/models/providersort.d.ts +0 -6
  28. package/esm/models/providersort.js +0 -3
  29. package/esm/models/providersortconfig.d.ts +23 -0
  30. package/esm/models/providersortconfig.js +22 -0
  31. package/esm/models/providersortunion.d.ts +10 -0
  32. package/esm/models/providersortunion.js +12 -0
  33. package/esm/models/schema3.d.ts +50 -0
  34. package/esm/models/schema3.js +60 -0
  35. package/esm/models/websearchengine.d.ts +16 -0
  36. package/esm/models/websearchengine.js +14 -0
  37. package/esm/types/discriminatedUnion.d.ts +25 -0
  38. package/esm/types/discriminatedUnion.js +57 -0
  39. package/jsr.json +1 -1
  40. package/package.json +1 -1
  41. package/tsconfig.json +1 -1
@@ -11,9 +11,12 @@ import { OpenResponsesWebSearch20250826Tool, OpenResponsesWebSearch20250826Tool$
11
11
  import { OpenResponsesWebSearchPreview20250311Tool, OpenResponsesWebSearchPreview20250311Tool$Outbound } from "./openresponseswebsearchpreview20250311tool.js";
12
12
  import { OpenResponsesWebSearchPreviewTool, OpenResponsesWebSearchPreviewTool$Outbound } from "./openresponseswebsearchpreviewtool.js";
13
13
  import { OpenResponsesWebSearchTool, OpenResponsesWebSearchTool$Outbound } from "./openresponseswebsearchtool.js";
14
+ import { PDFParserOptions, PDFParserOptions$Outbound } from "./pdfparseroptions.js";
14
15
  import { ProviderName } from "./providername.js";
15
16
  import { ProviderSort } from "./providersort.js";
17
+ import { ProviderSortConfig, ProviderSortConfig$Outbound } from "./providersortconfig.js";
16
18
  import { Quantization } from "./quantization.js";
19
+ import { WebSearchEngine } from "./websearchengine.js";
17
20
  /**
18
21
  * Function tool definition
19
22
  */
@@ -36,9 +39,13 @@ export declare const Truncation: {
36
39
  readonly Disabled: "disabled";
37
40
  };
38
41
  export type Truncation = OpenEnum<typeof Truncation>;
39
- export type Order = ProviderName | string;
40
- export type Only = ProviderName | string;
41
- export type Ignore = ProviderName | string;
42
+ export type OpenResponsesRequestOrder = ProviderName | string;
43
+ export type OpenResponsesRequestOnly = ProviderName | string;
44
+ export type OpenResponsesRequestIgnore = ProviderName | string;
45
+ /**
46
+ * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
47
+ */
48
+ export type OpenResponsesRequestSort = ProviderSort | ProviderSortConfig | any;
42
49
  /**
43
50
  * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
44
51
  */
@@ -116,17 +123,29 @@ export type OpenResponsesRequestProvider = {
116
123
  /**
117
124
  * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
118
125
  */
119
- sort?: ProviderSort | null | undefined;
126
+ sort?: ProviderSort | ProviderSortConfig | any | null | undefined;
120
127
  /**
121
128
  * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
122
129
  */
123
130
  maxPrice?: OpenResponsesRequestMaxPrice | undefined;
124
131
  /**
125
- * The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used.
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.
133
+ */
134
+ preferredMinThroughput?: number | null | undefined;
135
+ /**
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.
137
+ */
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..
126
143
  */
127
144
  minThroughput?: number | null | undefined;
128
145
  /**
129
- * The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used.
146
+ * **DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency.
147
+ *
148
+ * @deprecated field: Use preferred_max_latency instead..
130
149
  */
131
150
  maxLatency?: number | null | undefined;
132
151
  };
@@ -137,29 +156,17 @@ export type OpenResponsesRequestPluginResponseHealing = {
137
156
  */
138
157
  enabled?: boolean | undefined;
139
158
  };
140
- export declare const OpenResponsesRequestPdfEngine: {
141
- readonly MistralOcr: "mistral-ocr";
142
- readonly PdfText: "pdf-text";
143
- readonly Native: "native";
144
- };
145
- export type OpenResponsesRequestPdfEngine = OpenEnum<typeof OpenResponsesRequestPdfEngine>;
146
- export type OpenResponsesRequestPdf = {
147
- engine?: OpenResponsesRequestPdfEngine | undefined;
148
- };
149
159
  export type OpenResponsesRequestPluginFileParser = {
150
160
  id: "file-parser";
151
161
  /**
152
162
  * Set to false to disable the file-parser plugin for this request. Defaults to true.
153
163
  */
154
164
  enabled?: boolean | undefined;
155
- maxFiles?: number | undefined;
156
- pdf?: OpenResponsesRequestPdf | undefined;
157
- };
158
- export declare const OpenResponsesRequestEngine: {
159
- readonly Native: "native";
160
- readonly Exa: "exa";
165
+ /**
166
+ * Options for PDF parsing.
167
+ */
168
+ pdf?: PDFParserOptions | undefined;
161
169
  };
162
- export type OpenResponsesRequestEngine = OpenEnum<typeof OpenResponsesRequestEngine>;
163
170
  export type OpenResponsesRequestPluginWeb = {
164
171
  id: "web";
165
172
  /**
@@ -168,23 +175,15 @@ export type OpenResponsesRequestPluginWeb = {
168
175
  enabled?: boolean | undefined;
169
176
  maxResults?: number | undefined;
170
177
  searchPrompt?: string | undefined;
171
- engine?: OpenResponsesRequestEngine | undefined;
178
+ /**
179
+ * The search engine to use for web search.
180
+ */
181
+ engine?: WebSearchEngine | undefined;
172
182
  };
173
183
  export type OpenResponsesRequestPluginModeration = {
174
184
  id: "moderation";
175
185
  };
176
186
  export type OpenResponsesRequestPluginUnion = OpenResponsesRequestPluginModeration | OpenResponsesRequestPluginWeb | OpenResponsesRequestPluginFileParser | OpenResponsesRequestPluginResponseHealing;
177
- /**
178
- * Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria.
179
- */
180
- export declare const OpenResponsesRequestRoute: {
181
- readonly Fallback: "fallback";
182
- readonly Sort: "sort";
183
- };
184
- /**
185
- * Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria.
186
- */
187
- export type OpenResponsesRequestRoute = OpenEnum<typeof OpenResponsesRequestRoute>;
188
187
  /**
189
188
  * Request schema for Responses endpoint
190
189
  */
@@ -235,10 +234,6 @@ export type OpenResponsesRequest = {
235
234
  * Plugins you want to enable for this request, including their settings.
236
235
  */
237
236
  plugins?: Array<OpenResponsesRequestPluginModeration | OpenResponsesRequestPluginWeb | OpenResponsesRequestPluginFileParser | OpenResponsesRequestPluginResponseHealing> | undefined;
238
- /**
239
- * Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria.
240
- */
241
- route?: OpenResponsesRequestRoute | null | undefined;
242
237
  /**
243
238
  * 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.
244
239
  */
@@ -271,20 +266,25 @@ export declare const ServiceTier$outboundSchema: z.ZodEnum<typeof ServiceTier>;
271
266
  /** @internal */
272
267
  export declare const Truncation$outboundSchema: z.ZodType<string, Truncation>;
273
268
  /** @internal */
274
- export type Order$Outbound = string | string;
269
+ export type OpenResponsesRequestOrder$Outbound = string | string;
270
+ /** @internal */
271
+ export declare const OpenResponsesRequestOrder$outboundSchema: z.ZodType<OpenResponsesRequestOrder$Outbound, OpenResponsesRequestOrder>;
272
+ export declare function openResponsesRequestOrderToJSON(openResponsesRequestOrder: OpenResponsesRequestOrder): string;
273
+ /** @internal */
274
+ export type OpenResponsesRequestOnly$Outbound = string | string;
275
275
  /** @internal */
276
- export declare const Order$outboundSchema: z.ZodType<Order$Outbound, Order>;
277
- export declare function orderToJSON(order: Order): string;
276
+ export declare const OpenResponsesRequestOnly$outboundSchema: z.ZodType<OpenResponsesRequestOnly$Outbound, OpenResponsesRequestOnly>;
277
+ export declare function openResponsesRequestOnlyToJSON(openResponsesRequestOnly: OpenResponsesRequestOnly): string;
278
278
  /** @internal */
279
- export type Only$Outbound = string | string;
279
+ export type OpenResponsesRequestIgnore$Outbound = string | string;
280
280
  /** @internal */
281
- export declare const Only$outboundSchema: z.ZodType<Only$Outbound, Only>;
282
- export declare function onlyToJSON(only: Only): string;
281
+ export declare const OpenResponsesRequestIgnore$outboundSchema: z.ZodType<OpenResponsesRequestIgnore$Outbound, OpenResponsesRequestIgnore>;
282
+ export declare function openResponsesRequestIgnoreToJSON(openResponsesRequestIgnore: OpenResponsesRequestIgnore): string;
283
283
  /** @internal */
284
- export type Ignore$Outbound = string | string;
284
+ export type OpenResponsesRequestSort$Outbound = string | ProviderSortConfig$Outbound | any;
285
285
  /** @internal */
286
- export declare const Ignore$outboundSchema: z.ZodType<Ignore$Outbound, Ignore>;
287
- export declare function ignoreToJSON(ignore: Ignore): string;
286
+ export declare const OpenResponsesRequestSort$outboundSchema: z.ZodType<OpenResponsesRequestSort$Outbound, OpenResponsesRequestSort>;
287
+ export declare function openResponsesRequestSortToJSON(openResponsesRequestSort: OpenResponsesRequestSort): string;
288
288
  /** @internal */
289
289
  export type OpenResponsesRequestMaxPrice$Outbound = {
290
290
  prompt?: string | undefined;
@@ -307,8 +307,10 @@ export type OpenResponsesRequestProvider$Outbound = {
307
307
  only?: Array<string | string> | null | undefined;
308
308
  ignore?: Array<string | string> | null | undefined;
309
309
  quantizations?: Array<string> | null | undefined;
310
- sort?: string | null | undefined;
310
+ sort?: string | ProviderSortConfig$Outbound | any | null | undefined;
311
311
  max_price?: OpenResponsesRequestMaxPrice$Outbound | undefined;
312
+ preferred_min_throughput?: number | null | undefined;
313
+ preferred_max_latency?: number | null | undefined;
312
314
  min_throughput?: number | null | undefined;
313
315
  max_latency?: number | null | undefined;
314
316
  };
@@ -324,27 +326,15 @@ export type OpenResponsesRequestPluginResponseHealing$Outbound = {
324
326
  export declare const OpenResponsesRequestPluginResponseHealing$outboundSchema: z.ZodType<OpenResponsesRequestPluginResponseHealing$Outbound, OpenResponsesRequestPluginResponseHealing>;
325
327
  export declare function openResponsesRequestPluginResponseHealingToJSON(openResponsesRequestPluginResponseHealing: OpenResponsesRequestPluginResponseHealing): string;
326
328
  /** @internal */
327
- export declare const OpenResponsesRequestPdfEngine$outboundSchema: z.ZodType<string, OpenResponsesRequestPdfEngine>;
328
- /** @internal */
329
- export type OpenResponsesRequestPdf$Outbound = {
330
- engine?: string | undefined;
331
- };
332
- /** @internal */
333
- export declare const OpenResponsesRequestPdf$outboundSchema: z.ZodType<OpenResponsesRequestPdf$Outbound, OpenResponsesRequestPdf>;
334
- export declare function openResponsesRequestPdfToJSON(openResponsesRequestPdf: OpenResponsesRequestPdf): string;
335
- /** @internal */
336
329
  export type OpenResponsesRequestPluginFileParser$Outbound = {
337
330
  id: "file-parser";
338
331
  enabled?: boolean | undefined;
339
- max_files?: number | undefined;
340
- pdf?: OpenResponsesRequestPdf$Outbound | undefined;
332
+ pdf?: PDFParserOptions$Outbound | undefined;
341
333
  };
342
334
  /** @internal */
343
335
  export declare const OpenResponsesRequestPluginFileParser$outboundSchema: z.ZodType<OpenResponsesRequestPluginFileParser$Outbound, OpenResponsesRequestPluginFileParser>;
344
336
  export declare function openResponsesRequestPluginFileParserToJSON(openResponsesRequestPluginFileParser: OpenResponsesRequestPluginFileParser): string;
345
337
  /** @internal */
346
- export declare const OpenResponsesRequestEngine$outboundSchema: z.ZodType<string, OpenResponsesRequestEngine>;
347
- /** @internal */
348
338
  export type OpenResponsesRequestPluginWeb$Outbound = {
349
339
  id: "web";
350
340
  enabled?: boolean | undefined;
@@ -368,8 +358,6 @@ export type OpenResponsesRequestPluginUnion$Outbound = OpenResponsesRequestPlugi
368
358
  export declare const OpenResponsesRequestPluginUnion$outboundSchema: z.ZodType<OpenResponsesRequestPluginUnion$Outbound, OpenResponsesRequestPluginUnion>;
369
359
  export declare function openResponsesRequestPluginUnionToJSON(openResponsesRequestPluginUnion: OpenResponsesRequestPluginUnion): string;
370
360
  /** @internal */
371
- export declare const OpenResponsesRequestRoute$outboundSchema: z.ZodType<string, OpenResponsesRequestRoute>;
372
- /** @internal */
373
361
  export type OpenResponsesRequest$Outbound = {
374
362
  input?: OpenResponsesInput$Outbound | undefined;
375
363
  instructions?: string | null | undefined;
@@ -399,7 +387,6 @@ export type OpenResponsesRequest$Outbound = {
399
387
  stream: boolean;
400
388
  provider?: OpenResponsesRequestProvider$Outbound | null | undefined;
401
389
  plugins?: Array<OpenResponsesRequestPluginModeration$Outbound | OpenResponsesRequestPluginWeb$Outbound | OpenResponsesRequestPluginFileParser$Outbound | OpenResponsesRequestPluginResponseHealing$Outbound> | undefined;
402
- route?: string | null | undefined;
403
390
  user?: string | undefined;
404
391
  session_id?: string | undefined;
405
392
  };
@@ -15,9 +15,12 @@ import { OpenResponsesWebSearch20250826Tool$outboundSchema, } from "./openrespon
15
15
  import { OpenResponsesWebSearchPreview20250311Tool$outboundSchema, } from "./openresponseswebsearchpreview20250311tool.js";
16
16
  import { OpenResponsesWebSearchPreviewTool$outboundSchema, } from "./openresponseswebsearchpreviewtool.js";
17
17
  import { OpenResponsesWebSearchTool$outboundSchema, } from "./openresponseswebsearchtool.js";
18
+ import { PDFParserOptions$outboundSchema, } from "./pdfparseroptions.js";
18
19
  import { ProviderName$outboundSchema } from "./providername.js";
19
20
  import { ProviderSort$outboundSchema } from "./providersort.js";
21
+ import { ProviderSortConfig$outboundSchema, } from "./providersortconfig.js";
20
22
  import { Quantization$outboundSchema } from "./quantization.js";
23
+ import { WebSearchEngine$outboundSchema, } from "./websearchengine.js";
21
24
  export const ServiceTier = {
22
25
  Auto: "auto",
23
26
  };
@@ -25,22 +28,6 @@ export const Truncation = {
25
28
  Auto: "auto",
26
29
  Disabled: "disabled",
27
30
  };
28
- export const OpenResponsesRequestPdfEngine = {
29
- MistralOcr: "mistral-ocr",
30
- PdfText: "pdf-text",
31
- Native: "native",
32
- };
33
- export const OpenResponsesRequestEngine = {
34
- Native: "native",
35
- Exa: "exa",
36
- };
37
- /**
38
- * Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria.
39
- */
40
- export const OpenResponsesRequestRoute = {
41
- Fallback: "fallback",
42
- Sort: "sort",
43
- };
44
31
  /** @internal */
45
32
  export const OpenResponsesRequestToolFunction$outboundSchema = z.object({
46
33
  type: z.literal("function"),
@@ -68,26 +55,28 @@ export const ServiceTier$outboundSchema = z.enum(ServiceTier);
68
55
  /** @internal */
69
56
  export const Truncation$outboundSchema = openEnums.outboundSchema(Truncation);
70
57
  /** @internal */
71
- export const Order$outboundSchema = z.union([
72
- ProviderName$outboundSchema,
73
- z.string(),
74
- ]);
75
- export function orderToJSON(order) {
76
- return JSON.stringify(Order$outboundSchema.parse(order));
58
+ export const OpenResponsesRequestOrder$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
59
+ export function openResponsesRequestOrderToJSON(openResponsesRequestOrder) {
60
+ return JSON.stringify(OpenResponsesRequestOrder$outboundSchema.parse(openResponsesRequestOrder));
77
61
  }
78
62
  /** @internal */
79
- export const Only$outboundSchema = z.union([
80
- ProviderName$outboundSchema,
81
- z.string(),
82
- ]);
83
- export function onlyToJSON(only) {
84
- return JSON.stringify(Only$outboundSchema.parse(only));
63
+ export const OpenResponsesRequestOnly$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
64
+ export function openResponsesRequestOnlyToJSON(openResponsesRequestOnly) {
65
+ return JSON.stringify(OpenResponsesRequestOnly$outboundSchema.parse(openResponsesRequestOnly));
85
66
  }
86
67
  /** @internal */
87
- export const Ignore$outboundSchema = z
88
- .union([ProviderName$outboundSchema, z.string()]);
89
- export function ignoreToJSON(ignore) {
90
- return JSON.stringify(Ignore$outboundSchema.parse(ignore));
68
+ export const OpenResponsesRequestIgnore$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
69
+ export function openResponsesRequestIgnoreToJSON(openResponsesRequestIgnore) {
70
+ return JSON.stringify(OpenResponsesRequestIgnore$outboundSchema.parse(openResponsesRequestIgnore));
71
+ }
72
+ /** @internal */
73
+ export const OpenResponsesRequestSort$outboundSchema = z.union([
74
+ ProviderSort$outboundSchema,
75
+ ProviderSortConfig$outboundSchema,
76
+ z.any(),
77
+ ]);
78
+ export function openResponsesRequestSortToJSON(openResponsesRequestSort) {
79
+ return JSON.stringify(OpenResponsesRequestSort$outboundSchema.parse(openResponsesRequestSort));
91
80
  }
92
81
  /** @internal */
93
82
  export const OpenResponsesRequestMaxPrice$outboundSchema = z.object({
@@ -113,9 +102,15 @@ export const OpenResponsesRequestProvider$outboundSchema = z.object({
113
102
  .optional(),
114
103
  ignore: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()]))).optional(),
115
104
  quantizations: z.nullable(z.array(Quantization$outboundSchema)).optional(),
116
- sort: z.nullable(ProviderSort$outboundSchema).optional(),
105
+ sort: z.nullable(z.union([
106
+ ProviderSort$outboundSchema,
107
+ ProviderSortConfig$outboundSchema,
108
+ z.any(),
109
+ ])).optional(),
117
110
  maxPrice: z.lazy(() => OpenResponsesRequestMaxPrice$outboundSchema)
118
111
  .optional(),
112
+ preferredMinThroughput: z.nullable(z.number()).optional(),
113
+ preferredMaxLatency: z.nullable(z.number()).optional(),
119
114
  minThroughput: z.nullable(z.number()).optional(),
120
115
  maxLatency: z.nullable(z.number()).optional(),
121
116
  }).transform((v) => {
@@ -125,6 +120,8 @@ export const OpenResponsesRequestProvider$outboundSchema = z.object({
125
120
  dataCollection: "data_collection",
126
121
  enforceDistillableText: "enforce_distillable_text",
127
122
  maxPrice: "max_price",
123
+ preferredMinThroughput: "preferred_min_throughput",
124
+ preferredMaxLatency: "preferred_max_latency",
128
125
  minThroughput: "min_throughput",
129
126
  maxLatency: "max_latency",
130
127
  });
@@ -141,37 +138,21 @@ export function openResponsesRequestPluginResponseHealingToJSON(openResponsesReq
141
138
  return JSON.stringify(OpenResponsesRequestPluginResponseHealing$outboundSchema.parse(openResponsesRequestPluginResponseHealing));
142
139
  }
143
140
  /** @internal */
144
- export const OpenResponsesRequestPdfEngine$outboundSchema = openEnums.outboundSchema(OpenResponsesRequestPdfEngine);
145
- /** @internal */
146
- export const OpenResponsesRequestPdf$outboundSchema = z.object({
147
- engine: OpenResponsesRequestPdfEngine$outboundSchema.optional(),
148
- });
149
- export function openResponsesRequestPdfToJSON(openResponsesRequestPdf) {
150
- return JSON.stringify(OpenResponsesRequestPdf$outboundSchema.parse(openResponsesRequestPdf));
151
- }
152
- /** @internal */
153
141
  export const OpenResponsesRequestPluginFileParser$outboundSchema = z.object({
154
142
  id: z.literal("file-parser"),
155
143
  enabled: z.boolean().optional(),
156
- maxFiles: z.number().optional(),
157
- pdf: z.lazy(() => OpenResponsesRequestPdf$outboundSchema).optional(),
158
- }).transform((v) => {
159
- return remap$(v, {
160
- maxFiles: "max_files",
161
- });
144
+ pdf: PDFParserOptions$outboundSchema.optional(),
162
145
  });
163
146
  export function openResponsesRequestPluginFileParserToJSON(openResponsesRequestPluginFileParser) {
164
147
  return JSON.stringify(OpenResponsesRequestPluginFileParser$outboundSchema.parse(openResponsesRequestPluginFileParser));
165
148
  }
166
149
  /** @internal */
167
- export const OpenResponsesRequestEngine$outboundSchema = openEnums.outboundSchema(OpenResponsesRequestEngine);
168
- /** @internal */
169
150
  export const OpenResponsesRequestPluginWeb$outboundSchema = z.object({
170
151
  id: z.literal("web"),
171
152
  enabled: z.boolean().optional(),
172
153
  maxResults: z.number().optional(),
173
154
  searchPrompt: z.string().optional(),
174
- engine: OpenResponsesRequestEngine$outboundSchema.optional(),
155
+ engine: WebSearchEngine$outboundSchema.optional(),
175
156
  }).transform((v) => {
176
157
  return remap$(v, {
177
158
  maxResults: "max_results",
@@ -199,8 +180,6 @@ export function openResponsesRequestPluginUnionToJSON(openResponsesRequestPlugin
199
180
  return JSON.stringify(OpenResponsesRequestPluginUnion$outboundSchema.parse(openResponsesRequestPluginUnion));
200
181
  }
201
182
  /** @internal */
202
- export const OpenResponsesRequestRoute$outboundSchema = openEnums.outboundSchema(OpenResponsesRequestRoute);
203
- /** @internal */
204
183
  export const OpenResponsesRequest$outboundSchema = z.object({
205
184
  input: OpenResponsesInput$outboundSchema.optional(),
206
185
  instructions: z.nullable(z.string()).optional(),
@@ -240,7 +219,6 @@ export const OpenResponsesRequest$outboundSchema = z.object({
240
219
  z.lazy(() => OpenResponsesRequestPluginFileParser$outboundSchema),
241
220
  z.lazy(() => OpenResponsesRequestPluginResponseHealing$outboundSchema),
242
221
  ])).optional(),
243
- route: z.nullable(OpenResponsesRequestRoute$outboundSchema).optional(),
244
222
  user: z.string().optional(),
245
223
  sessionId: z.string().optional(),
246
224
  }).transform((v) => {
@@ -24,104 +24,16 @@ export declare const EncodingFormat: {
24
24
  readonly Base64: "base64";
25
25
  };
26
26
  export type EncodingFormat = OpenEnum<typeof EncodingFormat>;
27
- export type Order = models.ProviderName | string;
28
- export type Only = models.ProviderName | string;
29
- export type Ignore = models.ProviderName | string;
30
- /**
31
- * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
32
- */
33
- export type MaxPrice = {
34
- /**
35
- * A value in string format that is a large number
36
- */
37
- prompt?: string | undefined;
38
- /**
39
- * A value in string format that is a large number
40
- */
41
- completion?: string | undefined;
42
- /**
43
- * A value in string format that is a large number
44
- */
45
- image?: string | undefined;
46
- /**
47
- * A value in string format that is a large number
48
- */
49
- audio?: string | undefined;
50
- /**
51
- * A value in string format that is a large number
52
- */
53
- request?: string | undefined;
54
- };
55
- export type CreateEmbeddingsProvider = {
56
- /**
57
- * Whether to allow backup providers to serve requests
58
- *
59
- * @remarks
60
- * - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
61
- * - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
62
- */
63
- allowFallbacks?: boolean | null | undefined;
64
- /**
65
- * Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
66
- */
67
- requireParameters?: boolean | null | undefined;
68
- /**
69
- * Data collection setting. If no available model provider meets the requirement, your request will return an error.
70
- *
71
- * @remarks
72
- * - allow: (default) allow providers which store user data non-transiently and may train on it
73
- *
74
- * - deny: use only providers which do not collect user data.
75
- */
76
- dataCollection?: models.DataCollection | null | undefined;
77
- /**
78
- * Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
79
- */
80
- zdr?: boolean | null | undefined;
81
- /**
82
- * Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
83
- */
84
- enforceDistillableText?: boolean | null | undefined;
85
- /**
86
- * An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
87
- */
88
- order?: Array<models.ProviderName | string> | null | undefined;
89
- /**
90
- * List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
91
- */
92
- only?: Array<models.ProviderName | string> | null | undefined;
93
- /**
94
- * List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
95
- */
96
- ignore?: Array<models.ProviderName | string> | null | undefined;
97
- /**
98
- * A list of quantization levels to filter the provider by.
99
- */
100
- quantizations?: Array<models.Quantization> | null | undefined;
101
- /**
102
- * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
103
- */
104
- sort?: models.ProviderSort | null | undefined;
105
- /**
106
- * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
107
- */
108
- maxPrice?: MaxPrice | undefined;
109
- /**
110
- * The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used.
111
- */
112
- minThroughput?: number | null | undefined;
113
- /**
114
- * The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used.
115
- */
116
- maxLatency?: number | null | undefined;
117
- };
118
27
  export type CreateEmbeddingsRequest = {
119
28
  input: string | Array<string> | Array<number> | Array<Array<number>> | Array<Input>;
120
29
  model: string;
121
30
  encodingFormat?: EncodingFormat | undefined;
122
31
  dimensions?: number | undefined;
123
32
  user?: string | undefined;
124
- provider?: CreateEmbeddingsProvider | undefined;
33
+ /**
34
+ * Provider routing preferences for the request.
35
+ */
36
+ provider?: models.ProviderPreferences | undefined;
125
37
  inputType?: string | undefined;
126
38
  };
127
39
  export declare const ObjectT: {
@@ -197,58 +109,13 @@ export declare function inputUnionToJSON(inputUnion: InputUnion): string;
197
109
  /** @internal */
198
110
  export declare const EncodingFormat$outboundSchema: z.ZodType<string, EncodingFormat>;
199
111
  /** @internal */
200
- export type Order$Outbound = string | string;
201
- /** @internal */
202
- export declare const Order$outboundSchema: z.ZodType<Order$Outbound, Order>;
203
- export declare function orderToJSON(order: Order): string;
204
- /** @internal */
205
- export type Only$Outbound = string | string;
206
- /** @internal */
207
- export declare const Only$outboundSchema: z.ZodType<Only$Outbound, Only>;
208
- export declare function onlyToJSON(only: Only): string;
209
- /** @internal */
210
- export type Ignore$Outbound = string | string;
211
- /** @internal */
212
- export declare const Ignore$outboundSchema: z.ZodType<Ignore$Outbound, Ignore>;
213
- export declare function ignoreToJSON(ignore: Ignore): string;
214
- /** @internal */
215
- export type MaxPrice$Outbound = {
216
- prompt?: string | undefined;
217
- completion?: string | undefined;
218
- image?: string | undefined;
219
- audio?: string | undefined;
220
- request?: string | undefined;
221
- };
222
- /** @internal */
223
- export declare const MaxPrice$outboundSchema: z.ZodType<MaxPrice$Outbound, MaxPrice>;
224
- export declare function maxPriceToJSON(maxPrice: MaxPrice): string;
225
- /** @internal */
226
- export type CreateEmbeddingsProvider$Outbound = {
227
- allow_fallbacks?: boolean | null | undefined;
228
- require_parameters?: boolean | null | undefined;
229
- data_collection?: string | null | undefined;
230
- zdr?: boolean | null | undefined;
231
- enforce_distillable_text?: boolean | null | undefined;
232
- order?: Array<string | string> | null | undefined;
233
- only?: Array<string | string> | null | undefined;
234
- ignore?: Array<string | string> | null | undefined;
235
- quantizations?: Array<string> | null | undefined;
236
- sort?: string | null | undefined;
237
- max_price?: MaxPrice$Outbound | undefined;
238
- min_throughput?: number | null | undefined;
239
- max_latency?: number | null | undefined;
240
- };
241
- /** @internal */
242
- export declare const CreateEmbeddingsProvider$outboundSchema: z.ZodType<CreateEmbeddingsProvider$Outbound, CreateEmbeddingsProvider>;
243
- export declare function createEmbeddingsProviderToJSON(createEmbeddingsProvider: CreateEmbeddingsProvider): string;
244
- /** @internal */
245
112
  export type CreateEmbeddingsRequest$Outbound = {
246
113
  input: string | Array<string> | Array<number> | Array<Array<number>> | Array<Input$Outbound>;
247
114
  model: string;
248
115
  encoding_format?: string | undefined;
249
116
  dimensions?: number | undefined;
250
117
  user?: string | undefined;
251
- provider?: CreateEmbeddingsProvider$Outbound | undefined;
118
+ provider?: models.ProviderPreferences$Outbound | undefined;
252
119
  input_type?: string | undefined;
253
120
  };
254
121
  /** @internal */
@@ -77,70 +77,6 @@ export function inputUnionToJSON(inputUnion) {
77
77
  /** @internal */
78
78
  export const EncodingFormat$outboundSchema = openEnums.outboundSchema(EncodingFormat);
79
79
  /** @internal */
80
- export const Order$outboundSchema = z.union([
81
- models.ProviderName$outboundSchema,
82
- z.string(),
83
- ]);
84
- export function orderToJSON(order) {
85
- return JSON.stringify(Order$outboundSchema.parse(order));
86
- }
87
- /** @internal */
88
- export const Only$outboundSchema = z.union([
89
- models.ProviderName$outboundSchema,
90
- z.string(),
91
- ]);
92
- export function onlyToJSON(only) {
93
- return JSON.stringify(Only$outboundSchema.parse(only));
94
- }
95
- /** @internal */
96
- export const Ignore$outboundSchema = z
97
- .union([models.ProviderName$outboundSchema, z.string()]);
98
- export function ignoreToJSON(ignore) {
99
- return JSON.stringify(Ignore$outboundSchema.parse(ignore));
100
- }
101
- /** @internal */
102
- export const MaxPrice$outboundSchema = z
103
- .object({
104
- prompt: z.string().optional(),
105
- completion: z.string().optional(),
106
- image: z.string().optional(),
107
- audio: z.string().optional(),
108
- request: z.string().optional(),
109
- });
110
- export function maxPriceToJSON(maxPrice) {
111
- return JSON.stringify(MaxPrice$outboundSchema.parse(maxPrice));
112
- }
113
- /** @internal */
114
- export const CreateEmbeddingsProvider$outboundSchema = z.object({
115
- allowFallbacks: z.nullable(z.boolean()).optional(),
116
- requireParameters: z.nullable(z.boolean()).optional(),
117
- dataCollection: z.nullable(models.DataCollection$outboundSchema).optional(),
118
- zdr: z.nullable(z.boolean()).optional(),
119
- enforceDistillableText: z.nullable(z.boolean()).optional(),
120
- order: z.nullable(z.array(z.union([models.ProviderName$outboundSchema, z.string()]))).optional(),
121
- only: z.nullable(z.array(z.union([models.ProviderName$outboundSchema, z.string()]))).optional(),
122
- ignore: z.nullable(z.array(z.union([models.ProviderName$outboundSchema, z.string()]))).optional(),
123
- quantizations: z.nullable(z.array(models.Quantization$outboundSchema))
124
- .optional(),
125
- sort: z.nullable(models.ProviderSort$outboundSchema).optional(),
126
- maxPrice: z.lazy(() => MaxPrice$outboundSchema).optional(),
127
- minThroughput: z.nullable(z.number()).optional(),
128
- maxLatency: z.nullable(z.number()).optional(),
129
- }).transform((v) => {
130
- return remap$(v, {
131
- allowFallbacks: "allow_fallbacks",
132
- requireParameters: "require_parameters",
133
- dataCollection: "data_collection",
134
- enforceDistillableText: "enforce_distillable_text",
135
- maxPrice: "max_price",
136
- minThroughput: "min_throughput",
137
- maxLatency: "max_latency",
138
- });
139
- });
140
- export function createEmbeddingsProviderToJSON(createEmbeddingsProvider) {
141
- return JSON.stringify(CreateEmbeddingsProvider$outboundSchema.parse(createEmbeddingsProvider));
142
- }
143
- /** @internal */
144
80
  export const CreateEmbeddingsRequest$outboundSchema = z.object({
145
81
  input: z.union([
146
82
  z.string(),
@@ -153,7 +89,7 @@ export const CreateEmbeddingsRequest$outboundSchema = z.object({
153
89
  encodingFormat: EncodingFormat$outboundSchema.optional(),
154
90
  dimensions: z.int().optional(),
155
91
  user: z.string().optional(),
156
- provider: z.lazy(() => CreateEmbeddingsProvider$outboundSchema).optional(),
92
+ provider: models.ProviderPreferences$outboundSchema.optional(),
157
93
  inputType: z.string().optional(),
158
94
  }).transform((v) => {
159
95
  return remap$(v, {