@openrouter/sdk 0.8.0 → 0.9.11

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 (135) hide show
  1. package/esm/funcs/chatSend.d.ts +3 -3
  2. package/esm/funcs/chatSend.js +18 -2
  3. package/esm/lib/config.d.ts +2 -2
  4. package/esm/lib/config.js +2 -2
  5. package/esm/models/assistantmessage.d.ts +47 -36
  6. package/esm/models/assistantmessage.js +35 -47
  7. package/esm/models/assistantmessageimages.d.ts +33 -0
  8. package/esm/models/assistantmessageimages.js +44 -0
  9. package/esm/models/chatgenerationparams.d.ts +453 -126
  10. package/esm/models/chatgenerationparams.js +238 -97
  11. package/esm/models/chatgenerationtokenusage.d.ts +48 -0
  12. package/esm/models/chatmessagecontentitem.d.ts +15 -10
  13. package/esm/models/chatmessagecontentitem.js +25 -4
  14. package/esm/models/chatmessagecontentitemaudio.d.ts +20 -2
  15. package/esm/models/chatmessagecontentitemaudio.js +9 -2
  16. package/esm/models/chatmessagecontentitemcachecontrol.d.ts +14 -3
  17. package/esm/models/chatmessagecontentitemcachecontrol.js +9 -2
  18. package/esm/models/chatmessagecontentitemimage.d.ts +26 -3
  19. package/esm/models/chatmessagecontentitemimage.js +12 -2
  20. package/esm/models/chatmessagecontentitemtext.d.ts +17 -2
  21. package/esm/models/chatmessagecontentitemtext.js +9 -2
  22. package/esm/models/chatmessagecontentitemvideo.d.ts +12 -55
  23. package/esm/models/chatmessagecontentitemvideo.js +5 -72
  24. package/esm/models/chatmessagecontentitemvideolegacy.d.ts +28 -0
  25. package/esm/models/chatmessagecontentitemvideolegacy.js +33 -0
  26. package/esm/models/chatmessagetokenlogprob.d.ts +15 -0
  27. package/esm/models/chatmessagetokenlogprobs.d.ts +9 -0
  28. package/esm/models/chatmessagetoolcall.d.ts +23 -2
  29. package/esm/models/chatmessagetoolcall.js +9 -2
  30. package/esm/models/chatresponse.d.ts +29 -1
  31. package/esm/models/chatresponse.js +6 -1
  32. package/esm/models/chatresponsechoice.d.ts +13 -2
  33. package/esm/models/chatresponsechoice.js +1 -2
  34. package/esm/models/chatstreamingchoice.d.ts +13 -2
  35. package/esm/models/chatstreamingchoice.js +1 -2
  36. package/esm/models/chatstreamingmessagechunk.d.ts +29 -2
  37. package/esm/models/chatstreamingmessagechunk.js +5 -2
  38. package/esm/models/chatstreamingmessagetoolcall.d.ts +38 -1
  39. package/esm/models/chatstreamingmessagetoolcall.js +9 -1
  40. package/esm/models/chatstreamingresponsechunk.d.ts +45 -11
  41. package/esm/models/chatstreamingresponsechunk.js +11 -25
  42. package/esm/models/chatstreamoptions.d.ts +8 -0
  43. package/esm/models/debugoptions.d.ts +18 -0
  44. package/esm/models/debugoptions.js +18 -0
  45. package/esm/models/developermessage.d.ts +12 -0
  46. package/esm/models/errors/index.d.ts +0 -1
  47. package/esm/models/errors/index.js +0 -1
  48. package/esm/models/index.d.ts +12 -8
  49. package/esm/models/index.js +12 -8
  50. package/esm/models/jsonschemaconfig.d.ts +17 -2
  51. package/esm/models/jsonschemaconfig.js +1 -1
  52. package/esm/models/message.d.ts +9 -2
  53. package/esm/models/message.js +1 -1
  54. package/esm/models/modelscountresponse.d.ts +4 -4
  55. package/esm/models/modelscountresponse.js +4 -4
  56. package/esm/models/namedtoolchoice.d.ts +15 -2
  57. package/esm/models/namedtoolchoice.js +6 -1
  58. package/esm/models/openairesponsesreasoningconfig.d.ts +1 -1
  59. package/esm/models/openairesponsesreasoningconfig.js +1 -1
  60. package/esm/models/openresponsesnonstreamingresponse.d.ts +4 -4
  61. package/esm/models/openresponsesnonstreamingresponse.js +3 -3
  62. package/esm/models/openresponsesreasoning.d.ts +2 -2
  63. package/esm/models/openresponsesreasoning.js +1 -1
  64. package/esm/models/openresponsesreasoningconfig.d.ts +2 -2
  65. package/esm/models/openresponsesreasoningconfig.js +1 -1
  66. package/esm/models/openresponsesrequest.d.ts +62 -32
  67. package/esm/models/openresponsesrequest.js +61 -36
  68. package/esm/models/operations/createauthkeyscode.d.ts +24 -0
  69. package/esm/models/operations/createauthkeyscode.js +14 -0
  70. package/esm/models/operations/getgeneration.d.ts +2 -0
  71. package/esm/models/operations/getgeneration.js +2 -0
  72. package/esm/models/operations/sendchatcompletionrequest.d.ts +12 -3
  73. package/esm/models/operations/sendchatcompletionrequest.js +20 -2
  74. package/esm/models/providername.d.ts +2 -0
  75. package/esm/models/providername.js +2 -0
  76. package/esm/models/providerpreferences.d.ts +45 -14
  77. package/esm/models/providerpreferences.js +29 -15
  78. package/esm/models/providersort.d.ts +6 -0
  79. package/esm/models/providersort.js +3 -0
  80. package/esm/models/providersortconfig.d.ts +30 -2
  81. package/esm/models/providersortconfig.js +15 -2
  82. package/esm/models/reasoningdetailencrypted.d.ts +42 -0
  83. package/esm/models/reasoningdetailencrypted.js +42 -0
  84. package/esm/models/reasoningdetailsummary.d.ts +42 -0
  85. package/esm/models/reasoningdetailsummary.js +42 -0
  86. package/esm/models/reasoningdetailtext.d.ts +44 -0
  87. package/esm/models/reasoningdetailtext.js +44 -0
  88. package/esm/models/reasoningdetailunion.d.ts +19 -0
  89. package/esm/models/reasoningdetailunion.js +28 -0
  90. package/esm/models/responseformatjsonobject.d.ts +20 -0
  91. package/esm/models/responseformatjsonobject.js +21 -0
  92. package/esm/models/responseformatjsonschema.d.ts +6 -0
  93. package/esm/models/responseformattext.d.ts +15 -0
  94. package/esm/models/responseformattext.js +13 -0
  95. package/esm/models/responseformattextconfig.d.ts +3 -3
  96. package/esm/models/responseformattextconfig.js +3 -3
  97. package/esm/models/responseformattextgrammar.d.ts +6 -0
  98. package/esm/models/responseformattextpython.d.ts +15 -0
  99. package/esm/models/responseformattextpython.js +13 -0
  100. package/esm/models/responseserrorfield.d.ts +4 -4
  101. package/esm/models/responseserrorfield.js +4 -4
  102. package/esm/models/responsesoutputitemreasoning.d.ts +2 -2
  103. package/esm/models/responsesoutputitemreasoning.js +2 -2
  104. package/esm/models/systemmessage.d.ts +12 -0
  105. package/esm/models/toolchoiceoption.d.ts +31 -0
  106. package/esm/models/toolchoiceoption.js +32 -0
  107. package/esm/models/tooldefinitionjson.d.ts +38 -4
  108. package/esm/models/tooldefinitionjson.js +14 -2
  109. package/esm/models/toolresponsemessage.d.ts +12 -0
  110. package/esm/models/usermessage.d.ts +12 -0
  111. package/esm/models/videoinput.d.ts +23 -0
  112. package/esm/models/videoinput.js +22 -0
  113. package/esm/sdk/chat.d.ts +1 -1
  114. package/esm/sdk/sdk.d.ts +2 -2
  115. package/esm/sdk/sdk.js +3 -3
  116. package/jsr.json +1 -1
  117. package/package.json +1 -1
  118. package/esm/models/chaterror.d.ts +0 -17
  119. package/esm/models/chaterror.js +0 -25
  120. package/esm/models/errors/chaterror.d.ts +0 -19
  121. package/esm/models/errors/chaterror.js +0 -32
  122. package/esm/models/providersortunion.d.ts +0 -10
  123. package/esm/models/providersortunion.js +0 -13
  124. package/esm/models/responsesformatjsonobject.d.ts +0 -20
  125. package/esm/models/responsesformatjsonobject.js +0 -21
  126. package/esm/models/schema10.d.ts +0 -33
  127. package/esm/models/schema10.js +0 -30
  128. package/esm/models/schema14.d.ts +0 -8
  129. package/esm/models/schema14.js +0 -12
  130. package/esm/models/schema17.d.ts +0 -102
  131. package/esm/models/schema17.js +0 -95
  132. package/esm/models/schema19.d.ts +0 -92
  133. package/esm/models/schema19.js +0 -109
  134. package/esm/models/schema5.d.ts +0 -86
  135. package/esm/models/schema5.js +0 -89
