@openrouter/sdk 0.2.9 → 0.3.1

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 (49) hide show
  1. package/esm/funcs/embeddingsGenerate.js +4 -2
  2. package/esm/lib/config.d.ts +2 -2
  3. package/esm/lib/config.js +2 -2
  4. package/esm/models/chatgenerationparams.d.ts +234 -6
  5. package/esm/models/chatgenerationparams.js +162 -5
  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 +8 -0
  11. package/esm/models/index.js +8 -0
  12. package/esm/models/openairesponsesreasoningeffort.d.ts +1 -0
  13. package/esm/models/openairesponsesreasoningeffort.js +1 -0
  14. package/esm/models/openresponsesrequest.d.ts +128 -93
  15. package/esm/models/openresponsesrequest.js +82 -87
  16. package/esm/models/operations/createembeddings.d.ts +10 -129
  17. package/esm/models/operations/createembeddings.js +10 -62
  18. package/esm/models/operations/getparameters.d.ts +3 -72
  19. package/esm/models/operations/getparameters.js +3 -71
  20. package/esm/models/parameter.d.ts +1 -0
  21. package/esm/models/parameter.js +1 -0
  22. package/esm/models/pdfparserengine.d.ts +17 -0
  23. package/esm/models/pdfparserengine.js +15 -0
  24. package/esm/models/pdfparseroptions.d.ts +19 -0
  25. package/esm/models/pdfparseroptions.js +13 -0
  26. package/esm/models/providername.d.ts +3 -0
  27. package/esm/models/providername.js +3 -0
  28. package/esm/models/providerpreferences.d.ts +215 -0
  29. package/esm/models/providerpreferences.js +135 -0
  30. package/esm/models/providersort.d.ts +0 -6
  31. package/esm/models/providersort.js +0 -3
  32. package/esm/models/providersortconfig.d.ts +23 -0
  33. package/esm/models/providersortconfig.js +22 -0
  34. package/esm/models/providersortunion.d.ts +10 -0
  35. package/esm/models/providersortunion.js +12 -0
  36. package/esm/models/publicendpoint.d.ts +24 -24
  37. package/esm/models/publicendpoint.js +12 -12
  38. package/esm/models/publicpricing.d.ts +24 -24
  39. package/esm/models/publicpricing.js +12 -12
  40. package/esm/models/schema0.d.ts +83 -0
  41. package/esm/models/schema0.js +85 -0
  42. package/esm/models/schema3.d.ts +50 -0
  43. package/esm/models/schema3.js +60 -0
  44. package/esm/models/websearchengine.d.ts +16 -0
  45. package/esm/models/websearchengine.js +14 -0
  46. package/esm/types/discriminatedUnion.d.ts +25 -0
  47. package/esm/types/discriminatedUnion.js +57 -0
  48. package/jsr.json +1 -1
  49. package/package.json +1 -1