@@ -99,15 +99,16 @@ export function openResponsesRequestMaxPriceToJSON(openResponsesRequestMaxPrice)
99
99
  return JSON.stringify(OpenResponsesRequestMaxPrice$outboundSchema.parse(openResponsesRequestMaxPrice));
100
100
  }
101
101
  /** @internal */
102
- export const Provider$outboundSchema = z
103
- .object({
102
+ export const OpenResponsesRequestProvider$outboundSchema = z.object({
104
103
  allowFallbacks: z.nullable(z.boolean()).optional(),
105
104
  requireParameters: z.nullable(z.boolean()).optional(),
106
105
  dataCollection: z.nullable(DataCollection$outboundSchema).optional(),
107
106
  zdr: z.nullable(z.boolean()).optional(),
108
107
  enforceDistillableText: z.nullable(z.boolean()).optional(),
109
- order: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()]))).optional(),
110
- only: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()]))).optional(),
108
+ order: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()])))
109
+ .optional(),
110
+ only: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()])))
111
+ .optional(),
111
112
  ignore: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()]))).optional(),
112
113
  quantizations: z.nullable(z.array(Quantization$outboundSchema)).optional(),
113
114
  sort: z.nullable(z.union([
@@ -132,28 +133,28 @@ export const Provider$outboundSchema = z
132
133
  preferredMaxLatency: "preferred_max_latency",
133
134
  });
134
135
  });
135
- export function providerToJSON(provider) {
136
- return JSON.stringify(Provider$outboundSchema.parse(provider));
136
+ export function openResponsesRequestProviderToJSON(openResponsesRequestProvider) {
137
+ return JSON.stringify(OpenResponsesRequestProvider$outboundSchema.parse(openResponsesRequestProvider));
137
138
  }
138
139
  /** @internal */
139
- export const PluginResponseHealing$outboundSchema = z.object({
140
+ export const OpenResponsesRequestPluginResponseHealing$outboundSchema = z.object({
140
141
  id: z.literal("response-healing"),
141
142
  enabled: z.boolean().optional(),
142
143
  });
143
- export function pluginResponseHealingToJSON(pluginResponseHealing) {
144
- return JSON.stringify(PluginResponseHealing$outboundSchema.parse(pluginResponseHealing));
144
+ export function openResponsesRequestPluginResponseHealingToJSON(openResponsesRequestPluginResponseHealing) {
145
+ return JSON.stringify(OpenResponsesRequestPluginResponseHealing$outboundSchema.parse(openResponsesRequestPluginResponseHealing));
145
146
  }
146
147
  /** @internal */
147
- export const PluginFileParser$outboundSchema = z.object({
148
+ export const OpenResponsesRequestPluginFileParser$outboundSchema = z.object({
148
149
  id: z.literal("file-parser"),
149
150
  enabled: z.boolean().optional(),
150
151
  pdf: PDFParserOptions$outboundSchema.optional(),
151
152
  });
152
- export function pluginFileParserToJSON(pluginFileParser) {
153
- return JSON.stringify(PluginFileParser$outboundSchema.parse(pluginFileParser));
153
+ export function openResponsesRequestPluginFileParserToJSON(openResponsesRequestPluginFileParser) {
154
+ return JSON.stringify(OpenResponsesRequestPluginFileParser$outboundSchema.parse(openResponsesRequestPluginFileParser));
154
155
  }
155
156
  /** @internal */
156
- export const PluginWeb$outboundSchema = z.object({
157
+ export const OpenResponsesRequestPluginWeb$outboundSchema = z.object({
157
158
  id: z.literal("web"),
158
159
  enabled: z.boolean().optional(),
159
160
  maxResults: z.number().optional(),
@@ -165,18 +166,18 @@ export const PluginWeb$outboundSchema = z.object({
165
166
  searchPrompt: "search_prompt",
166
167
  });
167
168
  });
168
- export function pluginWebToJSON(pluginWeb) {
169
- return JSON.stringify(PluginWeb$outboundSchema.parse(pluginWeb));
169
+ export function openResponsesRequestPluginWebToJSON(openResponsesRequestPluginWeb) {
170
+ return JSON.stringify(OpenResponsesRequestPluginWeb$outboundSchema.parse(openResponsesRequestPluginWeb));
170
171
  }
171
172
  /** @internal */
172
- export const PluginModeration$outboundSchema = z.object({
173
+ export const OpenResponsesRequestPluginModeration$outboundSchema = z.object({
173
174
  id: z.literal("moderation"),
174
175
  });
175
- export function pluginModerationToJSON(pluginModeration) {
176
- return JSON.stringify(PluginModeration$outboundSchema.parse(pluginModeration));
176
+ export function openResponsesRequestPluginModerationToJSON(openResponsesRequestPluginModeration) {
177
+ return JSON.stringify(OpenResponsesRequestPluginModeration$outboundSchema.parse(openResponsesRequestPluginModeration));
177
178
  }
178
179
  /** @internal */
179
- export const PluginAutoRouter$outboundSchema = z.object({
180
+ export const OpenResponsesRequestPluginAutoRouter$outboundSchema = z.object({
180
181
  id: z.literal("auto-router"),
181
182
  enabled: z.boolean().optional(),
182
183
  allowedModels: z.array(z.string()).optional(),
@@ -185,20 +186,43 @@ export const PluginAutoRouter$outboundSchema = z.object({
185
186
  allowedModels: "allowed_models",
186
187
  });
187
188
  });
188
- export function pluginAutoRouterToJSON(pluginAutoRouter) {
189
- return JSON.stringify(PluginAutoRouter$outboundSchema.parse(pluginAutoRouter));
189
+ export function openResponsesRequestPluginAutoRouterToJSON(openResponsesRequestPluginAutoRouter) {
190
+ return JSON.stringify(OpenResponsesRequestPluginAutoRouter$outboundSchema.parse(openResponsesRequestPluginAutoRouter));
190
191
  }
191
192
  /** @internal */
192
- export const Plugin$outboundSchema = z
193
- .union([
194
- z.lazy(() => PluginAutoRouter$outboundSchema),
195
- z.lazy(() => PluginModeration$outboundSchema),
196
- z.lazy(() => PluginWeb$outboundSchema),
197
- z.lazy(() => PluginFileParser$outboundSchema),
198
- z.lazy(() => PluginResponseHealing$outboundSchema),
193
+ export const OpenResponsesRequestPluginUnion$outboundSchema = z.union([
194
+ z.lazy(() => OpenResponsesRequestPluginAutoRouter$outboundSchema),
195
+ z.lazy(() => OpenResponsesRequestPluginModeration$outboundSchema),
196
+ z.lazy(() => OpenResponsesRequestPluginWeb$outboundSchema),
197
+ z.lazy(() => OpenResponsesRequestPluginFileParser$outboundSchema),
198
+ z.lazy(() => OpenResponsesRequestPluginResponseHealing$outboundSchema),
199
199
  ]);
200
- export function pluginToJSON(plugin) {
201
- return JSON.stringify(Plugin$outboundSchema.parse(plugin));
200
+ export function openResponsesRequestPluginUnionToJSON(openResponsesRequestPluginUnion) {
201
+ return JSON.stringify(OpenResponsesRequestPluginUnion$outboundSchema.parse(openResponsesRequestPluginUnion));
202
+ }
203
+ /** @internal */
204
+ export const OpenResponsesRequestTrace$outboundSchema = z.object({
205
+ traceId: z.string().optional(),
206
+ traceName: z.string().optional(),
207
+ spanName: z.string().optional(),
208
+ generationName: z.string().optional(),
209
+ parentSpanId: z.string().optional(),
210
+ additionalProperties: z.record(z.string(), z.nullable(z.any())).optional(),
211
+ }).transform((v) => {
212
+ return {
213
+ ...v.additionalProperties,
214
+ ...remap$(v, {
215
+ traceId: "trace_id",
216
+ traceName: "trace_name",
217
+ spanName: "span_name",
218
+ generationName: "generation_name",
219
+ parentSpanId: "parent_span_id",
220
+ additionalProperties: null,
221
+ }),
222
+ };
223
+ });
224
+ export function openResponsesRequestTraceToJSON(openResponsesRequestTrace) {
225
+ return JSON.stringify(OpenResponsesRequestTrace$outboundSchema.parse(openResponsesRequestTrace));
202
226
  }
203
227
  /** @internal */
204
228
  export const OpenResponsesRequest$outboundSchema = z.object({
@@ -240,16 +264,17 @@ export const OpenResponsesRequest$outboundSchema = z.object({
240
264
  serviceTier: ServiceTier$outboundSchema.default("auto"),
241
265
  truncation: z.nullable(Truncation$outboundSchema).optional(),
242
266
  stream: z.boolean().default(false),
243
- provider: z.nullable(z.lazy(() => Provider$outboundSchema)).optional(),
267
+ provider: z.nullable(z.lazy(() => OpenResponsesRequestProvider$outboundSchema)).optional(),
244
268
  plugins: z.array(z.union([
245
- z.lazy(() => PluginAutoRouter$outboundSchema),
246
- z.lazy(() => PluginModeration$outboundSchema),
247
- z.lazy(() => PluginWeb$outboundSchema),
248
- z.lazy(() => PluginFileParser$outboundSchema),
249
- z.lazy(() => PluginResponseHealing$outboundSchema),
269
+ z.lazy(() => OpenResponsesRequestPluginAutoRouter$outboundSchema),
270
+ z.lazy(() => OpenResponsesRequestPluginModeration$outboundSchema),
271
+ z.lazy(() => OpenResponsesRequestPluginWeb$outboundSchema),
272
+ z.lazy(() => OpenResponsesRequestPluginFileParser$outboundSchema),
273
+ z.lazy(() => OpenResponsesRequestPluginResponseHealing$outboundSchema),
250
274
  ])).optional(),
251
275
  user: z.string().optional(),
252
276
  sessionId: z.string().optional(),
277
+ trace: z.lazy(() => OpenResponsesRequestTrace$outboundSchema).optional(),
253
278
  }).transform((v) => {
254
279
  return remap$(v, {
255
280
  toolChoice: "tool_choice",
@@ -28,6 +28,18 @@ export declare const CreateAuthKeysCodeCodeChallengeMethod: {
28
28
  * The method used to generate the code challenge
29
29
  */
30
30
  export type CreateAuthKeysCodeCodeChallengeMethod = OpenEnum<typeof CreateAuthKeysCodeCodeChallengeMethod>;
31
+ /**
32
+ * Optional credit limit reset interval. When set, the credit limit resets on this interval.
33
+ */
34
+ export declare const UsageLimitType: {
35
+ readonly Daily: "daily";
36
+ readonly Weekly: "weekly";
37
+ readonly Monthly: "monthly";
38
+ };
39
+ /**
40
+ * Optional credit limit reset interval. When set, the credit limit resets on this interval.
41
+ */
42
+ export type UsageLimitType = OpenEnum<typeof UsageLimitType>;
31
43
  export type CreateAuthKeysCodeRequestBody = {
32
44
  /**
33
45
  * The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.
@@ -49,6 +61,14 @@ export type CreateAuthKeysCodeRequestBody = {
49
61
  * Optional expiration time for the API key to be created
50
62
  */
51
63
  expiresAt?: Date | null | undefined;
64
+ /**
65
+ * Optional custom label for the API key. Defaults to the app name if not provided.
66
+ */
67
+ keyLabel?: string | undefined;
68
+ /**
69
+ * Optional credit limit reset interval. When set, the credit limit resets on this interval.
70
+ */
71
+ usageLimitType?: UsageLimitType | undefined;
52
72
  };
53
73
  export type CreateAuthKeysCodeRequest = {
54
74
  /**
@@ -95,12 +115,16 @@ export type CreateAuthKeysCodeResponse = {
95
115
  /** @internal */
96
116
  export declare const CreateAuthKeysCodeCodeChallengeMethod$outboundSchema: z.ZodType<string, CreateAuthKeysCodeCodeChallengeMethod>;
97
117
  /** @internal */
118
+ export declare const UsageLimitType$outboundSchema: z.ZodType<string, UsageLimitType>;
119
+ /** @internal */
98
120
  export type CreateAuthKeysCodeRequestBody$Outbound = {
99
121
  callback_url: string;
100
122
  code_challenge?: string | undefined;
101
123
  code_challenge_method?: string | undefined;
102
124
  limit?: number | undefined;
103
125
  expires_at?: string | null | undefined;
126
+ key_label?: string | undefined;
127
+ usage_limit_type?: string | undefined;
104
128
  };
105
129
  /** @internal */
106
130
  export declare const CreateAuthKeysCodeRequestBody$outboundSchema: z.ZodType<CreateAuthKeysCodeRequestBody$Outbound, CreateAuthKeysCodeRequestBody>;
@@ -13,9 +13,19 @@ export const CreateAuthKeysCodeCodeChallengeMethod = {
13
13
  S256: "S256",
14
14
  Plain: "plain",
15
15
  };
16
+ /**
17
+ * Optional credit limit reset interval. When set, the credit limit resets on this interval.
18
+ */
19
+ export const UsageLimitType = {
20
+ Daily: "daily",
21
+ Weekly: "weekly",
22
+ Monthly: "monthly",
23
+ };
16
24
  /** @internal */
17
25
  export const CreateAuthKeysCodeCodeChallengeMethod$outboundSchema = openEnums.outboundSchema(CreateAuthKeysCodeCodeChallengeMethod);
18
26
  /** @internal */
27
+ export const UsageLimitType$outboundSchema = openEnums.outboundSchema(UsageLimitType);
28
+ /** @internal */
19
29
  export const CreateAuthKeysCodeRequestBody$outboundSchema = z.object({
20
30
  callbackUrl: z.string(),
21
31
  codeChallenge: z.string().optional(),
@@ -23,12 +33,16 @@ export const CreateAuthKeysCodeRequestBody$outboundSchema = z.object({
23
33
  .optional(),
24
34
  limit: z.number().optional(),
25
35
  expiresAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
36
+ keyLabel: z.string().optional(),
37
+ usageLimitType: UsageLimitType$outboundSchema.optional(),
26
38
  }).transform((v) => {
27
39
  return remap$(v, {
28
40
  callbackUrl: "callback_url",
29
41
  codeChallenge: "code_challenge",
30
42
  codeChallengeMethod: "code_challenge_method",
31
43
  expiresAt: "expires_at",
44
+ keyLabel: "key_label",
45
+ usageLimitType: "usage_limit_type",
32
46
  });
33
47
  });
34
48
  export function createAuthKeysCodeRequestBodyToJSON(createAuthKeysCodeRequestBody) {
@@ -107,7 +107,9 @@ export declare const ProviderName: {
107
107
  readonly Inception: "Inception";
108
108
  readonly Inceptron: "Inceptron";
109
109
  readonly InferenceNet: "InferenceNet";
110
+ readonly Ionstream: "Ionstream";
110
111
  readonly Infermatic: "Infermatic";
112
+ readonly IoNet: "Io Net";
111
113
  readonly Inflection: "Inflection";
112
114
  readonly Liquid: "Liquid";
113
115
  readonly Mara: "Mara";
@@ -76,7 +76,9 @@ export const ProviderName = {
76
76
  Inception: "Inception",
77
77
  Inceptron: "Inceptron",
78
78
  InferenceNet: "InferenceNet",
79
+ Ionstream: "Ionstream",
79
80
  Infermatic: "Infermatic",
81
+ IoNet: "Io Net",
80
82
  Inflection: "Inflection",
81
83
  Liquid: "Liquid",
82
84
  Mara: "Mara",
@@ -32,12 +32,18 @@ export type SendChatCompletionRequestRequest = {
32
32
  * @remarks
33
33
  */
34
34
  xTitle?: string | undefined;
35
+ chatGenerationParams: models.ChatGenerationParams;
36
+ };
37
+ /**
38
+ * Successful chat completion response
39
+ */
40
+ export type SendChatCompletionRequestResponseBody = {
35
41
  /**
36
- * Chat completion request parameters
42
+ * Streaming chat completion chunk
37
43
  */
38
- chatGenerationParams: models.ChatGenerationParams;
44
+ data: models.ChatStreamingResponseChunk;
39
45
  };
40
- export type SendChatCompletionRequestResponse = models.ChatResponse | EventStream<models.ChatStreamingResponseChunkData>;
46
+ export type SendChatCompletionRequestResponse = models.ChatResponse | EventStream<models.ChatStreamingResponseChunk>;
41
47
  /** @internal */
42
48
  export type SendChatCompletionRequestRequest$Outbound = {
43
49
  "HTTP-Referer"?: string | undefined;
@@ -48,6 +54,9 @@ export type SendChatCompletionRequestRequest$Outbound = {
48
54
  export declare const SendChatCompletionRequestRequest$outboundSchema: z.ZodType<SendChatCompletionRequestRequest$Outbound, SendChatCompletionRequestRequest>;
49
55
  export declare function sendChatCompletionRequestRequestToJSON(sendChatCompletionRequestRequest: SendChatCompletionRequestRequest): string;
50
56
  /** @internal */
57
+ export declare const SendChatCompletionRequestResponseBody$inboundSchema: z.ZodType<SendChatCompletionRequestResponseBody, unknown>;
58
+ export declare function sendChatCompletionRequestResponseBodyFromJSON(jsonString: string): SafeParseResult<SendChatCompletionRequestResponseBody, SDKValidationError>;
59
+ /** @internal */
51
60
  export declare const SendChatCompletionRequestResponse$inboundSchema: z.ZodType<SendChatCompletionRequestResponse, unknown>;
52
61
  export declare function sendChatCompletionRequestResponseFromJSON(jsonString: string): SafeParseResult<SendChatCompletionRequestResponse, SDKValidationError>;
53
62
  //# sourceMappingURL=sendchatcompletionrequest.d.ts.map
@@ -23,6 +23,25 @@ export function sendChatCompletionRequestRequestToJSON(sendChatCompletionRequest
23
23
  return JSON.stringify(SendChatCompletionRequestRequest$outboundSchema.parse(sendChatCompletionRequestRequest));
24
24
  }
25
25
  /** @internal */
26
+ export const SendChatCompletionRequestResponseBody$inboundSchema = z.object({
27
+ data: z.string().transform((v, ctx) => {
28
+ try {
29
+ return JSON.parse(v);
30
+ }
31
+ catch (err) {
32
+ ctx.addIssue({
33
+ input: v,
34
+ code: "custom",
35
+ message: `malformed json: ${err}`,
36
+ });
37
+ return z.NEVER;
38
+ }
39
+ }).pipe(models.ChatStreamingResponseChunk$inboundSchema),
40
+ });
41
+ export function sendChatCompletionRequestResponseBodyFromJSON(jsonString) {
42
+ return safeParse(jsonString, (x) => SendChatCompletionRequestResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SendChatCompletionRequestResponseBody' from JSON`);
43
+ }
44
+ /** @internal */
26
45
  export const SendChatCompletionRequestResponse$inboundSchema = z.union([
27
46
  models.ChatResponse$inboundSchema,
28
47
  z.custom(x => x instanceof ReadableStream)
@@ -31,8 +50,7 @@ export const SendChatCompletionRequestResponse$inboundSchema = z.union([
31
50
  if (rawEvent.data === "[DONE]")
32
51
  return { done: true };
33
52
  return {
34
- value: models.ChatStreamingResponseChunk$inboundSchema.parse(rawEvent)
35
- ?.data,
53
+ value: z.lazy(() => SendChatCompletionRequestResponseBody$inboundSchema).parse(rawEvent)?.data,
36
54
  };
37
55
  });
38
56
  }),
@@ -35,7 +35,9 @@ export declare const ProviderName: {
35
35
  readonly Inception: "Inception";
36
36
  readonly Inceptron: "Inceptron";
37
37
  readonly InferenceNet: "InferenceNet";
38
+ readonly Ionstream: "Ionstream";
38
39
  readonly Infermatic: "Infermatic";
40
+ readonly IoNet: "Io Net";
39
41
  readonly Inflection: "Inflection";
40
42
  readonly Liquid: "Liquid";
41
43
  readonly Mara: "Mara";
@@ -38,7 +38,9 @@ export const ProviderName = {
38
38
  Inception: "Inception",
39
39
  Inceptron: "Inceptron",
40
40
  InferenceNet: "InferenceNet",
41
+ Ionstream: "Ionstream",
41
42
  Infermatic: "Infermatic",
43
+ IoNet: "Io Net",
42
44
  Inflection: "Inflection",
43
45
  Liquid: "Liquid",
44
46
  Mara: "Mara",
@@ -4,43 +4,72 @@ import { DataCollection } from "./datacollection.js";
4
4
  import { PreferredMaxLatency, PreferredMaxLatency$Outbound } from "./preferredmaxlatency.js";
5
5
  import { PreferredMinThroughput, PreferredMinThroughput$Outbound } from "./preferredminthroughput.js";
6
6
  import { ProviderName } from "./providername.js";
7
- import { ProviderSort } from "./providersort.js";
8
7
  import { Quantization } from "./quantization.js";
9
8
  export type ProviderPreferencesOrder = ProviderName | string;
10
9
  export type ProviderPreferencesOnly = ProviderName | string;
11
10
  export type ProviderPreferencesIgnore = ProviderName | string;
12
- export declare const SortEnum: {
11
+ export declare const ProviderPreferencesSortEnum: {
13
12
  readonly Price: "price";
14
13
  readonly Throughput: "throughput";
15
14
  readonly Latency: "latency";
16
15
  };
17
- export type SortEnum = OpenEnum<typeof SortEnum>;
18
- export declare const ProviderSortConfigEnum: {
16
+ export type ProviderPreferencesSortEnum = OpenEnum<typeof ProviderPreferencesSortEnum>;
17
+ export declare const ProviderPreferencesProviderSortConfigEnum: {
19
18
  readonly Price: "price";
20
19
  readonly Throughput: "throughput";
21
20
  readonly Latency: "latency";
22
21
  };
23
- export type ProviderSortConfigEnum = ClosedEnum<typeof ProviderSortConfigEnum>;
22
+ export type ProviderPreferencesProviderSortConfigEnum = ClosedEnum<typeof ProviderPreferencesProviderSortConfigEnum>;
23
+ /**
24
+ * The provider sorting strategy (price, throughput, latency)
25
+ */
26
+ export declare const ProviderPreferencesBy: {
27
+ readonly Price: "price";
28
+ readonly Throughput: "throughput";
29
+ readonly Latency: "latency";
30
+ };
31
+ /**
32
+ * The provider sorting strategy (price, throughput, latency)
33
+ */
34
+ export type ProviderPreferencesBy = OpenEnum<typeof ProviderPreferencesBy>;
35
+ /**
36
+ * Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model.
37
+ */
24
38
  export declare const ProviderPreferencesPartition: {
25
39
  readonly Model: "model";
26
40
  readonly None: "none";
27
41
  };
42
+ /**
43
+ * Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model.
44
+ */
28
45
  export type ProviderPreferencesPartition = OpenEnum<typeof ProviderPreferencesPartition>;
29
46
  export type ProviderPreferencesProviderSortConfig = {
30
- by?: ProviderSort | null | undefined;
47
+ /**
48
+ * The provider sorting strategy (price, throughput, latency)
49
+ */
50
+ by?: ProviderPreferencesBy | null | undefined;
51
+ /**
52
+ * Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model.
53
+ */
31
54
  partition?: ProviderPreferencesPartition | null | undefined;
32
55
  };
33
- export type ProviderSortConfigUnion = ProviderPreferencesProviderSortConfig | ProviderSortConfigEnum;
56
+ export type ProviderPreferencesProviderSortConfigUnion = ProviderPreferencesProviderSortConfig | ProviderPreferencesProviderSortConfigEnum;
57
+ /**
58
+ * The provider sorting strategy (price, throughput, latency)
59
+ */
34
60
  export declare const ProviderPreferencesProviderSort: {
35
61
  readonly Price: "price";
36
62
  readonly Throughput: "throughput";
37
63
  readonly Latency: "latency";
38
64
  };
65
+ /**
66
+ * The provider sorting strategy (price, throughput, latency)
67
+ */
39
68
  export type ProviderPreferencesProviderSort = OpenEnum<typeof ProviderPreferencesProviderSort>;
40
69
  /**
41
70
  * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
42
71
  */
43
- export type ProviderPreferencesSortUnion = ProviderPreferencesProviderSort | ProviderPreferencesProviderSortConfig | ProviderSortConfigEnum | SortEnum;
72
+ export type ProviderPreferencesSortUnion = ProviderPreferencesProviderSort | ProviderPreferencesProviderSortConfig | ProviderPreferencesProviderSortConfigEnum | ProviderPreferencesSortEnum;
44
73
  /**
45
74
  * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
46
75
  */
@@ -103,7 +132,7 @@ export type ProviderPreferences = {
103
132
  * A list of quantization levels to filter the provider by.
104
133
  */
105
134
  quantizations?: Array<Quantization> | null | undefined;
106
- sort?: ProviderPreferencesProviderSort | ProviderPreferencesProviderSortConfig | ProviderSortConfigEnum | SortEnum | null | undefined;
135
+ sort?: ProviderPreferencesProviderSort | ProviderPreferencesProviderSortConfig | ProviderPreferencesProviderSortConfigEnum | ProviderPreferencesSortEnum | null | undefined;
107
136
  /**
108
137
  * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
109
138
  */
@@ -133,9 +162,11 @@ export type ProviderPreferencesIgnore$Outbound = string | string;
133
162
  export declare const ProviderPreferencesIgnore$outboundSchema: z.ZodType<ProviderPreferencesIgnore$Outbound, ProviderPreferencesIgnore>;
134
163
  export declare function providerPreferencesIgnoreToJSON(providerPreferencesIgnore: ProviderPreferencesIgnore): string;
135
164
  /** @internal */
136
- export declare const SortEnum$outboundSchema: z.ZodType<string, SortEnum>;
165
+ export declare const ProviderPreferencesSortEnum$outboundSchema: z.ZodType<string, ProviderPreferencesSortEnum>;
166
+ /** @internal */
167
+ export declare const ProviderPreferencesProviderSortConfigEnum$outboundSchema: z.ZodEnum<typeof ProviderPreferencesProviderSortConfigEnum>;
137
168
  /** @internal */
138
- export declare const ProviderSortConfigEnum$outboundSchema: z.ZodEnum<typeof ProviderSortConfigEnum>;
169
+ export declare const ProviderPreferencesBy$outboundSchema: z.ZodType<string, ProviderPreferencesBy>;
139
170
  /** @internal */
140
171
  export declare const ProviderPreferencesPartition$outboundSchema: z.ZodType<string, ProviderPreferencesPartition>;
141
172
  /** @internal */
@@ -147,10 +178,10 @@ export type ProviderPreferencesProviderSortConfig$Outbound = {
147
178
  export declare const ProviderPreferencesProviderSortConfig$outboundSchema: z.ZodType<ProviderPreferencesProviderSortConfig$Outbound, ProviderPreferencesProviderSortConfig>;
148
179
  export declare function providerPreferencesProviderSortConfigToJSON(providerPreferencesProviderSortConfig: ProviderPreferencesProviderSortConfig): string;
149
180
  /** @internal */
150
- export type ProviderSortConfigUnion$Outbound = ProviderPreferencesProviderSortConfig$Outbound | string;
181
+ export type ProviderPreferencesProviderSortConfigUnion$Outbound = ProviderPreferencesProviderSortConfig$Outbound | string;
151
182
  /** @internal */
152
- export declare const ProviderSortConfigUnion$outboundSchema: z.ZodType<ProviderSortConfigUnion$Outbound, ProviderSortConfigUnion>;
153
- export declare function providerSortConfigUnionToJSON(providerSortConfigUnion: ProviderSortConfigUnion): string;
183
+ export declare const ProviderPreferencesProviderSortConfigUnion$outboundSchema: z.ZodType<ProviderPreferencesProviderSortConfigUnion$Outbound, ProviderPreferencesProviderSortConfigUnion>;
184
+ export declare function providerPreferencesProviderSortConfigUnionToJSON(providerPreferencesProviderSortConfigUnion: ProviderPreferencesProviderSortConfigUnion): string;
154
185
  /** @internal */
155
186
  export declare const ProviderPreferencesProviderSort$outboundSchema: z.ZodType<string, ProviderPreferencesProviderSort>;
156
187
  /** @internal */
@@ -9,22 +9,35 @@ import { DataCollection$outboundSchema, } from "./datacollection.js";
9
9
  import { PreferredMaxLatency$outboundSchema, } from "./preferredmaxlatency.js";
10
10
  import { PreferredMinThroughput$outboundSchema, } from "./preferredminthroughput.js";
11
11
  import { ProviderName$outboundSchema } from "./providername.js";
12
- import { ProviderSort$outboundSchema } from "./providersort.js";
13
12
  import { Quantization$outboundSchema } from "./quantization.js";
14
- export const SortEnum = {
13
+ export const ProviderPreferencesSortEnum = {
15
14
  Price: "price",
16
15
  Throughput: "throughput",
17
16
  Latency: "latency",
18
17
  };
19
- export const ProviderSortConfigEnum = {
18
+ export const ProviderPreferencesProviderSortConfigEnum = {
20
19
  Price: "price",
21
20
  Throughput: "throughput",
22
21
  Latency: "latency",
23
22
  };
23
+ /**
24
+ * The provider sorting strategy (price, throughput, latency)
25
+ */
26
+ export const ProviderPreferencesBy = {
27
+ Price: "price",
28
+ Throughput: "throughput",
29
+ Latency: "latency",
30
+ };
31
+ /**
32
+ * Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model.
33
+ */
24
34
  export const ProviderPreferencesPartition = {
25
35
  Model: "model",
26
36
  None: "none",
27
37
  };
38
+ /**
39
+ * The provider sorting strategy (price, throughput, latency)
40
+ */
28
41
  export const ProviderPreferencesProviderSort = {
29
42
  Price: "price",
30
43
  Throughput: "throughput",
@@ -46,27 +59,28 @@ export function providerPreferencesIgnoreToJSON(providerPreferencesIgnore) {
46
59
  return JSON.stringify(ProviderPreferencesIgnore$outboundSchema.parse(providerPreferencesIgnore));
47
60
  }
48
61
  /** @internal */
49
- export const SortEnum$outboundSchema = openEnums
50
- .outboundSchema(SortEnum);
62
+ export const ProviderPreferencesSortEnum$outboundSchema = openEnums.outboundSchema(ProviderPreferencesSortEnum);
63
+ /** @internal */
64
+ export const ProviderPreferencesProviderSortConfigEnum$outboundSchema = z.enum(ProviderPreferencesProviderSortConfigEnum);
51
65
  /** @internal */
52
- export const ProviderSortConfigEnum$outboundSchema = z.enum(ProviderSortConfigEnum);
66
+ export const ProviderPreferencesBy$outboundSchema = openEnums.outboundSchema(ProviderPreferencesBy);
53
67
  /** @internal */
54
68
  export const ProviderPreferencesPartition$outboundSchema = openEnums.outboundSchema(ProviderPreferencesPartition);
55
69
  /** @internal */
56
70
  export const ProviderPreferencesProviderSortConfig$outboundSchema = z.object({
57
- by: z.nullable(ProviderSort$outboundSchema).optional(),
71
+ by: z.nullable(ProviderPreferencesBy$outboundSchema).optional(),
58
72
  partition: z.nullable(ProviderPreferencesPartition$outboundSchema).optional(),
59
73
  });
60
74
  export function providerPreferencesProviderSortConfigToJSON(providerPreferencesProviderSortConfig) {
61
75
  return JSON.stringify(ProviderPreferencesProviderSortConfig$outboundSchema.parse(providerPreferencesProviderSortConfig));
62
76
  }
63
77
  /** @internal */
64
- export const ProviderSortConfigUnion$outboundSchema = z.union([
78
+ export const ProviderPreferencesProviderSortConfigUnion$outboundSchema = z.union([
65
79
  z.lazy(() => ProviderPreferencesProviderSortConfig$outboundSchema),
66
- ProviderSortConfigEnum$outboundSchema,
80
+ ProviderPreferencesProviderSortConfigEnum$outboundSchema,
67
81
  ]);
68
- export function providerSortConfigUnionToJSON(providerSortConfigUnion) {
69
- return JSON.stringify(ProviderSortConfigUnion$outboundSchema.parse(providerSortConfigUnion));
82
+ export function providerPreferencesProviderSortConfigUnionToJSON(providerPreferencesProviderSortConfigUnion) {
83
+ return JSON.stringify(ProviderPreferencesProviderSortConfigUnion$outboundSchema.parse(providerPreferencesProviderSortConfigUnion));
70
84
  }
71
85
  /** @internal */
72
86
  export const ProviderPreferencesProviderSort$outboundSchema = openEnums.outboundSchema(ProviderPreferencesProviderSort);
@@ -75,9 +89,9 @@ export const ProviderPreferencesSortUnion$outboundSchema = z.union([
75
89
  ProviderPreferencesProviderSort$outboundSchema,
76
90
  z.union([
77
91
  z.lazy(() => ProviderPreferencesProviderSortConfig$outboundSchema),
78
- ProviderSortConfigEnum$outboundSchema,
92
+ ProviderPreferencesProviderSortConfigEnum$outboundSchema,
79
93
  ]),
80
- SortEnum$outboundSchema,
94
+ ProviderPreferencesSortEnum$outboundSchema,
81
95
  ]);
82
96
  export function providerPreferencesSortUnionToJSON(providerPreferencesSortUnion) {
83
97
  return JSON.stringify(ProviderPreferencesSortUnion$outboundSchema.parse(providerPreferencesSortUnion));
@@ -110,9 +124,9 @@ export const ProviderPreferences$outboundSchema = z.object({
110
124
  ProviderPreferencesProviderSort$outboundSchema,
111
125
  z.union([
112
126
  z.lazy(() => ProviderPreferencesProviderSortConfig$outboundSchema),
113
- ProviderSortConfigEnum$outboundSchema,
127
+ ProviderPreferencesProviderSortConfigEnum$outboundSchema,
114
128
  ]),
115
- SortEnum$outboundSchema,
129
+ ProviderPreferencesSortEnum$outboundSchema,
116
130
  ])).optional(),
117
131
  maxPrice: z.lazy(() => ProviderPreferencesMaxPrice$outboundSchema).optional(),
118
132
  preferredMinThroughput: z.nullable(PreferredMinThroughput$outboundSchema)
@@ -1,10 +1,16 @@
1
1
  import * as z from "zod/v4";
2
2
  import { OpenEnum } from "../types/enums.js";
3
+ /**
4
+ * The provider sorting strategy (price, throughput, latency)
5
+ */
3
6
  export declare const ProviderSort: {
4
7
  readonly Price: "price";
5
8
  readonly Throughput: "throughput";
6
9
  readonly Latency: "latency";
7
10
  };
11
+ /**
12
+ * The provider sorting strategy (price, throughput, latency)
13
+ */
8
14
  export type ProviderSort = OpenEnum<typeof ProviderSort>;
9
15
  /** @internal */
10
16
  export declare const ProviderSort$outboundSchema: z.ZodType<string, ProviderSort>;
@@ -3,6 +3,9 @@
3
3
  * @generated-id: 7d1e919d1ec3
4
4
  */
5
5
  import * as openEnums from "../types/enums.js";
6
+ /**
7
+ * The provider sorting strategy (price, throughput, latency)
8
+ */
6
9
  export const ProviderSort = {
7
10
  Price: "price",
8
11
  Throughput: "throughput",