@@ -29,7 +29,7 @@ async function $do(client, request, options) {
29
29
  const path = pathToFunc("/embeddings")();
30
30
  const headers = new Headers(compactMap({
31
31
  "Content-Type": "application/json",
32
- Accept: "application/json",
32
+ Accept: "application/json;q=1, text/event-stream;q=0",
33
33
  }));
34
34
  const secConfig = await extractSecurity(client._options.apiKey);
35
35
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -86,7 +86,9 @@ async function $do(client, request, options) {
86
86
  const responseFields = {
87
87
  HttpMeta: { Response: response, Request: req },
88
88
  };
89
- const [result] = await M.match(M.json(200, operations.CreateEmbeddingsResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
89
+ const [result] = await M.match(M.json(200, operations.CreateEmbeddingsResponse$inboundSchema), M.text(200, operations.CreateEmbeddingsResponse$inboundSchema, {
90
+ ctype: "text/event-stream",
91
+ }), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
90
92
  if (!result.ok) {
91
93
  return [result, { status: "complete", request: req, response }];
92
94
  }
@@ -45,8 +45,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
45
45
  export declare const SDK_METADATA: {
46
46
  readonly language: "typescript";
47
47
  readonly openapiDocVersion: "1.0.0";
48
- readonly sdkVersion: "0.2.9";
48
+ readonly sdkVersion: "0.3.1";
49
49
  readonly genVersion: "2.768.0";
50
- readonly userAgent: "speakeasy-sdk/typescript 0.2.9 2.768.0 1.0.0 @openrouter/sdk";
50
+ readonly userAgent: "speakeasy-sdk/typescript 0.3.1 2.768.0 1.0.0 @openrouter/sdk";
51
51
  };
52
52
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -25,8 +25,8 @@ export function serverURLFromOptions(options) {
25
25
  export const SDK_METADATA = {
26
26
  language: "typescript",
27
27
  openapiDocVersion: "1.0.0",
28
- sdkVersion: "0.2.9",
28
+ sdkVersion: "0.3.1",
29
29
  genVersion: "2.768.0",
30
- userAgent: "speakeasy-sdk/typescript 0.2.9 2.768.0 1.0.0 @openrouter/sdk",
30
+ userAgent: "speakeasy-sdk/typescript 0.3.1 2.768.0 1.0.0 @openrouter/sdk",
31
31
  };
32
32
  //# sourceMappingURL=config.js.map
@@ -2,16 +2,138 @@ import * as z from "zod/v4";
2
2
  import { OpenEnum } from "../types/enums.js";
3
3
  import { ChatStreamOptions, ChatStreamOptions$Outbound } from "./chatstreamoptions.js";
4
4
  import { Message, Message$Outbound } from "./message.js";
5
+ import { ProviderSortUnion, ProviderSortUnion$Outbound } from "./providersortunion.js";
5
6
  import { ReasoningSummaryVerbosity } from "./reasoningsummaryverbosity.js";
6
7
  import { ResponseFormatJSONSchema, ResponseFormatJSONSchema$Outbound } from "./responseformatjsonschema.js";
7
8
  import { ResponseFormatTextGrammar, ResponseFormatTextGrammar$Outbound } from "./responseformattextgrammar.js";
9
+ import { Schema0, Schema0$Outbound } from "./schema0.js";
8
10
  import { ToolDefinitionJson, ToolDefinitionJson$Outbound } from "./tooldefinitionjson.js";
11
+ export declare const ChatGenerationParamsDataCollection: {
12
+ readonly Deny: "deny";
13
+ readonly Allow: "allow";
14
+ };
15
+ export type ChatGenerationParamsDataCollection = OpenEnum<typeof ChatGenerationParamsDataCollection>;
16
+ export declare const Quantizations: {
17
+ readonly Int4: "int4";
18
+ readonly Int8: "int8";
19
+ readonly Fp4: "fp4";
20
+ readonly Fp6: "fp6";
21
+ readonly Fp8: "fp8";
22
+ readonly Fp16: "fp16";
23
+ readonly Bf16: "bf16";
24
+ readonly Fp32: "fp32";
25
+ readonly Unknown: "unknown";
26
+ };
27
+ export type Quantizations = OpenEnum<typeof Quantizations>;
28
+ /**
29
+ * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
30
+ */
31
+ export type ChatGenerationParamsMaxPrice = {
32
+ prompt?: any | undefined;
33
+ completion?: any | undefined;
34
+ image?: any | undefined;
35
+ audio?: any | undefined;
36
+ request?: any | undefined;
37
+ };
38
+ export type ChatGenerationParamsProvider = {
39
+ /**
40
+ * Whether to allow backup providers to serve requests
41
+ *
42
+ * @remarks
43
+ * - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
44
+ * - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
45
+ */
46
+ allowFallbacks?: boolean | null | undefined;
47
+ /**
48
+ * 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.
49
+ */
50
+ requireParameters?: boolean | null | undefined;
51
+ /**
52
+ * Data collection setting. If no available model provider meets the requirement, your request will return an error.
53
+ *
54
+ * @remarks
55
+ * - allow: (default) allow providers which store user data non-transiently and may train on it
56
+ *
57
+ * - deny: use only providers which do not collect user data.
58
+ */
59
+ dataCollection?: ChatGenerationParamsDataCollection | null | undefined;
60
+ zdr?: boolean | null | undefined;
61
+ enforceDistillableText?: boolean | null | undefined;
62
+ /**
63
+ * 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.
64
+ */
65
+ order?: Array<Schema0> | null | undefined;
66
+ /**
67
+ * List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
68
+ */
69
+ only?: Array<Schema0> | null | undefined;
70
+ /**
71
+ * List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
72
+ */
73
+ ignore?: Array<Schema0> | null | undefined;
74
+ /**
75
+ * A list of quantization levels to filter the provider by.
76
+ */
77
+ quantizations?: Array<Quantizations> | null | undefined;
78
+ /**
79
+ * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
80
+ */
81
+ sort?: ProviderSortUnion | null | undefined;
82
+ /**
83
+ * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
84
+ */
85
+ maxPrice?: ChatGenerationParamsMaxPrice | undefined;
86
+ preferredMinThroughput?: number | null | undefined;
87
+ preferredMaxLatency?: number | null | undefined;
88
+ minThroughput?: number | null | undefined;
89
+ maxLatency?: number | null | undefined;
90
+ };
91
+ export type ChatGenerationParamsPluginResponseHealing = {
92
+ id: "response-healing";
93
+ enabled?: boolean | undefined;
94
+ };
95
+ export declare const PdfEngine: {
96
+ readonly MistralOcr: "mistral-ocr";
97
+ readonly PdfText: "pdf-text";
98
+ readonly Native: "native";
99
+ };
100
+ export type PdfEngine = OpenEnum<typeof PdfEngine>;
101
+ export type Pdf = {
102
+ engine?: PdfEngine | undefined;
103
+ };
104
+ export type ChatGenerationParamsPluginFileParser = {
105
+ id: "file-parser";
106
+ enabled?: boolean | undefined;
107
+ pdf?: Pdf | undefined;
108
+ };
109
+ export declare const Engine: {
110
+ readonly Native: "native";
111
+ readonly Exa: "exa";
112
+ };
113
+ export type Engine = OpenEnum<typeof Engine>;
114
+ export type ChatGenerationParamsPluginWeb = {
115
+ id: "web";
116
+ enabled?: boolean | undefined;
117
+ maxResults?: number | undefined;
118
+ searchPrompt?: string | undefined;
119
+ engine?: Engine | undefined;
120
+ };
121
+ export type ChatGenerationParamsPluginModeration = {
122
+ id: "moderation";
123
+ };
124
+ export type ChatGenerationParamsPluginUnion = ChatGenerationParamsPluginModeration | ChatGenerationParamsPluginWeb | ChatGenerationParamsPluginFileParser | ChatGenerationParamsPluginResponseHealing;
125
+ export declare const Route: {
126
+ readonly Fallback: "fallback";
127
+ readonly Sort: "sort";
128
+ };
129
+ export type Route = OpenEnum<typeof Route>;
9
130
  export declare const Effort: {
10
- readonly None: "none";
11
- readonly Minimal: "minimal";
12
- readonly Low: "low";
13
- readonly Medium: "medium";
131
+ readonly Xhigh: "xhigh";
14
132
  readonly High: "high";
133
+ readonly Medium: "medium";
134
+ readonly Low: "low";
135
+ readonly Minimal: "minimal";
136
+ readonly None: "none";
15
137
  };
16
138
  export type Effort = OpenEnum<typeof Effort>;
17
139
  export type Reasoning = {
@@ -33,6 +155,20 @@ export type Debug = {
33
155
  echoUpstreamBody?: boolean | undefined;
34
156
  };
35
157
  export type ChatGenerationParams = {
158
+ /**
159
+ * When multiple model providers are available, optionally indicate your routing preference.
160
+ */
161
+ provider?: ChatGenerationParamsProvider | null | undefined;
162
+ /**
163
+ * Plugins you want to enable for this request, including their settings.
164
+ */
165
+ plugins?: Array<ChatGenerationParamsPluginModeration | ChatGenerationParamsPluginWeb | ChatGenerationParamsPluginFileParser | ChatGenerationParamsPluginResponseHealing> | undefined;
166
+ route?: Route | null | undefined;
167
+ user?: string | undefined;
168
+ /**
169
+ * A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
170
+ */
171
+ sessionId?: string | undefined;
36
172
  messages: Array<Message>;
37
173
  model?: string | undefined;
38
174
  models?: Array<string> | undefined;
@@ -58,10 +194,98 @@ export type ChatGenerationParams = {
58
194
  toolChoice?: any | undefined;
59
195
  tools?: Array<ToolDefinitionJson> | undefined;
60
196
  topP?: number | null | undefined;
61
- user?: string | undefined;
62
197
  debug?: Debug | undefined;
63
198
  };
64
199
  /** @internal */
200
+ export declare const ChatGenerationParamsDataCollection$outboundSchema: z.ZodType<string, ChatGenerationParamsDataCollection>;
201
+ /** @internal */
202
+ export declare const Quantizations$outboundSchema: z.ZodType<string, Quantizations>;
203
+ /** @internal */
204
+ export type ChatGenerationParamsMaxPrice$Outbound = {
205
+ prompt?: any | undefined;
206
+ completion?: any | undefined;
207
+ image?: any | undefined;
208
+ audio?: any | undefined;
209
+ request?: any | undefined;
210
+ };
211
+ /** @internal */
212
+ export declare const ChatGenerationParamsMaxPrice$outboundSchema: z.ZodType<ChatGenerationParamsMaxPrice$Outbound, ChatGenerationParamsMaxPrice>;
213
+ export declare function chatGenerationParamsMaxPriceToJSON(chatGenerationParamsMaxPrice: ChatGenerationParamsMaxPrice): string;
214
+ /** @internal */
215
+ export type ChatGenerationParamsProvider$Outbound = {
216
+ allow_fallbacks?: boolean | null | undefined;
217
+ require_parameters?: boolean | null | undefined;
218
+ data_collection?: string | null | undefined;
219
+ zdr?: boolean | null | undefined;
220
+ enforce_distillable_text?: boolean | null | undefined;
221
+ order?: Array<Schema0$Outbound> | null | undefined;
222
+ only?: Array<Schema0$Outbound> | null | undefined;
223
+ ignore?: Array<Schema0$Outbound> | null | undefined;
224
+ quantizations?: Array<string> | null | undefined;
225
+ sort?: ProviderSortUnion$Outbound | null | undefined;
226
+ 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;
231
+ };
232
+ /** @internal */
233
+ export declare const ChatGenerationParamsProvider$outboundSchema: z.ZodType<ChatGenerationParamsProvider$Outbound, ChatGenerationParamsProvider>;
234
+ export declare function chatGenerationParamsProviderToJSON(chatGenerationParamsProvider: ChatGenerationParamsProvider): string;
235
+ /** @internal */
236
+ export type ChatGenerationParamsPluginResponseHealing$Outbound = {
237
+ id: "response-healing";
238
+ enabled?: boolean | undefined;
239
+ };
240
+ /** @internal */
241
+ export declare const ChatGenerationParamsPluginResponseHealing$outboundSchema: z.ZodType<ChatGenerationParamsPluginResponseHealing$Outbound, ChatGenerationParamsPluginResponseHealing>;
242
+ export declare function chatGenerationParamsPluginResponseHealingToJSON(chatGenerationParamsPluginResponseHealing: ChatGenerationParamsPluginResponseHealing): string;
243
+ /** @internal */
244
+ export declare const PdfEngine$outboundSchema: z.ZodType<string, PdfEngine>;
245
+ /** @internal */
246
+ export type Pdf$Outbound = {
247
+ engine?: string | undefined;
248
+ };
249
+ /** @internal */
250
+ export declare const Pdf$outboundSchema: z.ZodType<Pdf$Outbound, Pdf>;
251
+ export declare function pdfToJSON(pdf: Pdf): string;
252
+ /** @internal */
253
+ export type ChatGenerationParamsPluginFileParser$Outbound = {
254
+ id: "file-parser";
255
+ enabled?: boolean | undefined;
256
+ pdf?: Pdf$Outbound | undefined;
257
+ };
258
+ /** @internal */
259
+ export declare const ChatGenerationParamsPluginFileParser$outboundSchema: z.ZodType<ChatGenerationParamsPluginFileParser$Outbound, ChatGenerationParamsPluginFileParser>;
260
+ export declare function chatGenerationParamsPluginFileParserToJSON(chatGenerationParamsPluginFileParser: ChatGenerationParamsPluginFileParser): string;
261
+ /** @internal */
262
+ export declare const Engine$outboundSchema: z.ZodType<string, Engine>;
263
+ /** @internal */
264
+ export type ChatGenerationParamsPluginWeb$Outbound = {
265
+ id: "web";
266
+ enabled?: boolean | undefined;
267
+ max_results?: number | undefined;
268
+ search_prompt?: string | undefined;
269
+ engine?: string | undefined;
270
+ };
271
+ /** @internal */
272
+ export declare const ChatGenerationParamsPluginWeb$outboundSchema: z.ZodType<ChatGenerationParamsPluginWeb$Outbound, ChatGenerationParamsPluginWeb>;
273
+ export declare function chatGenerationParamsPluginWebToJSON(chatGenerationParamsPluginWeb: ChatGenerationParamsPluginWeb): string;
274
+ /** @internal */
275
+ export type ChatGenerationParamsPluginModeration$Outbound = {
276
+ id: "moderation";
277
+ };
278
+ /** @internal */
279
+ export declare const ChatGenerationParamsPluginModeration$outboundSchema: z.ZodType<ChatGenerationParamsPluginModeration$Outbound, ChatGenerationParamsPluginModeration>;
280
+ export declare function chatGenerationParamsPluginModerationToJSON(chatGenerationParamsPluginModeration: ChatGenerationParamsPluginModeration): string;
281
+ /** @internal */
282
+ export type ChatGenerationParamsPluginUnion$Outbound = ChatGenerationParamsPluginModeration$Outbound | ChatGenerationParamsPluginWeb$Outbound | ChatGenerationParamsPluginFileParser$Outbound | ChatGenerationParamsPluginResponseHealing$Outbound;
283
+ /** @internal */
284
+ export declare const ChatGenerationParamsPluginUnion$outboundSchema: z.ZodType<ChatGenerationParamsPluginUnion$Outbound, ChatGenerationParamsPluginUnion>;
285
+ export declare function chatGenerationParamsPluginUnionToJSON(chatGenerationParamsPluginUnion: ChatGenerationParamsPluginUnion): string;
286
+ /** @internal */
287
+ export declare const Route$outboundSchema: z.ZodType<string, Route>;
288
+ /** @internal */
65
289
  export declare const Effort$outboundSchema: z.ZodType<string, Effort>;
66
290
  /** @internal */
67
291
  export type Reasoning$Outbound = {
@@ -111,6 +335,11 @@ export declare const Debug$outboundSchema: z.ZodType<Debug$Outbound, Debug>;
111
335
  export declare function debugToJSON(debug: Debug): string;
112
336
  /** @internal */
113
337
  export type ChatGenerationParams$Outbound = {
338
+ provider?: ChatGenerationParamsProvider$Outbound | null | undefined;
339
+ plugins?: Array<ChatGenerationParamsPluginModeration$Outbound | ChatGenerationParamsPluginWeb$Outbound | ChatGenerationParamsPluginFileParser$Outbound | ChatGenerationParamsPluginResponseHealing$Outbound> | undefined;
340
+ route?: string | null | undefined;
341
+ user?: string | undefined;
342
+ session_id?: string | undefined;
114
343
  messages: Array<Message$Outbound>;
115
344
  model?: string | undefined;
116
345
  models?: Array<string> | undefined;
@@ -136,7 +365,6 @@ export type ChatGenerationParams$Outbound = {
136
365
  tool_choice?: any | undefined;
137
366
  tools?: Array<ToolDefinitionJson$Outbound> | undefined;
138
367
  top_p?: number | null | undefined;
139
- user?: string | undefined;
140
368
  debug?: Debug$Outbound | undefined;
141
369
  };
142
370
  /** @internal */
@@ -6,18 +6,165 @@ import { remap as remap$ } from "../lib/primitives.js";
6
6
  import * as openEnums from "../types/enums.js";
7
7
  import { ChatStreamOptions$outboundSchema, } from "./chatstreamoptions.js";
8
8
  import { Message$outboundSchema, } from "./message.js";
9
+ import { ProviderSortUnion$outboundSchema, } from "./providersortunion.js";
9
10
  import { ReasoningSummaryVerbosity$outboundSchema, } from "./reasoningsummaryverbosity.js";
10
11
  import { ResponseFormatJSONSchema$outboundSchema, } from "./responseformatjsonschema.js";
11
12
  import { ResponseFormatTextGrammar$outboundSchema, } from "./responseformattextgrammar.js";
13
+ import { Schema0$outboundSchema, } from "./schema0.js";
12
14
  import { ToolDefinitionJson$outboundSchema, } from "./tooldefinitionjson.js";
15
+ export const ChatGenerationParamsDataCollection = {
16
+ Deny: "deny",
17
+ Allow: "allow",
18
+ };
19
+ export const Quantizations = {
20
+ Int4: "int4",
21
+ Int8: "int8",
22
+ Fp4: "fp4",
23
+ Fp6: "fp6",
24
+ Fp8: "fp8",
25
+ Fp16: "fp16",
26
+ Bf16: "bf16",
27
+ Fp32: "fp32",
28
+ Unknown: "unknown",
29
+ };
30
+ export const PdfEngine = {
31
+ MistralOcr: "mistral-ocr",
32
+ PdfText: "pdf-text",
33
+ Native: "native",
34
+ };
35
+ export const Engine = {
36
+ Native: "native",
37
+ Exa: "exa",
38
+ };
39
+ export const Route = {
40
+ Fallback: "fallback",
41
+ Sort: "sort",
42
+ };
13
43
  export const Effort = {
14
- None: "none",
15
- Minimal: "minimal",
16
- Low: "low",
17
- Medium: "medium",
44
+ Xhigh: "xhigh",
18
45
  High: "high",
46
+ Medium: "medium",
47
+ Low: "low",
48
+ Minimal: "minimal",
49
+ None: "none",
19
50
  };
20
51
  /** @internal */
52
+ export const ChatGenerationParamsDataCollection$outboundSchema = openEnums.outboundSchema(ChatGenerationParamsDataCollection);
53
+ /** @internal */
54
+ export const Quantizations$outboundSchema = openEnums.outboundSchema(Quantizations);
55
+ /** @internal */
56
+ export const ChatGenerationParamsMaxPrice$outboundSchema = z.object({
57
+ prompt: z.any().optional(),
58
+ completion: z.any().optional(),
59
+ image: z.any().optional(),
60
+ audio: z.any().optional(),
61
+ request: z.any().optional(),
62
+ });
63
+ export function chatGenerationParamsMaxPriceToJSON(chatGenerationParamsMaxPrice) {
64
+ return JSON.stringify(ChatGenerationParamsMaxPrice$outboundSchema.parse(chatGenerationParamsMaxPrice));
65
+ }
66
+ /** @internal */
67
+ export const ChatGenerationParamsProvider$outboundSchema = z.object({
68
+ allowFallbacks: z.nullable(z.boolean()).optional(),
69
+ requireParameters: z.nullable(z.boolean()).optional(),
70
+ dataCollection: z.nullable(ChatGenerationParamsDataCollection$outboundSchema)
71
+ .optional(),
72
+ zdr: z.nullable(z.boolean()).optional(),
73
+ enforceDistillableText: z.nullable(z.boolean()).optional(),
74
+ order: z.nullable(z.array(Schema0$outboundSchema)).optional(),
75
+ only: z.nullable(z.array(Schema0$outboundSchema)).optional(),
76
+ ignore: z.nullable(z.array(Schema0$outboundSchema)).optional(),
77
+ quantizations: z.nullable(z.array(Quantizations$outboundSchema)).optional(),
78
+ sort: z.nullable(ProviderSortUnion$outboundSchema).optional(),
79
+ maxPrice: z.lazy(() => ChatGenerationParamsMaxPrice$outboundSchema)
80
+ .optional(),
81
+ preferredMinThroughput: z.nullable(z.number()).optional(),
82
+ preferredMaxLatency: z.nullable(z.number()).optional(),
83
+ minThroughput: z.nullable(z.number()).optional(),
84
+ maxLatency: z.nullable(z.number()).optional(),
85
+ }).transform((v) => {
86
+ return remap$(v, {
87
+ allowFallbacks: "allow_fallbacks",
88
+ requireParameters: "require_parameters",
89
+ dataCollection: "data_collection",
90
+ enforceDistillableText: "enforce_distillable_text",
91
+ maxPrice: "max_price",
92
+ preferredMinThroughput: "preferred_min_throughput",
93
+ preferredMaxLatency: "preferred_max_latency",
94
+ minThroughput: "min_throughput",
95
+ maxLatency: "max_latency",
96
+ });
97
+ });
98
+ export function chatGenerationParamsProviderToJSON(chatGenerationParamsProvider) {
99
+ return JSON.stringify(ChatGenerationParamsProvider$outboundSchema.parse(chatGenerationParamsProvider));
100
+ }
101
+ /** @internal */
102
+ export const ChatGenerationParamsPluginResponseHealing$outboundSchema = z.object({
103
+ id: z.literal("response-healing"),
104
+ enabled: z.boolean().optional(),
105
+ });
106
+ export function chatGenerationParamsPluginResponseHealingToJSON(chatGenerationParamsPluginResponseHealing) {
107
+ return JSON.stringify(ChatGenerationParamsPluginResponseHealing$outboundSchema.parse(chatGenerationParamsPluginResponseHealing));
108
+ }
109
+ /** @internal */
110
+ export const PdfEngine$outboundSchema = openEnums
111
+ .outboundSchema(PdfEngine);
112
+ /** @internal */
113
+ export const Pdf$outboundSchema = z.object({
114
+ engine: PdfEngine$outboundSchema.optional(),
115
+ });
116
+ export function pdfToJSON(pdf) {
117
+ return JSON.stringify(Pdf$outboundSchema.parse(pdf));
118
+ }
119
+ /** @internal */
120
+ export const ChatGenerationParamsPluginFileParser$outboundSchema = z.object({
121
+ id: z.literal("file-parser"),
122
+ enabled: z.boolean().optional(),
123
+ pdf: z.lazy(() => Pdf$outboundSchema).optional(),
124
+ });
125
+ export function chatGenerationParamsPluginFileParserToJSON(chatGenerationParamsPluginFileParser) {
126
+ return JSON.stringify(ChatGenerationParamsPluginFileParser$outboundSchema.parse(chatGenerationParamsPluginFileParser));
127
+ }
128
+ /** @internal */
129
+ export const Engine$outboundSchema = openEnums
130
+ .outboundSchema(Engine);
131
+ /** @internal */
132
+ export const ChatGenerationParamsPluginWeb$outboundSchema = z.object({
133
+ id: z.literal("web"),
134
+ enabled: z.boolean().optional(),
135
+ maxResults: z.number().optional(),
136
+ searchPrompt: z.string().optional(),
137
+ engine: Engine$outboundSchema.optional(),
138
+ }).transform((v) => {
139
+ return remap$(v, {
140
+ maxResults: "max_results",
141
+ searchPrompt: "search_prompt",
142
+ });
143
+ });
144
+ export function chatGenerationParamsPluginWebToJSON(chatGenerationParamsPluginWeb) {
145
+ return JSON.stringify(ChatGenerationParamsPluginWeb$outboundSchema.parse(chatGenerationParamsPluginWeb));
146
+ }
147
+ /** @internal */
148
+ export const ChatGenerationParamsPluginModeration$outboundSchema = z.object({
149
+ id: z.literal("moderation"),
150
+ });
151
+ export function chatGenerationParamsPluginModerationToJSON(chatGenerationParamsPluginModeration) {
152
+ return JSON.stringify(ChatGenerationParamsPluginModeration$outboundSchema.parse(chatGenerationParamsPluginModeration));
153
+ }
154
+ /** @internal */
155
+ export const ChatGenerationParamsPluginUnion$outboundSchema = z.union([
156
+ z.lazy(() => ChatGenerationParamsPluginModeration$outboundSchema),
157
+ z.lazy(() => ChatGenerationParamsPluginWeb$outboundSchema),
158
+ z.lazy(() => ChatGenerationParamsPluginFileParser$outboundSchema),
159
+ z.lazy(() => ChatGenerationParamsPluginResponseHealing$outboundSchema),
160
+ ]);
161
+ export function chatGenerationParamsPluginUnionToJSON(chatGenerationParamsPluginUnion) {
162
+ return JSON.stringify(ChatGenerationParamsPluginUnion$outboundSchema.parse(chatGenerationParamsPluginUnion));
163
+ }
164
+ /** @internal */
165
+ export const Route$outboundSchema = openEnums
166
+ .outboundSchema(Route);
167
+ /** @internal */
21
168
  export const Effort$outboundSchema = openEnums
22
169
  .outboundSchema(Effort);
23
170
  /** @internal */
@@ -78,6 +225,16 @@ export function debugToJSON(debug) {
78
225
  }
79
226
  /** @internal */
80
227
  export const ChatGenerationParams$outboundSchema = z.object({
228
+ provider: z.nullable(z.lazy(() => ChatGenerationParamsProvider$outboundSchema)).optional(),
229
+ plugins: z.array(z.union([
230
+ z.lazy(() => ChatGenerationParamsPluginModeration$outboundSchema),
231
+ z.lazy(() => ChatGenerationParamsPluginWeb$outboundSchema),
232
+ z.lazy(() => ChatGenerationParamsPluginFileParser$outboundSchema),
233
+ z.lazy(() => ChatGenerationParamsPluginResponseHealing$outboundSchema),
234
+ ])).optional(),
235
+ route: z.nullable(Route$outboundSchema).optional(),
236
+ user: z.string().optional(),
237
+ sessionId: z.string().optional(),
81
238
  messages: z.array(Message$outboundSchema),
82
239
  model: z.string().optional(),
83
240
  models: z.array(z.string()).optional(),
@@ -105,10 +262,10 @@ export const ChatGenerationParams$outboundSchema = z.object({
105
262
  toolChoice: z.any().optional(),
106
263
  tools: z.array(ToolDefinitionJson$outboundSchema).optional(),
107
264
  topP: z.nullable(z.number()).optional(),
108
- user: z.string().optional(),
109
265
  debug: z.lazy(() => Debug$outboundSchema).optional(),
110
266
  }).transform((v) => {
111
267
  return remap$(v, {
268
+ sessionId: "session_id",
112
269
  frequencyPenalty: "frequency_penalty",
113
270
  logitBias: "logit_bias",
114
271
  topLogprobs: "top_logprobs",
@@ -4,10 +4,12 @@ import { AssistantMessage } from "./assistantmessage.js";
4
4
  import { ChatCompletionFinishReason } from "./chatcompletionfinishreason.js";
5
5
  import { ChatMessageTokenLogprobs } from "./chatmessagetokenlogprobs.js";
6
6
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
7
+ import { Schema3 } from "./schema3.js";
7
8
  export type ChatResponseChoice = {
8
9
  finishReason: ChatCompletionFinishReason | null;
9
10
  index: number;
10
11
  message: AssistantMessage;
12
+ reasoningDetails?: Array<Schema3> | undefined;
11
13
  logprobs?: ChatMessageTokenLogprobs | null | undefined;
12
14
  };
13
15
  /** @internal */
@@ -7,15 +7,18 @@ import { safeParse } from "../lib/schemas.js";
7
7
  import { AssistantMessage$inboundSchema, } from "./assistantmessage.js";
8
8
  import { ChatCompletionFinishReason$inboundSchema, } from "./chatcompletionfinishreason.js";
9
9
  import { ChatMessageTokenLogprobs$inboundSchema, } from "./chatmessagetokenlogprobs.js";
10
+ import { Schema3$inboundSchema } from "./schema3.js";
10
11
  /** @internal */
11
12
  export const ChatResponseChoice$inboundSchema = z.object({
12
13
  finish_reason: z.nullable(ChatCompletionFinishReason$inboundSchema),
13
14
  index: z.number(),
14
15
  message: AssistantMessage$inboundSchema,
16
+ reasoning_details: z.array(Schema3$inboundSchema).optional(),
15
17
  logprobs: z.nullable(ChatMessageTokenLogprobs$inboundSchema).optional(),
16
18
  }).transform((v) => {
17
19
  return remap$(v, {
18
20
  "finish_reason": "finishReason",
21
+ "reasoning_details": "reasoningDetails",
19
22
  });
20
23
  });
21
24
  export function chatResponseChoiceFromJSON(jsonString) {
@@ -3,6 +3,7 @@ import { ClosedEnum } from "../types/enums.js";
3
3
  import { Result as SafeParseResult } from "../types/fp.js";
4
4
  import { ChatStreamingMessageToolCall } from "./chatstreamingmessagetoolcall.js";
5
5
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
6
+ import { Schema3 } from "./schema3.js";
6
7
  export declare const ChatStreamingMessageChunkRole: {
7
8
  readonly Assistant: "assistant";
8
9
  };
@@ -13,6 +14,7 @@ export type ChatStreamingMessageChunk = {
13
14
  reasoning?: string | null | undefined;
14
15
  refusal?: string | null | undefined;
15
16
  toolCalls?: Array<ChatStreamingMessageToolCall> | undefined;
17
+ reasoningDetails?: Array<Schema3> | undefined;
16
18
  };
17
19
  /** @internal */
18
20
  export declare const ChatStreamingMessageChunkRole$inboundSchema: z.ZodEnum<typeof ChatStreamingMessageChunkRole>;
@@ -5,6 +5,7 @@ import * as z from "zod/v4";
5
5
  import { remap as remap$ } from "../lib/primitives.js";
6
6
  import { safeParse } from "../lib/schemas.js";
7
7
  import { ChatStreamingMessageToolCall$inboundSchema, } from "./chatstreamingmessagetoolcall.js";
8
+ import { Schema3$inboundSchema } from "./schema3.js";
8
9
  export const ChatStreamingMessageChunkRole = {
9
10
  Assistant: "assistant",
10
11
  };
@@ -17,9 +18,11 @@ export const ChatStreamingMessageChunk$inboundSchema = z.object({
17
18
  reasoning: z.nullable(z.string()).optional(),
18
19
  refusal: z.nullable(z.string()).optional(),
19
20
  tool_calls: z.array(ChatStreamingMessageToolCall$inboundSchema).optional(),
21
+ reasoning_details: z.array(Schema3$inboundSchema).optional(),
20
22
  }).transform((v) => {
21
23
  return remap$(v, {
22
24
  "tool_calls": "toolCalls",
25
+ "reasoning_details": "reasoningDetails",
23
26
  });
24
27
  });
25
28
  export function chatStreamingMessageChunkFromJSON(jsonString) {
@@ -95,10 +95,15 @@ export * from "./outputmodality.js";
95
95
  export * from "./parameter.js";
96
96
  export * from "./payloadtoolargeresponseerrordata.js";
97
97
  export * from "./paymentrequiredresponseerrordata.js";
98
+ export * from "./pdfparserengine.js";
99
+ export * from "./pdfparseroptions.js";
98
100
  export * from "./perrequestlimits.js";
99
101
  export * from "./providername.js";
100
102
  export * from "./provideroverloadedresponseerrordata.js";
103
+ export * from "./providerpreferences.js";
101
104
  export * from "./providersort.js";
105
+ export * from "./providersortconfig.js";
106
+ export * from "./providersortunion.js";
102
107
  export * from "./publicendpoint.js";
103
108
  export * from "./publicpricing.js";
104
109
  export * from "./quantization.js";
@@ -128,6 +133,8 @@ export * from "./responsessearchcontextsize.js";
128
133
  export * from "./responseswebsearchcalloutput.js";
129
134
  export * from "./responseswebsearchuserlocation.js";
130
135
  export * from "./responsetextconfig.js";
136
+ export * from "./schema0.js";
137
+ export * from "./schema3.js";
131
138
  export * from "./security.js";
132
139
  export * from "./serviceunavailableresponseerrordata.js";
133
140
  export * from "./systemmessage.js";
@@ -140,6 +147,7 @@ export * from "./unauthorizedresponseerrordata.js";
140
147
  export * from "./unprocessableentityresponseerrordata.js";
141
148
  export * from "./urlcitation.js";
142
149
  export * from "./usermessage.js";
150
+ export * from "./websearchengine.js";
143
151
  export * from "./websearchpreviewtooluserlocation.js";
144
152
  export * from "./websearchstatus.js";
145
153
  //# sourceMappingURL=index.d.ts.map
@@ -98,10 +98,15 @@ export * from "./outputmodality.js";
98
98
  export * from "./parameter.js";
99
99
  export * from "./payloadtoolargeresponseerrordata.js";
100
100
  export * from "./paymentrequiredresponseerrordata.js";
101
+ export * from "./pdfparserengine.js";
102
+ export * from "./pdfparseroptions.js";
101
103
  export * from "./perrequestlimits.js";
102
104
  export * from "./providername.js";
103
105
  export * from "./provideroverloadedresponseerrordata.js";
106
+ export * from "./providerpreferences.js";
104
107
  export * from "./providersort.js";
108
+ export * from "./providersortconfig.js";
109
+ export * from "./providersortunion.js";
105
110
  export * from "./publicendpoint.js";
106
111
  export * from "./publicpricing.js";
107
112
  export * from "./quantization.js";
@@ -131,6 +136,8 @@ export * from "./responsessearchcontextsize.js";
131
136
  export * from "./responseswebsearchcalloutput.js";
132
137
  export * from "./responseswebsearchuserlocation.js";
133
138
  export * from "./responsetextconfig.js";
139
+ export * from "./schema0.js";
140
+ export * from "./schema3.js";
134
141
  export * from "./security.js";
135
142
  export * from "./serviceunavailableresponseerrordata.js";
136
143
  export * from "./systemmessage.js";
@@ -143,6 +150,7 @@ export * from "./unauthorizedresponseerrordata.js";
143
150
  export * from "./unprocessableentityresponseerrordata.js";
144
151
  export * from "./urlcitation.js";
145
152
  export * from "./usermessage.js";
153
+ export * from "./websearchengine.js";
146
154
  export * from "./websearchpreviewtooluserlocation.js";
147
155
  export * from "./websearchstatus.js";
148
156
  //# sourceMappingURL=index.js.map