kimi-proxy 0.0.1 → 0.1.0

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 (79) hide show
  1. package/README.md +17 -8
  2. package/dist/adapters/anthropicAdapter.js +15 -10
  3. package/dist/adapters/anthropicAdapter.js.map +1 -1
  4. package/dist/config.d.ts +11 -3
  5. package/dist/config.js +2 -0
  6. package/dist/config.js.map +1 -1
  7. package/dist/core/clientAdapters.d.ts +18 -0
  8. package/dist/core/converters/anthropicToOpenAI.js +4 -0
  9. package/dist/core/converters/anthropicToOpenAI.js.map +1 -1
  10. package/dist/core/converters/openaiPassthrough.js +5 -1
  11. package/dist/core/converters/openaiPassthrough.js.map +1 -1
  12. package/dist/core/ensureToolCall.d.ts +3 -3
  13. package/dist/core/json.d.ts +3 -0
  14. package/dist/core/modelRegistry.d.ts +9 -1
  15. package/dist/core/modelRegistry.js +23 -7
  16. package/dist/core/modelRegistry.js.map +1 -1
  17. package/dist/core/pipeline.d.ts +30 -15
  18. package/dist/core/pipeline.js +9 -0
  19. package/dist/core/pipeline.js.map +1 -1
  20. package/dist/core/pipelineControl.d.ts +1 -1
  21. package/dist/core/providerAdapters.d.ts +4 -0
  22. package/dist/core/providers/anthropic.d.ts +16 -0
  23. package/dist/core/providers/openRouterProvider.js +1 -1
  24. package/dist/core/providers/openRouterProvider.js.map +1 -1
  25. package/dist/core/providers/openai.d.ts +2192 -0
  26. package/dist/core/providers/openrouter.d.ts +31 -0
  27. package/dist/core/providers/shared.d.ts +10 -0
  28. package/dist/core/providers/vertex.d.ts +45 -0
  29. package/dist/core/schemas.d.ts +2841 -0
  30. package/dist/core/transforms/request/EnsureToolCallRequestTransform.d.ts +1 -0
  31. package/dist/core/transforms/request/EnsureToolCallRequestTransform.js +43 -2
  32. package/dist/core/transforms/request/EnsureToolCallRequestTransform.js.map +1 -1
  33. package/dist/core/transforms/request/RestoreThoughtSignaturesTransform.d.ts +10 -0
  34. package/dist/core/transforms/request/RestoreThoughtSignaturesTransform.js +93 -0
  35. package/dist/core/transforms/request/RestoreThoughtSignaturesTransform.js.map +1 -0
  36. package/dist/core/transforms/response/CleanupExtraPropertiesResponseTransform.d.ts +7 -0
  37. package/dist/core/transforms/response/CleanupExtraPropertiesResponseTransform.js +30 -0
  38. package/dist/core/transforms/response/CleanupExtraPropertiesResponseTransform.js.map +1 -0
  39. package/dist/core/transforms/response/EnsureToolCallResponseTransform.d.ts +1 -0
  40. package/dist/core/transforms/response/EnsureToolCallResponseTransform.js +60 -3
  41. package/dist/core/transforms/response/EnsureToolCallResponseTransform.js.map +1 -1
  42. package/dist/core/transforms/response/ExtractThoughtSignaturesTransform.d.ts +10 -0
  43. package/dist/core/transforms/response/ExtractThoughtSignaturesTransform.js +80 -0
  44. package/dist/core/transforms/response/ExtractThoughtSignaturesTransform.js.map +1 -0
  45. package/dist/core/transforms/response/ValidateToolArgumentsTransform.d.ts +9 -0
  46. package/dist/core/transforms/response/ValidateToolArgumentsTransform.js +107 -0
  47. package/dist/core/transforms/response/ValidateToolArgumentsTransform.js.map +1 -0
  48. package/dist/core/transforms.d.ts +44 -0
  49. package/dist/core/types.d.ts +2765 -51
  50. package/dist/index.js +5926 -12
  51. package/dist/index.js.map +37 -1
  52. package/dist/livestore/runtime.d.ts +71 -0
  53. package/dist/persistence/hybridLogStore.d.ts +82 -0
  54. package/dist/persistence/migrateLogs.d.ts +1 -0
  55. package/dist/persistence/signatureCache.d.ts +18 -0
  56. package/dist/persistence/signatureCache.js +151 -0
  57. package/dist/persistence/signatureCache.js.map +1 -0
  58. package/dist/server.d.ts +1 -1
  59. package/dist/server.js +100 -16
  60. package/dist/server.js.map +1 -1
  61. package/dist/services/blobSearch/ripgrep.d.ts +17 -0
  62. package/dist/services/kimiFixer.d.ts +1 -1
  63. package/dist/services/kimiFixer.js +49 -26
  64. package/dist/services/kimiFixer.js.map +1 -1
  65. package/dist/services/logSearch.d.ts +15 -0
  66. package/dist/services/streaming.d.ts +4 -4
  67. package/dist/services/streaming.js +10 -6
  68. package/dist/services/streaming.js.map +1 -1
  69. package/dist/utils/envResolver.d.ts +1 -1
  70. package/dist/utils/httpCapture.d.ts +19 -0
  71. package/frontend/dist/assets/JSONViewer-516863bb.js +3 -0
  72. package/frontend/dist/assets/index-413f3c24.css +1 -0
  73. package/frontend/dist/assets/index-fd87815b.js +300 -0
  74. package/frontend/dist/assets/wa-sqlite-be172f22.wasm +0 -0
  75. package/frontend/dist/index.html +2 -2
  76. package/package.json +31 -16
  77. package/frontend/dist/assets/JSONViewer-97138fd7.js +0 -3
  78. package/frontend/dist/assets/index-0e7c091b.css +0 -1
  79. package/frontend/dist/assets/index-4b354ce2.js +0 -40
@@ -1,3 +1,5 @@
1
+ import { z } from "zod";
2
+ import { type ClientRequest } from "./schemas.js";
1
3
  export declare enum ClientFormat {
2
4
  OpenAIChatCompletions = "openai.chat-completions",
3
5
  AnthropicMessages = "anthropic.messages",
@@ -5,12 +7,8 @@ export declare enum ClientFormat {
5
7
  }
6
8
  export declare enum ProviderFormat {
7
9
  OpenAIChatCompletions = "openai.chat-completions",
8
- VertexChatCompletions = "vertex.chat-completions"
9
- }
10
- export declare enum ProxyOperation {
11
- ChatCompletions = "chat.completions",
12
- Messages = "messages",
13
- Responses = "responses"
10
+ VertexChatCompletions = "vertex.chat-completions",
11
+ OpenRouterChatCompletions = "openrouter.chat-completions"
14
12
  }
15
13
  export type JsonPrimitive = string | number | boolean | null;
16
14
  export type JsonArray = JsonValue[];
@@ -18,63 +16,2779 @@ export interface JsonObject {
18
16
  [key: string]: JsonValue | undefined;
19
17
  }
20
18
  export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
21
- export interface ProxyRequest<TBody extends JsonValue = JsonObject> {
19
+ export declare function isJsonObject(value: JsonValue): value is JsonObject;
20
+ export declare enum Operation {
21
+ Chat = "chat",
22
+ Messages = "messages",
23
+ Responses = "responses"
24
+ }
25
+ export type Role = string;
26
+ export declare const ContentSchema: z.ZodObject<{
27
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
28
+ text: z.ZodOptional<z.ZodString>;
29
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
30
+ url: z.ZodOptional<z.ZodString>;
31
+ mime: z.ZodOptional<z.ZodString>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
34
+ text?: string | undefined;
35
+ url?: string | undefined;
36
+ data?: JsonValue | undefined;
37
+ mime?: string | undefined;
38
+ }, {
39
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
40
+ text?: string | undefined;
41
+ url?: string | undefined;
42
+ data?: JsonValue | undefined;
43
+ mime?: string | undefined;
44
+ }>;
45
+ export type ContentBlock = z.infer<typeof ContentSchema> & {
46
+ data?: JsonValue;
47
+ };
48
+ export declare const ToolCallSchema: z.ZodObject<{
49
+ id: z.ZodString;
50
+ type: z.ZodLiteral<"function">;
51
+ name: z.ZodString;
52
+ arguments: z.ZodDefault<z.ZodString>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ name: string;
55
+ type: "function";
56
+ id: string;
57
+ arguments: string;
58
+ }, {
59
+ name: string;
60
+ type: "function";
61
+ id: string;
62
+ arguments?: string | undefined;
63
+ }>;
64
+ export type ToolCall = z.infer<typeof ToolCallSchema>;
65
+ export declare const MessageSchema: z.ZodObject<{
66
+ role: z.ZodString;
67
+ tool_call_id: z.ZodOptional<z.ZodString>;
68
+ content: z.ZodDefault<z.ZodArray<z.ZodObject<{
69
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
70
+ text: z.ZodOptional<z.ZodString>;
71
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
72
+ url: z.ZodOptional<z.ZodString>;
73
+ mime: z.ZodOptional<z.ZodString>;
74
+ }, "strip", z.ZodTypeAny, {
75
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
76
+ text?: string | undefined;
77
+ url?: string | undefined;
78
+ data?: JsonValue | undefined;
79
+ mime?: string | undefined;
80
+ }, {
81
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
82
+ text?: string | undefined;
83
+ url?: string | undefined;
84
+ data?: JsonValue | undefined;
85
+ mime?: string | undefined;
86
+ }>, "many">>;
87
+ tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
88
+ id: z.ZodString;
89
+ type: z.ZodLiteral<"function">;
90
+ name: z.ZodString;
91
+ arguments: z.ZodDefault<z.ZodString>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ name: string;
94
+ type: "function";
95
+ id: string;
96
+ arguments: string;
97
+ }, {
98
+ name: string;
99
+ type: "function";
100
+ id: string;
101
+ arguments?: string | undefined;
102
+ }>, "many">>;
103
+ annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
104
+ thinking: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{
105
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
106
+ text: z.ZodOptional<z.ZodString>;
107
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
108
+ url: z.ZodOptional<z.ZodString>;
109
+ mime: z.ZodOptional<z.ZodString>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
112
+ text?: string | undefined;
113
+ url?: string | undefined;
114
+ data?: JsonValue | undefined;
115
+ mime?: string | undefined;
116
+ }, {
117
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
118
+ text?: string | undefined;
119
+ url?: string | undefined;
120
+ data?: JsonValue | undefined;
121
+ mime?: string | undefined;
122
+ }>, "many">]>>;
123
+ }, "strip", z.ZodTypeAny, {
124
+ role: string;
125
+ content: {
126
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
127
+ text?: string | undefined;
128
+ url?: string | undefined;
129
+ data?: JsonValue | undefined;
130
+ mime?: string | undefined;
131
+ }[];
132
+ tool_calls?: {
133
+ name: string;
134
+ type: "function";
135
+ id: string;
136
+ arguments: string;
137
+ }[] | undefined;
138
+ tool_call_id?: string | undefined;
139
+ thinking?: string | {
140
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
141
+ text?: string | undefined;
142
+ url?: string | undefined;
143
+ data?: JsonValue | undefined;
144
+ mime?: string | undefined;
145
+ }[] | undefined;
146
+ annotations?: Record<string, unknown> | undefined;
147
+ }, {
148
+ role: string;
149
+ content?: {
150
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
151
+ text?: string | undefined;
152
+ url?: string | undefined;
153
+ data?: JsonValue | undefined;
154
+ mime?: string | undefined;
155
+ }[] | undefined;
156
+ tool_calls?: {
157
+ name: string;
158
+ type: "function";
159
+ id: string;
160
+ arguments?: string | undefined;
161
+ }[] | undefined;
162
+ tool_call_id?: string | undefined;
163
+ thinking?: string | {
164
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
165
+ text?: string | undefined;
166
+ url?: string | undefined;
167
+ data?: JsonValue | undefined;
168
+ mime?: string | undefined;
169
+ }[] | undefined;
170
+ annotations?: Record<string, unknown> | undefined;
171
+ }>;
172
+ export type Message = z.infer<typeof MessageSchema>;
173
+ export declare const ToolSchema: z.ZodObject<{
174
+ type: z.ZodLiteral<"function">;
175
+ name: z.ZodString;
176
+ description: z.ZodOptional<z.ZodString>;
177
+ strict: z.ZodOptional<z.ZodBoolean>;
178
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>>;
179
+ }, "strip", z.ZodTypeAny, {
180
+ name: string;
181
+ type: "function";
182
+ description?: string | undefined;
183
+ parameters?: Record<string, JsonValue> | undefined;
184
+ strict?: boolean | undefined;
185
+ }, {
186
+ name: string;
187
+ type: "function";
188
+ description?: string | undefined;
189
+ parameters?: Record<string, JsonValue> | undefined;
190
+ strict?: boolean | undefined;
191
+ }>;
192
+ export type Tool = z.infer<typeof ToolSchema>;
193
+ export declare const UsageSchema: z.ZodObject<{
194
+ input_tokens: z.ZodOptional<z.ZodNumber>;
195
+ output_tokens: z.ZodOptional<z.ZodNumber>;
196
+ total_tokens: z.ZodOptional<z.ZodNumber>;
197
+ }, "strip", z.ZodTypeAny, {
198
+ total_tokens?: number | undefined;
199
+ input_tokens?: number | undefined;
200
+ output_tokens?: number | undefined;
201
+ }, {
202
+ total_tokens?: number | undefined;
203
+ input_tokens?: number | undefined;
204
+ output_tokens?: number | undefined;
205
+ }>;
206
+ export type Usage = z.infer<typeof UsageSchema>;
207
+ export declare const RequestSchema: z.ZodObject<{
208
+ id: z.ZodString;
209
+ model: z.ZodString;
210
+ profile: z.ZodOptional<z.ZodString>;
211
+ operation: z.ZodNativeEnum<typeof Operation>;
212
+ system: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
213
+ messages: z.ZodArray<z.ZodObject<{
214
+ role: z.ZodString;
215
+ tool_call_id: z.ZodOptional<z.ZodString>;
216
+ content: z.ZodDefault<z.ZodArray<z.ZodObject<{
217
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
218
+ text: z.ZodOptional<z.ZodString>;
219
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
220
+ url: z.ZodOptional<z.ZodString>;
221
+ mime: z.ZodOptional<z.ZodString>;
222
+ }, "strip", z.ZodTypeAny, {
223
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
224
+ text?: string | undefined;
225
+ url?: string | undefined;
226
+ data?: JsonValue | undefined;
227
+ mime?: string | undefined;
228
+ }, {
229
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
230
+ text?: string | undefined;
231
+ url?: string | undefined;
232
+ data?: JsonValue | undefined;
233
+ mime?: string | undefined;
234
+ }>, "many">>;
235
+ tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
236
+ id: z.ZodString;
237
+ type: z.ZodLiteral<"function">;
238
+ name: z.ZodString;
239
+ arguments: z.ZodDefault<z.ZodString>;
240
+ }, "strip", z.ZodTypeAny, {
241
+ name: string;
242
+ type: "function";
243
+ id: string;
244
+ arguments: string;
245
+ }, {
246
+ name: string;
247
+ type: "function";
248
+ id: string;
249
+ arguments?: string | undefined;
250
+ }>, "many">>;
251
+ annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
252
+ thinking: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{
253
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
254
+ text: z.ZodOptional<z.ZodString>;
255
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
256
+ url: z.ZodOptional<z.ZodString>;
257
+ mime: z.ZodOptional<z.ZodString>;
258
+ }, "strip", z.ZodTypeAny, {
259
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
260
+ text?: string | undefined;
261
+ url?: string | undefined;
262
+ data?: JsonValue | undefined;
263
+ mime?: string | undefined;
264
+ }, {
265
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
266
+ text?: string | undefined;
267
+ url?: string | undefined;
268
+ data?: JsonValue | undefined;
269
+ mime?: string | undefined;
270
+ }>, "many">]>>;
271
+ }, "strip", z.ZodTypeAny, {
272
+ role: string;
273
+ content: {
274
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
275
+ text?: string | undefined;
276
+ url?: string | undefined;
277
+ data?: JsonValue | undefined;
278
+ mime?: string | undefined;
279
+ }[];
280
+ tool_calls?: {
281
+ name: string;
282
+ type: "function";
283
+ id: string;
284
+ arguments: string;
285
+ }[] | undefined;
286
+ tool_call_id?: string | undefined;
287
+ thinking?: string | {
288
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
289
+ text?: string | undefined;
290
+ url?: string | undefined;
291
+ data?: JsonValue | undefined;
292
+ mime?: string | undefined;
293
+ }[] | undefined;
294
+ annotations?: Record<string, unknown> | undefined;
295
+ }, {
296
+ role: string;
297
+ content?: {
298
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
299
+ text?: string | undefined;
300
+ url?: string | undefined;
301
+ data?: JsonValue | undefined;
302
+ mime?: string | undefined;
303
+ }[] | undefined;
304
+ tool_calls?: {
305
+ name: string;
306
+ type: "function";
307
+ id: string;
308
+ arguments?: string | undefined;
309
+ }[] | undefined;
310
+ tool_call_id?: string | undefined;
311
+ thinking?: string | {
312
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
313
+ text?: string | undefined;
314
+ url?: string | undefined;
315
+ data?: JsonValue | undefined;
316
+ mime?: string | undefined;
317
+ }[] | undefined;
318
+ annotations?: Record<string, unknown> | undefined;
319
+ }>, "many">;
320
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
321
+ type: z.ZodLiteral<"function">;
322
+ name: z.ZodString;
323
+ description: z.ZodOptional<z.ZodString>;
324
+ strict: z.ZodOptional<z.ZodBoolean>;
325
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>>;
326
+ }, "strip", z.ZodTypeAny, {
327
+ name: string;
328
+ type: "function";
329
+ description?: string | undefined;
330
+ parameters?: Record<string, JsonValue> | undefined;
331
+ strict?: boolean | undefined;
332
+ }, {
333
+ name: string;
334
+ type: "function";
335
+ description?: string | undefined;
336
+ parameters?: Record<string, JsonValue> | undefined;
337
+ strict?: boolean | undefined;
338
+ }>, "many">>;
339
+ stream: z.ZodDefault<z.ZodBoolean>;
340
+ state: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>>;
341
+ parameters: z.ZodDefault<z.ZodObject<{
342
+ temperature: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
343
+ top_p: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
344
+ top_k: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
345
+ max_tokens: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
346
+ thinking: z.ZodOptional<z.ZodOptional<z.ZodUnknown>>;
347
+ thinking_config: z.ZodOptional<z.ZodOptional<z.ZodUnknown>>;
348
+ }, "strip", z.ZodTypeAny, {
349
+ temperature?: number | undefined;
350
+ top_p?: number | undefined;
351
+ max_tokens?: number | undefined;
352
+ thinking?: unknown;
353
+ top_k?: number | undefined;
354
+ thinking_config?: unknown;
355
+ }, {
356
+ temperature?: number | undefined;
357
+ top_p?: number | undefined;
358
+ max_tokens?: number | undefined;
359
+ thinking?: unknown;
360
+ top_k?: number | undefined;
361
+ thinking_config?: unknown;
362
+ }>>;
363
+ metadata: z.ZodDefault<z.ZodObject<{
364
+ headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
365
+ clientFormat: z.ZodString;
366
+ providerFormat: z.ZodOptional<z.ZodString>;
367
+ clientRequest: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
368
+ model: z.ZodString;
369
+ messages: z.ZodArray<z.ZodObject<{
370
+ role: z.ZodString;
371
+ content: z.ZodNullable<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
372
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
373
+ text: z.ZodString;
374
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
375
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
376
+ text: z.ZodString;
377
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
378
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
379
+ text: z.ZodString;
380
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
381
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
382
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
383
+ url: z.ZodString;
384
+ detail: z.ZodOptional<z.ZodString>;
385
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
386
+ url: z.ZodString;
387
+ detail: z.ZodOptional<z.ZodString>;
388
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
389
+ url: z.ZodString;
390
+ detail: z.ZodOptional<z.ZodString>;
391
+ }, z.ZodTypeAny, "passthrough">>]>;
392
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
393
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
394
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
395
+ url: z.ZodString;
396
+ detail: z.ZodOptional<z.ZodString>;
397
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
398
+ url: z.ZodString;
399
+ detail: z.ZodOptional<z.ZodString>;
400
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
401
+ url: z.ZodString;
402
+ detail: z.ZodOptional<z.ZodString>;
403
+ }, z.ZodTypeAny, "passthrough">>]>;
404
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
405
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
406
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
407
+ url: z.ZodString;
408
+ detail: z.ZodOptional<z.ZodString>;
409
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
410
+ url: z.ZodString;
411
+ detail: z.ZodOptional<z.ZodString>;
412
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
413
+ url: z.ZodString;
414
+ detail: z.ZodOptional<z.ZodString>;
415
+ }, z.ZodTypeAny, "passthrough">>]>;
416
+ }, z.ZodTypeAny, "passthrough">>]>, "many">]>>>;
417
+ name: z.ZodOptional<z.ZodString>;
418
+ tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
419
+ id: z.ZodString;
420
+ type: z.ZodDefault<z.ZodLiteral<"function">>;
421
+ function: z.ZodObject<{
422
+ name: z.ZodString;
423
+ arguments: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
424
+ }, "strip", z.ZodTypeAny, {
425
+ name: string;
426
+ arguments?: string | Record<string, unknown> | undefined;
427
+ }, {
428
+ name: string;
429
+ arguments?: string | Record<string, unknown> | undefined;
430
+ }>;
431
+ }, "strip", z.ZodTypeAny, {
432
+ function: {
433
+ name: string;
434
+ arguments?: string | Record<string, unknown> | undefined;
435
+ };
436
+ type: "function";
437
+ id: string;
438
+ }, {
439
+ function: {
440
+ name: string;
441
+ arguments?: string | Record<string, unknown> | undefined;
442
+ };
443
+ id: string;
444
+ type?: "function" | undefined;
445
+ }>, "many">>;
446
+ function_call: z.ZodOptional<z.ZodNullable<z.ZodObject<{
447
+ name: z.ZodString;
448
+ arguments: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
449
+ }, "strip", z.ZodTypeAny, {
450
+ name: string;
451
+ arguments?: string | Record<string, unknown> | undefined;
452
+ }, {
453
+ name: string;
454
+ arguments?: string | Record<string, unknown> | undefined;
455
+ }>>>;
456
+ tool_call_id: z.ZodOptional<z.ZodString>;
457
+ }, "strip", z.ZodTypeAny, {
458
+ role: string;
459
+ name?: string | undefined;
460
+ content?: string | (z.objectOutputType<{
461
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
462
+ text: z.ZodString;
463
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
464
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
465
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
466
+ url: z.ZodString;
467
+ detail: z.ZodOptional<z.ZodString>;
468
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
469
+ url: z.ZodString;
470
+ detail: z.ZodOptional<z.ZodString>;
471
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
472
+ url: z.ZodString;
473
+ detail: z.ZodOptional<z.ZodString>;
474
+ }, z.ZodTypeAny, "passthrough">>]>;
475
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
476
+ tool_calls?: {
477
+ function: {
478
+ name: string;
479
+ arguments?: string | Record<string, unknown> | undefined;
480
+ };
481
+ type: "function";
482
+ id: string;
483
+ }[] | undefined;
484
+ function_call?: {
485
+ name: string;
486
+ arguments?: string | Record<string, unknown> | undefined;
487
+ } | null | undefined;
488
+ tool_call_id?: string | undefined;
489
+ }, {
490
+ role: string;
491
+ name?: string | undefined;
492
+ content?: string | (z.objectInputType<{
493
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
494
+ text: z.ZodString;
495
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
496
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
497
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
498
+ url: z.ZodString;
499
+ detail: z.ZodOptional<z.ZodString>;
500
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
501
+ url: z.ZodString;
502
+ detail: z.ZodOptional<z.ZodString>;
503
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
504
+ url: z.ZodString;
505
+ detail: z.ZodOptional<z.ZodString>;
506
+ }, z.ZodTypeAny, "passthrough">>]>;
507
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
508
+ tool_calls?: {
509
+ function: {
510
+ name: string;
511
+ arguments?: string | Record<string, unknown> | undefined;
512
+ };
513
+ id: string;
514
+ type?: "function" | undefined;
515
+ }[] | undefined;
516
+ function_call?: {
517
+ name: string;
518
+ arguments?: string | Record<string, unknown> | undefined;
519
+ } | null | undefined;
520
+ tool_call_id?: string | undefined;
521
+ }>, "many">;
522
+ temperature: z.ZodOptional<z.ZodNumber>;
523
+ top_p: z.ZodOptional<z.ZodNumber>;
524
+ n: z.ZodOptional<z.ZodNumber>;
525
+ stream: z.ZodOptional<z.ZodBoolean>;
526
+ stop: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
527
+ max_completion_tokens: z.ZodOptional<z.ZodNumber>;
528
+ max_tokens: z.ZodOptional<z.ZodNumber>;
529
+ presence_penalty: z.ZodOptional<z.ZodNumber>;
530
+ frequency_penalty: z.ZodOptional<z.ZodNumber>;
531
+ logit_bias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
532
+ user: z.ZodOptional<z.ZodString>;
533
+ functions: z.ZodOptional<z.ZodArray<z.ZodObject<{
534
+ name: z.ZodString;
535
+ description: z.ZodOptional<z.ZodString>;
536
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
537
+ strict: z.ZodOptional<z.ZodBoolean>;
538
+ }, "strip", z.ZodTypeAny, {
539
+ name: string;
540
+ description?: string | undefined;
541
+ parameters?: Record<string, unknown> | undefined;
542
+ strict?: boolean | undefined;
543
+ }, {
544
+ name: string;
545
+ description?: string | undefined;
546
+ parameters?: Record<string, unknown> | undefined;
547
+ strict?: boolean | undefined;
548
+ }>, "many">>;
549
+ function_call: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
550
+ name: z.ZodString;
551
+ }, "strip", z.ZodTypeAny, {
552
+ name: string;
553
+ }, {
554
+ name: string;
555
+ }>]>>;
556
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
557
+ type: z.ZodDefault<z.ZodLiteral<"function">>;
558
+ function: z.ZodObject<{
559
+ name: z.ZodString;
560
+ description: z.ZodOptional<z.ZodString>;
561
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
562
+ strict: z.ZodOptional<z.ZodBoolean>;
563
+ }, "strip", z.ZodTypeAny, {
564
+ name: string;
565
+ description?: string | undefined;
566
+ parameters?: Record<string, unknown> | undefined;
567
+ strict?: boolean | undefined;
568
+ }, {
569
+ name: string;
570
+ description?: string | undefined;
571
+ parameters?: Record<string, unknown> | undefined;
572
+ strict?: boolean | undefined;
573
+ }>;
574
+ }, "strip", z.ZodTypeAny, {
575
+ function: {
576
+ name: string;
577
+ description?: string | undefined;
578
+ parameters?: Record<string, unknown> | undefined;
579
+ strict?: boolean | undefined;
580
+ };
581
+ type: "function";
582
+ }, {
583
+ function: {
584
+ name: string;
585
+ description?: string | undefined;
586
+ parameters?: Record<string, unknown> | undefined;
587
+ strict?: boolean | undefined;
588
+ };
589
+ type?: "function" | undefined;
590
+ }>, "many">>;
591
+ tool_choice: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
592
+ type: z.ZodString;
593
+ function: z.ZodObject<{
594
+ name: z.ZodString;
595
+ }, "strip", z.ZodTypeAny, {
596
+ name: string;
597
+ }, {
598
+ name: string;
599
+ }>;
600
+ }, "strip", z.ZodTypeAny, {
601
+ function: {
602
+ name: string;
603
+ };
604
+ type: string;
605
+ }, {
606
+ function: {
607
+ name: string;
608
+ };
609
+ type: string;
610
+ }>]>>;
611
+ }, "strip", z.ZodTypeAny, {
612
+ model: string;
613
+ messages: {
614
+ role: string;
615
+ name?: string | undefined;
616
+ content?: string | (z.objectOutputType<{
617
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
618
+ text: z.ZodString;
619
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
620
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
621
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
622
+ url: z.ZodString;
623
+ detail: z.ZodOptional<z.ZodString>;
624
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
625
+ url: z.ZodString;
626
+ detail: z.ZodOptional<z.ZodString>;
627
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
628
+ url: z.ZodString;
629
+ detail: z.ZodOptional<z.ZodString>;
630
+ }, z.ZodTypeAny, "passthrough">>]>;
631
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
632
+ tool_calls?: {
633
+ function: {
634
+ name: string;
635
+ arguments?: string | Record<string, unknown> | undefined;
636
+ };
637
+ type: "function";
638
+ id: string;
639
+ }[] | undefined;
640
+ function_call?: {
641
+ name: string;
642
+ arguments?: string | Record<string, unknown> | undefined;
643
+ } | null | undefined;
644
+ tool_call_id?: string | undefined;
645
+ }[];
646
+ function_call?: string | {
647
+ name: string;
648
+ } | undefined;
649
+ temperature?: number | undefined;
650
+ top_p?: number | undefined;
651
+ n?: number | undefined;
652
+ stream?: boolean | undefined;
653
+ stop?: string | string[] | undefined;
654
+ max_completion_tokens?: number | undefined;
655
+ max_tokens?: number | undefined;
656
+ presence_penalty?: number | undefined;
657
+ frequency_penalty?: number | undefined;
658
+ logit_bias?: Record<string, number> | undefined;
659
+ user?: string | undefined;
660
+ functions?: {
661
+ name: string;
662
+ description?: string | undefined;
663
+ parameters?: Record<string, unknown> | undefined;
664
+ strict?: boolean | undefined;
665
+ }[] | undefined;
666
+ tools?: {
667
+ function: {
668
+ name: string;
669
+ description?: string | undefined;
670
+ parameters?: Record<string, unknown> | undefined;
671
+ strict?: boolean | undefined;
672
+ };
673
+ type: "function";
674
+ }[] | undefined;
675
+ tool_choice?: string | {
676
+ function: {
677
+ name: string;
678
+ };
679
+ type: string;
680
+ } | undefined;
681
+ }, {
682
+ model: string;
683
+ messages: {
684
+ role: string;
685
+ name?: string | undefined;
686
+ content?: string | (z.objectInputType<{
687
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
688
+ text: z.ZodString;
689
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
690
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
691
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
692
+ url: z.ZodString;
693
+ detail: z.ZodOptional<z.ZodString>;
694
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
695
+ url: z.ZodString;
696
+ detail: z.ZodOptional<z.ZodString>;
697
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
698
+ url: z.ZodString;
699
+ detail: z.ZodOptional<z.ZodString>;
700
+ }, z.ZodTypeAny, "passthrough">>]>;
701
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
702
+ tool_calls?: {
703
+ function: {
704
+ name: string;
705
+ arguments?: string | Record<string, unknown> | undefined;
706
+ };
707
+ id: string;
708
+ type?: "function" | undefined;
709
+ }[] | undefined;
710
+ function_call?: {
711
+ name: string;
712
+ arguments?: string | Record<string, unknown> | undefined;
713
+ } | null | undefined;
714
+ tool_call_id?: string | undefined;
715
+ }[];
716
+ function_call?: string | {
717
+ name: string;
718
+ } | undefined;
719
+ temperature?: number | undefined;
720
+ top_p?: number | undefined;
721
+ n?: number | undefined;
722
+ stream?: boolean | undefined;
723
+ stop?: string | string[] | undefined;
724
+ max_completion_tokens?: number | undefined;
725
+ max_tokens?: number | undefined;
726
+ presence_penalty?: number | undefined;
727
+ frequency_penalty?: number | undefined;
728
+ logit_bias?: Record<string, number> | undefined;
729
+ user?: string | undefined;
730
+ functions?: {
731
+ name: string;
732
+ description?: string | undefined;
733
+ parameters?: Record<string, unknown> | undefined;
734
+ strict?: boolean | undefined;
735
+ }[] | undefined;
736
+ tools?: {
737
+ function: {
738
+ name: string;
739
+ description?: string | undefined;
740
+ parameters?: Record<string, unknown> | undefined;
741
+ strict?: boolean | undefined;
742
+ };
743
+ type?: "function" | undefined;
744
+ }[] | undefined;
745
+ tool_choice?: string | {
746
+ function: {
747
+ name: string;
748
+ };
749
+ type: string;
750
+ } | undefined;
751
+ }>, z.ZodObject<{
752
+ model: z.ZodString;
753
+ messages: z.ZodArray<z.ZodObject<{
754
+ role: z.ZodString;
755
+ content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{
756
+ type: z.ZodOptional<z.ZodString>;
757
+ text: z.ZodOptional<z.ZodString>;
758
+ thinking: z.ZodOptional<z.ZodString>;
759
+ signature: z.ZodOptional<z.ZodString>;
760
+ source: z.ZodOptional<z.ZodUnknown>;
761
+ id: z.ZodOptional<z.ZodString>;
762
+ name: z.ZodOptional<z.ZodString>;
763
+ input: z.ZodOptional<z.ZodUnknown>;
764
+ tool_use_id: z.ZodOptional<z.ZodString>;
765
+ content: z.ZodOptional<z.ZodUnknown>;
766
+ is_error: z.ZodOptional<z.ZodBoolean>;
767
+ data: z.ZodOptional<z.ZodUnknown>;
768
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
769
+ type: z.ZodOptional<z.ZodString>;
770
+ text: z.ZodOptional<z.ZodString>;
771
+ thinking: z.ZodOptional<z.ZodString>;
772
+ signature: z.ZodOptional<z.ZodString>;
773
+ source: z.ZodOptional<z.ZodUnknown>;
774
+ id: z.ZodOptional<z.ZodString>;
775
+ name: z.ZodOptional<z.ZodString>;
776
+ input: z.ZodOptional<z.ZodUnknown>;
777
+ tool_use_id: z.ZodOptional<z.ZodString>;
778
+ content: z.ZodOptional<z.ZodUnknown>;
779
+ is_error: z.ZodOptional<z.ZodBoolean>;
780
+ data: z.ZodOptional<z.ZodUnknown>;
781
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
782
+ type: z.ZodOptional<z.ZodString>;
783
+ text: z.ZodOptional<z.ZodString>;
784
+ thinking: z.ZodOptional<z.ZodString>;
785
+ signature: z.ZodOptional<z.ZodString>;
786
+ source: z.ZodOptional<z.ZodUnknown>;
787
+ id: z.ZodOptional<z.ZodString>;
788
+ name: z.ZodOptional<z.ZodString>;
789
+ input: z.ZodOptional<z.ZodUnknown>;
790
+ tool_use_id: z.ZodOptional<z.ZodString>;
791
+ content: z.ZodOptional<z.ZodUnknown>;
792
+ is_error: z.ZodOptional<z.ZodBoolean>;
793
+ data: z.ZodOptional<z.ZodUnknown>;
794
+ }, z.ZodTypeAny, "passthrough">>, "many">]>;
795
+ }, "strip", z.ZodTypeAny, {
796
+ role: string;
797
+ content: string | z.objectOutputType<{
798
+ type: z.ZodOptional<z.ZodString>;
799
+ text: z.ZodOptional<z.ZodString>;
800
+ thinking: z.ZodOptional<z.ZodString>;
801
+ signature: z.ZodOptional<z.ZodString>;
802
+ source: z.ZodOptional<z.ZodUnknown>;
803
+ id: z.ZodOptional<z.ZodString>;
804
+ name: z.ZodOptional<z.ZodString>;
805
+ input: z.ZodOptional<z.ZodUnknown>;
806
+ tool_use_id: z.ZodOptional<z.ZodString>;
807
+ content: z.ZodOptional<z.ZodUnknown>;
808
+ is_error: z.ZodOptional<z.ZodBoolean>;
809
+ data: z.ZodOptional<z.ZodUnknown>;
810
+ }, z.ZodTypeAny, "passthrough">[];
811
+ }, {
812
+ role: string;
813
+ content: string | z.objectInputType<{
814
+ type: z.ZodOptional<z.ZodString>;
815
+ text: z.ZodOptional<z.ZodString>;
816
+ thinking: z.ZodOptional<z.ZodString>;
817
+ signature: z.ZodOptional<z.ZodString>;
818
+ source: z.ZodOptional<z.ZodUnknown>;
819
+ id: z.ZodOptional<z.ZodString>;
820
+ name: z.ZodOptional<z.ZodString>;
821
+ input: z.ZodOptional<z.ZodUnknown>;
822
+ tool_use_id: z.ZodOptional<z.ZodString>;
823
+ content: z.ZodOptional<z.ZodUnknown>;
824
+ is_error: z.ZodOptional<z.ZodBoolean>;
825
+ data: z.ZodOptional<z.ZodUnknown>;
826
+ }, z.ZodTypeAny, "passthrough">[];
827
+ }>, "many">;
828
+ system: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{
829
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
830
+ text: z.ZodString;
831
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
832
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
833
+ text: z.ZodString;
834
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
835
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
836
+ text: z.ZodString;
837
+ }, z.ZodTypeAny, "passthrough">>, "many">]>>;
838
+ max_tokens: z.ZodOptional<z.ZodNumber>;
839
+ metadata: z.ZodOptional<z.ZodObject<{
840
+ user_id: z.ZodOptional<z.ZodString>;
841
+ }, "strip", z.ZodTypeAny, {
842
+ user_id?: string | undefined;
843
+ }, {
844
+ user_id?: string | undefined;
845
+ }>>;
846
+ stop_sequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
847
+ stream: z.ZodOptional<z.ZodBoolean>;
848
+ temperature: z.ZodOptional<z.ZodNumber>;
849
+ top_p: z.ZodOptional<z.ZodNumber>;
850
+ top_k: z.ZodOptional<z.ZodNumber>;
851
+ thinking: z.ZodOptional<z.ZodUnknown>;
852
+ thinking_config: z.ZodOptional<z.ZodUnknown>;
853
+ tools: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
854
+ name: z.ZodString;
855
+ description: z.ZodOptional<z.ZodString>;
856
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
857
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
858
+ name: z.ZodString;
859
+ description: z.ZodOptional<z.ZodString>;
860
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
861
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
862
+ name: z.ZodString;
863
+ description: z.ZodOptional<z.ZodString>;
864
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
865
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
866
+ type: z.ZodString;
867
+ name: z.ZodString;
868
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
869
+ type: z.ZodString;
870
+ name: z.ZodString;
871
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
872
+ type: z.ZodString;
873
+ name: z.ZodString;
874
+ }, z.ZodTypeAny, "passthrough">>]>, "many">>;
875
+ tool_choice: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
876
+ type: z.ZodLiteral<"auto">;
877
+ }, "strip", z.ZodTypeAny, {
878
+ type: "auto";
879
+ }, {
880
+ type: "auto";
881
+ }>, z.ZodObject<{
882
+ type: z.ZodLiteral<"any">;
883
+ }, "strip", z.ZodTypeAny, {
884
+ type: "any";
885
+ }, {
886
+ type: "any";
887
+ }>, z.ZodObject<{
888
+ type: z.ZodLiteral<"tool">;
889
+ name: z.ZodString;
890
+ }, "strip", z.ZodTypeAny, {
891
+ name: string;
892
+ type: "tool";
893
+ }, {
894
+ name: string;
895
+ type: "tool";
896
+ }>, z.ZodObject<{
897
+ type: z.ZodLiteral<"none">;
898
+ }, "strip", z.ZodTypeAny, {
899
+ type: "none";
900
+ }, {
901
+ type: "none";
902
+ }>]>>;
903
+ }, "strip", z.ZodTypeAny, {
904
+ model: string;
905
+ messages: {
906
+ role: string;
907
+ content: string | z.objectOutputType<{
908
+ type: z.ZodOptional<z.ZodString>;
909
+ text: z.ZodOptional<z.ZodString>;
910
+ thinking: z.ZodOptional<z.ZodString>;
911
+ signature: z.ZodOptional<z.ZodString>;
912
+ source: z.ZodOptional<z.ZodUnknown>;
913
+ id: z.ZodOptional<z.ZodString>;
914
+ name: z.ZodOptional<z.ZodString>;
915
+ input: z.ZodOptional<z.ZodUnknown>;
916
+ tool_use_id: z.ZodOptional<z.ZodString>;
917
+ content: z.ZodOptional<z.ZodUnknown>;
918
+ is_error: z.ZodOptional<z.ZodBoolean>;
919
+ data: z.ZodOptional<z.ZodUnknown>;
920
+ }, z.ZodTypeAny, "passthrough">[];
921
+ }[];
922
+ temperature?: number | undefined;
923
+ top_p?: number | undefined;
924
+ stream?: boolean | undefined;
925
+ max_tokens?: number | undefined;
926
+ tools?: (z.objectOutputType<{
927
+ name: z.ZodString;
928
+ description: z.ZodOptional<z.ZodString>;
929
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
930
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
931
+ type: z.ZodString;
932
+ name: z.ZodString;
933
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
934
+ tool_choice?: {
935
+ type: "auto";
936
+ } | {
937
+ type: "any";
938
+ } | {
939
+ name: string;
940
+ type: "tool";
941
+ } | {
942
+ type: "none";
943
+ } | undefined;
944
+ thinking?: unknown;
945
+ system?: string | z.objectOutputType<{
946
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
947
+ text: z.ZodString;
948
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
949
+ metadata?: {
950
+ user_id?: string | undefined;
951
+ } | undefined;
952
+ stop_sequences?: string[] | undefined;
953
+ top_k?: number | undefined;
954
+ thinking_config?: unknown;
955
+ }, {
956
+ model: string;
957
+ messages: {
958
+ role: string;
959
+ content: string | z.objectInputType<{
960
+ type: z.ZodOptional<z.ZodString>;
961
+ text: z.ZodOptional<z.ZodString>;
962
+ thinking: z.ZodOptional<z.ZodString>;
963
+ signature: z.ZodOptional<z.ZodString>;
964
+ source: z.ZodOptional<z.ZodUnknown>;
965
+ id: z.ZodOptional<z.ZodString>;
966
+ name: z.ZodOptional<z.ZodString>;
967
+ input: z.ZodOptional<z.ZodUnknown>;
968
+ tool_use_id: z.ZodOptional<z.ZodString>;
969
+ content: z.ZodOptional<z.ZodUnknown>;
970
+ is_error: z.ZodOptional<z.ZodBoolean>;
971
+ data: z.ZodOptional<z.ZodUnknown>;
972
+ }, z.ZodTypeAny, "passthrough">[];
973
+ }[];
974
+ temperature?: number | undefined;
975
+ top_p?: number | undefined;
976
+ stream?: boolean | undefined;
977
+ max_tokens?: number | undefined;
978
+ tools?: (z.objectInputType<{
979
+ name: z.ZodString;
980
+ description: z.ZodOptional<z.ZodString>;
981
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
982
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
983
+ type: z.ZodString;
984
+ name: z.ZodString;
985
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
986
+ tool_choice?: {
987
+ type: "auto";
988
+ } | {
989
+ type: "any";
990
+ } | {
991
+ name: string;
992
+ type: "tool";
993
+ } | {
994
+ type: "none";
995
+ } | undefined;
996
+ thinking?: unknown;
997
+ system?: string | z.objectInputType<{
998
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
999
+ text: z.ZodString;
1000
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
1001
+ metadata?: {
1002
+ user_id?: string | undefined;
1003
+ } | undefined;
1004
+ stop_sequences?: string[] | undefined;
1005
+ top_k?: number | undefined;
1006
+ thinking_config?: unknown;
1007
+ }>, z.ZodObject<{
1008
+ model: z.ZodString;
1009
+ messages: z.ZodOptional<z.ZodArray<z.ZodObject<{
1010
+ role: z.ZodString;
1011
+ content: z.ZodNullable<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
1012
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1013
+ text: z.ZodString;
1014
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1015
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1016
+ text: z.ZodString;
1017
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1018
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1019
+ text: z.ZodString;
1020
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
1021
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1022
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1023
+ url: z.ZodString;
1024
+ detail: z.ZodOptional<z.ZodString>;
1025
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1026
+ url: z.ZodString;
1027
+ detail: z.ZodOptional<z.ZodString>;
1028
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1029
+ url: z.ZodString;
1030
+ detail: z.ZodOptional<z.ZodString>;
1031
+ }, z.ZodTypeAny, "passthrough">>]>;
1032
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1033
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1034
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1035
+ url: z.ZodString;
1036
+ detail: z.ZodOptional<z.ZodString>;
1037
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1038
+ url: z.ZodString;
1039
+ detail: z.ZodOptional<z.ZodString>;
1040
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1041
+ url: z.ZodString;
1042
+ detail: z.ZodOptional<z.ZodString>;
1043
+ }, z.ZodTypeAny, "passthrough">>]>;
1044
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1045
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1046
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1047
+ url: z.ZodString;
1048
+ detail: z.ZodOptional<z.ZodString>;
1049
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1050
+ url: z.ZodString;
1051
+ detail: z.ZodOptional<z.ZodString>;
1052
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1053
+ url: z.ZodString;
1054
+ detail: z.ZodOptional<z.ZodString>;
1055
+ }, z.ZodTypeAny, "passthrough">>]>;
1056
+ }, z.ZodTypeAny, "passthrough">>]>, "many">]>>>;
1057
+ name: z.ZodOptional<z.ZodString>;
1058
+ tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
1059
+ id: z.ZodString;
1060
+ type: z.ZodDefault<z.ZodLiteral<"function">>;
1061
+ function: z.ZodObject<{
1062
+ name: z.ZodString;
1063
+ arguments: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
1064
+ }, "strip", z.ZodTypeAny, {
1065
+ name: string;
1066
+ arguments?: string | Record<string, unknown> | undefined;
1067
+ }, {
1068
+ name: string;
1069
+ arguments?: string | Record<string, unknown> | undefined;
1070
+ }>;
1071
+ }, "strip", z.ZodTypeAny, {
1072
+ function: {
1073
+ name: string;
1074
+ arguments?: string | Record<string, unknown> | undefined;
1075
+ };
1076
+ type: "function";
1077
+ id: string;
1078
+ }, {
1079
+ function: {
1080
+ name: string;
1081
+ arguments?: string | Record<string, unknown> | undefined;
1082
+ };
1083
+ id: string;
1084
+ type?: "function" | undefined;
1085
+ }>, "many">>;
1086
+ function_call: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1087
+ name: z.ZodString;
1088
+ arguments: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
1089
+ }, "strip", z.ZodTypeAny, {
1090
+ name: string;
1091
+ arguments?: string | Record<string, unknown> | undefined;
1092
+ }, {
1093
+ name: string;
1094
+ arguments?: string | Record<string, unknown> | undefined;
1095
+ }>>>;
1096
+ tool_call_id: z.ZodOptional<z.ZodString>;
1097
+ }, "strip", z.ZodTypeAny, {
1098
+ role: string;
1099
+ name?: string | undefined;
1100
+ content?: string | (z.objectOutputType<{
1101
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1102
+ text: z.ZodString;
1103
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
1104
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1105
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1106
+ url: z.ZodString;
1107
+ detail: z.ZodOptional<z.ZodString>;
1108
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1109
+ url: z.ZodString;
1110
+ detail: z.ZodOptional<z.ZodString>;
1111
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1112
+ url: z.ZodString;
1113
+ detail: z.ZodOptional<z.ZodString>;
1114
+ }, z.ZodTypeAny, "passthrough">>]>;
1115
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
1116
+ tool_calls?: {
1117
+ function: {
1118
+ name: string;
1119
+ arguments?: string | Record<string, unknown> | undefined;
1120
+ };
1121
+ type: "function";
1122
+ id: string;
1123
+ }[] | undefined;
1124
+ function_call?: {
1125
+ name: string;
1126
+ arguments?: string | Record<string, unknown> | undefined;
1127
+ } | null | undefined;
1128
+ tool_call_id?: string | undefined;
1129
+ }, {
1130
+ role: string;
1131
+ name?: string | undefined;
1132
+ content?: string | (z.objectInputType<{
1133
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1134
+ text: z.ZodString;
1135
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
1136
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1137
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1138
+ url: z.ZodString;
1139
+ detail: z.ZodOptional<z.ZodString>;
1140
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1141
+ url: z.ZodString;
1142
+ detail: z.ZodOptional<z.ZodString>;
1143
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1144
+ url: z.ZodString;
1145
+ detail: z.ZodOptional<z.ZodString>;
1146
+ }, z.ZodTypeAny, "passthrough">>]>;
1147
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
1148
+ tool_calls?: {
1149
+ function: {
1150
+ name: string;
1151
+ arguments?: string | Record<string, unknown> | undefined;
1152
+ };
1153
+ id: string;
1154
+ type?: "function" | undefined;
1155
+ }[] | undefined;
1156
+ function_call?: {
1157
+ name: string;
1158
+ arguments?: string | Record<string, unknown> | undefined;
1159
+ } | null | undefined;
1160
+ tool_call_id?: string | undefined;
1161
+ }>, "many">>;
1162
+ input: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodAny, "many">]>>;
1163
+ tools: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
1164
+ type: z.ZodDefault<z.ZodLiteral<"function">>;
1165
+ function: z.ZodObject<{
1166
+ name: z.ZodString;
1167
+ description: z.ZodOptional<z.ZodString>;
1168
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1169
+ strict: z.ZodOptional<z.ZodBoolean>;
1170
+ }, "strip", z.ZodTypeAny, {
1171
+ name: string;
1172
+ description?: string | undefined;
1173
+ parameters?: Record<string, unknown> | undefined;
1174
+ strict?: boolean | undefined;
1175
+ }, {
1176
+ name: string;
1177
+ description?: string | undefined;
1178
+ parameters?: Record<string, unknown> | undefined;
1179
+ strict?: boolean | undefined;
1180
+ }>;
1181
+ }, "strip", z.ZodTypeAny, {
1182
+ function: {
1183
+ name: string;
1184
+ description?: string | undefined;
1185
+ parameters?: Record<string, unknown> | undefined;
1186
+ strict?: boolean | undefined;
1187
+ };
1188
+ type: "function";
1189
+ }, {
1190
+ function: {
1191
+ name: string;
1192
+ description?: string | undefined;
1193
+ parameters?: Record<string, unknown> | undefined;
1194
+ strict?: boolean | undefined;
1195
+ };
1196
+ type?: "function" | undefined;
1197
+ }>, z.ZodObject<{
1198
+ name: z.ZodString;
1199
+ description: z.ZodOptional<z.ZodString>;
1200
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1201
+ strict: z.ZodOptional<z.ZodBoolean>;
1202
+ }, "strip", z.ZodTypeAny, {
1203
+ name: string;
1204
+ description?: string | undefined;
1205
+ parameters?: Record<string, unknown> | undefined;
1206
+ strict?: boolean | undefined;
1207
+ }, {
1208
+ name: string;
1209
+ description?: string | undefined;
1210
+ parameters?: Record<string, unknown> | undefined;
1211
+ strict?: boolean | undefined;
1212
+ }>]>, "many">>;
1213
+ stream: z.ZodOptional<z.ZodBoolean>;
1214
+ temperature: z.ZodOptional<z.ZodNumber>;
1215
+ top_p: z.ZodOptional<z.ZodNumber>;
1216
+ }, "strip", z.ZodTypeAny, {
1217
+ model: string;
1218
+ messages?: {
1219
+ role: string;
1220
+ name?: string | undefined;
1221
+ content?: string | (z.objectOutputType<{
1222
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1223
+ text: z.ZodString;
1224
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
1225
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1226
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1227
+ url: z.ZodString;
1228
+ detail: z.ZodOptional<z.ZodString>;
1229
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1230
+ url: z.ZodString;
1231
+ detail: z.ZodOptional<z.ZodString>;
1232
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1233
+ url: z.ZodString;
1234
+ detail: z.ZodOptional<z.ZodString>;
1235
+ }, z.ZodTypeAny, "passthrough">>]>;
1236
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
1237
+ tool_calls?: {
1238
+ function: {
1239
+ name: string;
1240
+ arguments?: string | Record<string, unknown> | undefined;
1241
+ };
1242
+ type: "function";
1243
+ id: string;
1244
+ }[] | undefined;
1245
+ function_call?: {
1246
+ name: string;
1247
+ arguments?: string | Record<string, unknown> | undefined;
1248
+ } | null | undefined;
1249
+ tool_call_id?: string | undefined;
1250
+ }[] | undefined;
1251
+ temperature?: number | undefined;
1252
+ top_p?: number | undefined;
1253
+ stream?: boolean | undefined;
1254
+ tools?: ({
1255
+ name: string;
1256
+ description?: string | undefined;
1257
+ parameters?: Record<string, unknown> | undefined;
1258
+ strict?: boolean | undefined;
1259
+ } | {
1260
+ function: {
1261
+ name: string;
1262
+ description?: string | undefined;
1263
+ parameters?: Record<string, unknown> | undefined;
1264
+ strict?: boolean | undefined;
1265
+ };
1266
+ type: "function";
1267
+ })[] | undefined;
1268
+ input?: string | any[] | undefined;
1269
+ }, {
1270
+ model: string;
1271
+ messages?: {
1272
+ role: string;
1273
+ name?: string | undefined;
1274
+ content?: string | (z.objectInputType<{
1275
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1276
+ text: z.ZodString;
1277
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
1278
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1279
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1280
+ url: z.ZodString;
1281
+ detail: z.ZodOptional<z.ZodString>;
1282
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1283
+ url: z.ZodString;
1284
+ detail: z.ZodOptional<z.ZodString>;
1285
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1286
+ url: z.ZodString;
1287
+ detail: z.ZodOptional<z.ZodString>;
1288
+ }, z.ZodTypeAny, "passthrough">>]>;
1289
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
1290
+ tool_calls?: {
1291
+ function: {
1292
+ name: string;
1293
+ arguments?: string | Record<string, unknown> | undefined;
1294
+ };
1295
+ id: string;
1296
+ type?: "function" | undefined;
1297
+ }[] | undefined;
1298
+ function_call?: {
1299
+ name: string;
1300
+ arguments?: string | Record<string, unknown> | undefined;
1301
+ } | null | undefined;
1302
+ tool_call_id?: string | undefined;
1303
+ }[] | undefined;
1304
+ temperature?: number | undefined;
1305
+ top_p?: number | undefined;
1306
+ stream?: boolean | undefined;
1307
+ tools?: ({
1308
+ name: string;
1309
+ description?: string | undefined;
1310
+ parameters?: Record<string, unknown> | undefined;
1311
+ strict?: boolean | undefined;
1312
+ } | {
1313
+ function: {
1314
+ name: string;
1315
+ description?: string | undefined;
1316
+ parameters?: Record<string, unknown> | undefined;
1317
+ strict?: boolean | undefined;
1318
+ };
1319
+ type?: "function" | undefined;
1320
+ })[] | undefined;
1321
+ input?: string | any[] | undefined;
1322
+ }>]>>;
1323
+ }, "strip", z.ZodTypeAny, {
1324
+ headers: Record<string, string>;
1325
+ clientFormat: string;
1326
+ providerFormat?: string | undefined;
1327
+ clientRequest?: {
1328
+ model: string;
1329
+ messages: {
1330
+ role: string;
1331
+ name?: string | undefined;
1332
+ content?: string | (z.objectOutputType<{
1333
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1334
+ text: z.ZodString;
1335
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
1336
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1337
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1338
+ url: z.ZodString;
1339
+ detail: z.ZodOptional<z.ZodString>;
1340
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1341
+ url: z.ZodString;
1342
+ detail: z.ZodOptional<z.ZodString>;
1343
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1344
+ url: z.ZodString;
1345
+ detail: z.ZodOptional<z.ZodString>;
1346
+ }, z.ZodTypeAny, "passthrough">>]>;
1347
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
1348
+ tool_calls?: {
1349
+ function: {
1350
+ name: string;
1351
+ arguments?: string | Record<string, unknown> | undefined;
1352
+ };
1353
+ type: "function";
1354
+ id: string;
1355
+ }[] | undefined;
1356
+ function_call?: {
1357
+ name: string;
1358
+ arguments?: string | Record<string, unknown> | undefined;
1359
+ } | null | undefined;
1360
+ tool_call_id?: string | undefined;
1361
+ }[];
1362
+ function_call?: string | {
1363
+ name: string;
1364
+ } | undefined;
1365
+ temperature?: number | undefined;
1366
+ top_p?: number | undefined;
1367
+ n?: number | undefined;
1368
+ stream?: boolean | undefined;
1369
+ stop?: string | string[] | undefined;
1370
+ max_completion_tokens?: number | undefined;
1371
+ max_tokens?: number | undefined;
1372
+ presence_penalty?: number | undefined;
1373
+ frequency_penalty?: number | undefined;
1374
+ logit_bias?: Record<string, number> | undefined;
1375
+ user?: string | undefined;
1376
+ functions?: {
1377
+ name: string;
1378
+ description?: string | undefined;
1379
+ parameters?: Record<string, unknown> | undefined;
1380
+ strict?: boolean | undefined;
1381
+ }[] | undefined;
1382
+ tools?: {
1383
+ function: {
1384
+ name: string;
1385
+ description?: string | undefined;
1386
+ parameters?: Record<string, unknown> | undefined;
1387
+ strict?: boolean | undefined;
1388
+ };
1389
+ type: "function";
1390
+ }[] | undefined;
1391
+ tool_choice?: string | {
1392
+ function: {
1393
+ name: string;
1394
+ };
1395
+ type: string;
1396
+ } | undefined;
1397
+ } | {
1398
+ model: string;
1399
+ messages: {
1400
+ role: string;
1401
+ content: string | z.objectOutputType<{
1402
+ type: z.ZodOptional<z.ZodString>;
1403
+ text: z.ZodOptional<z.ZodString>;
1404
+ thinking: z.ZodOptional<z.ZodString>;
1405
+ signature: z.ZodOptional<z.ZodString>;
1406
+ source: z.ZodOptional<z.ZodUnknown>;
1407
+ id: z.ZodOptional<z.ZodString>;
1408
+ name: z.ZodOptional<z.ZodString>;
1409
+ input: z.ZodOptional<z.ZodUnknown>;
1410
+ tool_use_id: z.ZodOptional<z.ZodString>;
1411
+ content: z.ZodOptional<z.ZodUnknown>;
1412
+ is_error: z.ZodOptional<z.ZodBoolean>;
1413
+ data: z.ZodOptional<z.ZodUnknown>;
1414
+ }, z.ZodTypeAny, "passthrough">[];
1415
+ }[];
1416
+ temperature?: number | undefined;
1417
+ top_p?: number | undefined;
1418
+ stream?: boolean | undefined;
1419
+ max_tokens?: number | undefined;
1420
+ tools?: (z.objectOutputType<{
1421
+ name: z.ZodString;
1422
+ description: z.ZodOptional<z.ZodString>;
1423
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1424
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
1425
+ type: z.ZodString;
1426
+ name: z.ZodString;
1427
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
1428
+ tool_choice?: {
1429
+ type: "auto";
1430
+ } | {
1431
+ type: "any";
1432
+ } | {
1433
+ name: string;
1434
+ type: "tool";
1435
+ } | {
1436
+ type: "none";
1437
+ } | undefined;
1438
+ thinking?: unknown;
1439
+ system?: string | z.objectOutputType<{
1440
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1441
+ text: z.ZodString;
1442
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
1443
+ metadata?: {
1444
+ user_id?: string | undefined;
1445
+ } | undefined;
1446
+ stop_sequences?: string[] | undefined;
1447
+ top_k?: number | undefined;
1448
+ thinking_config?: unknown;
1449
+ } | {
1450
+ model: string;
1451
+ messages?: {
1452
+ role: string;
1453
+ name?: string | undefined;
1454
+ content?: string | (z.objectOutputType<{
1455
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1456
+ text: z.ZodString;
1457
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
1458
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1459
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1460
+ url: z.ZodString;
1461
+ detail: z.ZodOptional<z.ZodString>;
1462
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1463
+ url: z.ZodString;
1464
+ detail: z.ZodOptional<z.ZodString>;
1465
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1466
+ url: z.ZodString;
1467
+ detail: z.ZodOptional<z.ZodString>;
1468
+ }, z.ZodTypeAny, "passthrough">>]>;
1469
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
1470
+ tool_calls?: {
1471
+ function: {
1472
+ name: string;
1473
+ arguments?: string | Record<string, unknown> | undefined;
1474
+ };
1475
+ type: "function";
1476
+ id: string;
1477
+ }[] | undefined;
1478
+ function_call?: {
1479
+ name: string;
1480
+ arguments?: string | Record<string, unknown> | undefined;
1481
+ } | null | undefined;
1482
+ tool_call_id?: string | undefined;
1483
+ }[] | undefined;
1484
+ temperature?: number | undefined;
1485
+ top_p?: number | undefined;
1486
+ stream?: boolean | undefined;
1487
+ tools?: ({
1488
+ name: string;
1489
+ description?: string | undefined;
1490
+ parameters?: Record<string, unknown> | undefined;
1491
+ strict?: boolean | undefined;
1492
+ } | {
1493
+ function: {
1494
+ name: string;
1495
+ description?: string | undefined;
1496
+ parameters?: Record<string, unknown> | undefined;
1497
+ strict?: boolean | undefined;
1498
+ };
1499
+ type: "function";
1500
+ })[] | undefined;
1501
+ input?: string | any[] | undefined;
1502
+ } | undefined;
1503
+ }, {
1504
+ clientFormat: string;
1505
+ headers?: Record<string, string> | undefined;
1506
+ providerFormat?: string | undefined;
1507
+ clientRequest?: {
1508
+ model: string;
1509
+ messages: {
1510
+ role: string;
1511
+ name?: string | undefined;
1512
+ content?: string | (z.objectInputType<{
1513
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1514
+ text: z.ZodString;
1515
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
1516
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1517
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1518
+ url: z.ZodString;
1519
+ detail: z.ZodOptional<z.ZodString>;
1520
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1521
+ url: z.ZodString;
1522
+ detail: z.ZodOptional<z.ZodString>;
1523
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1524
+ url: z.ZodString;
1525
+ detail: z.ZodOptional<z.ZodString>;
1526
+ }, z.ZodTypeAny, "passthrough">>]>;
1527
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
1528
+ tool_calls?: {
1529
+ function: {
1530
+ name: string;
1531
+ arguments?: string | Record<string, unknown> | undefined;
1532
+ };
1533
+ id: string;
1534
+ type?: "function" | undefined;
1535
+ }[] | undefined;
1536
+ function_call?: {
1537
+ name: string;
1538
+ arguments?: string | Record<string, unknown> | undefined;
1539
+ } | null | undefined;
1540
+ tool_call_id?: string | undefined;
1541
+ }[];
1542
+ function_call?: string | {
1543
+ name: string;
1544
+ } | undefined;
1545
+ temperature?: number | undefined;
1546
+ top_p?: number | undefined;
1547
+ n?: number | undefined;
1548
+ stream?: boolean | undefined;
1549
+ stop?: string | string[] | undefined;
1550
+ max_completion_tokens?: number | undefined;
1551
+ max_tokens?: number | undefined;
1552
+ presence_penalty?: number | undefined;
1553
+ frequency_penalty?: number | undefined;
1554
+ logit_bias?: Record<string, number> | undefined;
1555
+ user?: string | undefined;
1556
+ functions?: {
1557
+ name: string;
1558
+ description?: string | undefined;
1559
+ parameters?: Record<string, unknown> | undefined;
1560
+ strict?: boolean | undefined;
1561
+ }[] | undefined;
1562
+ tools?: {
1563
+ function: {
1564
+ name: string;
1565
+ description?: string | undefined;
1566
+ parameters?: Record<string, unknown> | undefined;
1567
+ strict?: boolean | undefined;
1568
+ };
1569
+ type?: "function" | undefined;
1570
+ }[] | undefined;
1571
+ tool_choice?: string | {
1572
+ function: {
1573
+ name: string;
1574
+ };
1575
+ type: string;
1576
+ } | undefined;
1577
+ } | {
1578
+ model: string;
1579
+ messages: {
1580
+ role: string;
1581
+ content: string | z.objectInputType<{
1582
+ type: z.ZodOptional<z.ZodString>;
1583
+ text: z.ZodOptional<z.ZodString>;
1584
+ thinking: z.ZodOptional<z.ZodString>;
1585
+ signature: z.ZodOptional<z.ZodString>;
1586
+ source: z.ZodOptional<z.ZodUnknown>;
1587
+ id: z.ZodOptional<z.ZodString>;
1588
+ name: z.ZodOptional<z.ZodString>;
1589
+ input: z.ZodOptional<z.ZodUnknown>;
1590
+ tool_use_id: z.ZodOptional<z.ZodString>;
1591
+ content: z.ZodOptional<z.ZodUnknown>;
1592
+ is_error: z.ZodOptional<z.ZodBoolean>;
1593
+ data: z.ZodOptional<z.ZodUnknown>;
1594
+ }, z.ZodTypeAny, "passthrough">[];
1595
+ }[];
1596
+ temperature?: number | undefined;
1597
+ top_p?: number | undefined;
1598
+ stream?: boolean | undefined;
1599
+ max_tokens?: number | undefined;
1600
+ tools?: (z.objectInputType<{
1601
+ name: z.ZodString;
1602
+ description: z.ZodOptional<z.ZodString>;
1603
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1604
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
1605
+ type: z.ZodString;
1606
+ name: z.ZodString;
1607
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
1608
+ tool_choice?: {
1609
+ type: "auto";
1610
+ } | {
1611
+ type: "any";
1612
+ } | {
1613
+ name: string;
1614
+ type: "tool";
1615
+ } | {
1616
+ type: "none";
1617
+ } | undefined;
1618
+ thinking?: unknown;
1619
+ system?: string | z.objectInputType<{
1620
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1621
+ text: z.ZodString;
1622
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
1623
+ metadata?: {
1624
+ user_id?: string | undefined;
1625
+ } | undefined;
1626
+ stop_sequences?: string[] | undefined;
1627
+ top_k?: number | undefined;
1628
+ thinking_config?: unknown;
1629
+ } | {
1630
+ model: string;
1631
+ messages?: {
1632
+ role: string;
1633
+ name?: string | undefined;
1634
+ content?: string | (z.objectInputType<{
1635
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1636
+ text: z.ZodString;
1637
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
1638
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1639
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1640
+ url: z.ZodString;
1641
+ detail: z.ZodOptional<z.ZodString>;
1642
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1643
+ url: z.ZodString;
1644
+ detail: z.ZodOptional<z.ZodString>;
1645
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1646
+ url: z.ZodString;
1647
+ detail: z.ZodOptional<z.ZodString>;
1648
+ }, z.ZodTypeAny, "passthrough">>]>;
1649
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
1650
+ tool_calls?: {
1651
+ function: {
1652
+ name: string;
1653
+ arguments?: string | Record<string, unknown> | undefined;
1654
+ };
1655
+ id: string;
1656
+ type?: "function" | undefined;
1657
+ }[] | undefined;
1658
+ function_call?: {
1659
+ name: string;
1660
+ arguments?: string | Record<string, unknown> | undefined;
1661
+ } | null | undefined;
1662
+ tool_call_id?: string | undefined;
1663
+ }[] | undefined;
1664
+ temperature?: number | undefined;
1665
+ top_p?: number | undefined;
1666
+ stream?: boolean | undefined;
1667
+ tools?: ({
1668
+ name: string;
1669
+ description?: string | undefined;
1670
+ parameters?: Record<string, unknown> | undefined;
1671
+ strict?: boolean | undefined;
1672
+ } | {
1673
+ function: {
1674
+ name: string;
1675
+ description?: string | undefined;
1676
+ parameters?: Record<string, unknown> | undefined;
1677
+ strict?: boolean | undefined;
1678
+ };
1679
+ type?: "function" | undefined;
1680
+ })[] | undefined;
1681
+ input?: string | any[] | undefined;
1682
+ } | undefined;
1683
+ }>>;
1684
+ }, "strip", z.ZodTypeAny, {
1685
+ parameters: {
1686
+ temperature?: number | undefined;
1687
+ top_p?: number | undefined;
1688
+ max_tokens?: number | undefined;
1689
+ thinking?: unknown;
1690
+ top_k?: number | undefined;
1691
+ thinking_config?: unknown;
1692
+ };
22
1693
  id: string;
23
- operation: ProxyOperation;
24
- clientFormat: ClientFormat;
25
1694
  model: string;
26
- body: TBody;
27
- headers: Record<string, string>;
1695
+ messages: {
1696
+ role: string;
1697
+ content: {
1698
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
1699
+ text?: string | undefined;
1700
+ url?: string | undefined;
1701
+ data?: JsonValue | undefined;
1702
+ mime?: string | undefined;
1703
+ }[];
1704
+ tool_calls?: {
1705
+ name: string;
1706
+ type: "function";
1707
+ id: string;
1708
+ arguments: string;
1709
+ }[] | undefined;
1710
+ tool_call_id?: string | undefined;
1711
+ thinking?: string | {
1712
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
1713
+ text?: string | undefined;
1714
+ url?: string | undefined;
1715
+ data?: JsonValue | undefined;
1716
+ mime?: string | undefined;
1717
+ }[] | undefined;
1718
+ annotations?: Record<string, unknown> | undefined;
1719
+ }[];
28
1720
  stream: boolean;
1721
+ metadata: {
1722
+ headers: Record<string, string>;
1723
+ clientFormat: string;
1724
+ providerFormat?: string | undefined;
1725
+ clientRequest?: {
1726
+ model: string;
1727
+ messages: {
1728
+ role: string;
1729
+ name?: string | undefined;
1730
+ content?: string | (z.objectOutputType<{
1731
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1732
+ text: z.ZodString;
1733
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
1734
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1735
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1736
+ url: z.ZodString;
1737
+ detail: z.ZodOptional<z.ZodString>;
1738
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1739
+ url: z.ZodString;
1740
+ detail: z.ZodOptional<z.ZodString>;
1741
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1742
+ url: z.ZodString;
1743
+ detail: z.ZodOptional<z.ZodString>;
1744
+ }, z.ZodTypeAny, "passthrough">>]>;
1745
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
1746
+ tool_calls?: {
1747
+ function: {
1748
+ name: string;
1749
+ arguments?: string | Record<string, unknown> | undefined;
1750
+ };
1751
+ type: "function";
1752
+ id: string;
1753
+ }[] | undefined;
1754
+ function_call?: {
1755
+ name: string;
1756
+ arguments?: string | Record<string, unknown> | undefined;
1757
+ } | null | undefined;
1758
+ tool_call_id?: string | undefined;
1759
+ }[];
1760
+ function_call?: string | {
1761
+ name: string;
1762
+ } | undefined;
1763
+ temperature?: number | undefined;
1764
+ top_p?: number | undefined;
1765
+ n?: number | undefined;
1766
+ stream?: boolean | undefined;
1767
+ stop?: string | string[] | undefined;
1768
+ max_completion_tokens?: number | undefined;
1769
+ max_tokens?: number | undefined;
1770
+ presence_penalty?: number | undefined;
1771
+ frequency_penalty?: number | undefined;
1772
+ logit_bias?: Record<string, number> | undefined;
1773
+ user?: string | undefined;
1774
+ functions?: {
1775
+ name: string;
1776
+ description?: string | undefined;
1777
+ parameters?: Record<string, unknown> | undefined;
1778
+ strict?: boolean | undefined;
1779
+ }[] | undefined;
1780
+ tools?: {
1781
+ function: {
1782
+ name: string;
1783
+ description?: string | undefined;
1784
+ parameters?: Record<string, unknown> | undefined;
1785
+ strict?: boolean | undefined;
1786
+ };
1787
+ type: "function";
1788
+ }[] | undefined;
1789
+ tool_choice?: string | {
1790
+ function: {
1791
+ name: string;
1792
+ };
1793
+ type: string;
1794
+ } | undefined;
1795
+ } | {
1796
+ model: string;
1797
+ messages: {
1798
+ role: string;
1799
+ content: string | z.objectOutputType<{
1800
+ type: z.ZodOptional<z.ZodString>;
1801
+ text: z.ZodOptional<z.ZodString>;
1802
+ thinking: z.ZodOptional<z.ZodString>;
1803
+ signature: z.ZodOptional<z.ZodString>;
1804
+ source: z.ZodOptional<z.ZodUnknown>;
1805
+ id: z.ZodOptional<z.ZodString>;
1806
+ name: z.ZodOptional<z.ZodString>;
1807
+ input: z.ZodOptional<z.ZodUnknown>;
1808
+ tool_use_id: z.ZodOptional<z.ZodString>;
1809
+ content: z.ZodOptional<z.ZodUnknown>;
1810
+ is_error: z.ZodOptional<z.ZodBoolean>;
1811
+ data: z.ZodOptional<z.ZodUnknown>;
1812
+ }, z.ZodTypeAny, "passthrough">[];
1813
+ }[];
1814
+ temperature?: number | undefined;
1815
+ top_p?: number | undefined;
1816
+ stream?: boolean | undefined;
1817
+ max_tokens?: number | undefined;
1818
+ tools?: (z.objectOutputType<{
1819
+ name: z.ZodString;
1820
+ description: z.ZodOptional<z.ZodString>;
1821
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1822
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
1823
+ type: z.ZodString;
1824
+ name: z.ZodString;
1825
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
1826
+ tool_choice?: {
1827
+ type: "auto";
1828
+ } | {
1829
+ type: "any";
1830
+ } | {
1831
+ name: string;
1832
+ type: "tool";
1833
+ } | {
1834
+ type: "none";
1835
+ } | undefined;
1836
+ thinking?: unknown;
1837
+ system?: string | z.objectOutputType<{
1838
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1839
+ text: z.ZodString;
1840
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
1841
+ metadata?: {
1842
+ user_id?: string | undefined;
1843
+ } | undefined;
1844
+ stop_sequences?: string[] | undefined;
1845
+ top_k?: number | undefined;
1846
+ thinking_config?: unknown;
1847
+ } | {
1848
+ model: string;
1849
+ messages?: {
1850
+ role: string;
1851
+ name?: string | undefined;
1852
+ content?: string | (z.objectOutputType<{
1853
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1854
+ text: z.ZodString;
1855
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
1856
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1857
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1858
+ url: z.ZodString;
1859
+ detail: z.ZodOptional<z.ZodString>;
1860
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1861
+ url: z.ZodString;
1862
+ detail: z.ZodOptional<z.ZodString>;
1863
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1864
+ url: z.ZodString;
1865
+ detail: z.ZodOptional<z.ZodString>;
1866
+ }, z.ZodTypeAny, "passthrough">>]>;
1867
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
1868
+ tool_calls?: {
1869
+ function: {
1870
+ name: string;
1871
+ arguments?: string | Record<string, unknown> | undefined;
1872
+ };
1873
+ type: "function";
1874
+ id: string;
1875
+ }[] | undefined;
1876
+ function_call?: {
1877
+ name: string;
1878
+ arguments?: string | Record<string, unknown> | undefined;
1879
+ } | null | undefined;
1880
+ tool_call_id?: string | undefined;
1881
+ }[] | undefined;
1882
+ temperature?: number | undefined;
1883
+ top_p?: number | undefined;
1884
+ stream?: boolean | undefined;
1885
+ tools?: ({
1886
+ name: string;
1887
+ description?: string | undefined;
1888
+ parameters?: Record<string, unknown> | undefined;
1889
+ strict?: boolean | undefined;
1890
+ } | {
1891
+ function: {
1892
+ name: string;
1893
+ description?: string | undefined;
1894
+ parameters?: Record<string, unknown> | undefined;
1895
+ strict?: boolean | undefined;
1896
+ };
1897
+ type: "function";
1898
+ })[] | undefined;
1899
+ input?: string | any[] | undefined;
1900
+ } | undefined;
1901
+ };
1902
+ operation: Operation;
29
1903
  state: Record<string, JsonValue>;
1904
+ tools?: {
1905
+ name: string;
1906
+ type: "function";
1907
+ description?: string | undefined;
1908
+ parameters?: Record<string, JsonValue> | undefined;
1909
+ strict?: boolean | undefined;
1910
+ }[] | undefined;
1911
+ system?: string[] | undefined;
1912
+ profile?: string | undefined;
1913
+ }, {
1914
+ id: string;
1915
+ model: string;
1916
+ messages: {
1917
+ role: string;
1918
+ content?: {
1919
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
1920
+ text?: string | undefined;
1921
+ url?: string | undefined;
1922
+ data?: JsonValue | undefined;
1923
+ mime?: string | undefined;
1924
+ }[] | undefined;
1925
+ tool_calls?: {
1926
+ name: string;
1927
+ type: "function";
1928
+ id: string;
1929
+ arguments?: string | undefined;
1930
+ }[] | undefined;
1931
+ tool_call_id?: string | undefined;
1932
+ thinking?: string | {
1933
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
1934
+ text?: string | undefined;
1935
+ url?: string | undefined;
1936
+ data?: JsonValue | undefined;
1937
+ mime?: string | undefined;
1938
+ }[] | undefined;
1939
+ annotations?: Record<string, unknown> | undefined;
1940
+ }[];
1941
+ operation: Operation;
1942
+ parameters?: {
1943
+ temperature?: number | undefined;
1944
+ top_p?: number | undefined;
1945
+ max_tokens?: number | undefined;
1946
+ thinking?: unknown;
1947
+ top_k?: number | undefined;
1948
+ thinking_config?: unknown;
1949
+ } | undefined;
1950
+ stream?: boolean | undefined;
1951
+ tools?: {
1952
+ name: string;
1953
+ type: "function";
1954
+ description?: string | undefined;
1955
+ parameters?: Record<string, JsonValue> | undefined;
1956
+ strict?: boolean | undefined;
1957
+ }[] | undefined;
1958
+ system?: string[] | undefined;
1959
+ metadata?: {
1960
+ clientFormat: string;
1961
+ headers?: Record<string, string> | undefined;
1962
+ providerFormat?: string | undefined;
1963
+ clientRequest?: {
1964
+ model: string;
1965
+ messages: {
1966
+ role: string;
1967
+ name?: string | undefined;
1968
+ content?: string | (z.objectInputType<{
1969
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
1970
+ text: z.ZodString;
1971
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
1972
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
1973
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
1974
+ url: z.ZodString;
1975
+ detail: z.ZodOptional<z.ZodString>;
1976
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1977
+ url: z.ZodString;
1978
+ detail: z.ZodOptional<z.ZodString>;
1979
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1980
+ url: z.ZodString;
1981
+ detail: z.ZodOptional<z.ZodString>;
1982
+ }, z.ZodTypeAny, "passthrough">>]>;
1983
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
1984
+ tool_calls?: {
1985
+ function: {
1986
+ name: string;
1987
+ arguments?: string | Record<string, unknown> | undefined;
1988
+ };
1989
+ id: string;
1990
+ type?: "function" | undefined;
1991
+ }[] | undefined;
1992
+ function_call?: {
1993
+ name: string;
1994
+ arguments?: string | Record<string, unknown> | undefined;
1995
+ } | null | undefined;
1996
+ tool_call_id?: string | undefined;
1997
+ }[];
1998
+ function_call?: string | {
1999
+ name: string;
2000
+ } | undefined;
2001
+ temperature?: number | undefined;
2002
+ top_p?: number | undefined;
2003
+ n?: number | undefined;
2004
+ stream?: boolean | undefined;
2005
+ stop?: string | string[] | undefined;
2006
+ max_completion_tokens?: number | undefined;
2007
+ max_tokens?: number | undefined;
2008
+ presence_penalty?: number | undefined;
2009
+ frequency_penalty?: number | undefined;
2010
+ logit_bias?: Record<string, number> | undefined;
2011
+ user?: string | undefined;
2012
+ functions?: {
2013
+ name: string;
2014
+ description?: string | undefined;
2015
+ parameters?: Record<string, unknown> | undefined;
2016
+ strict?: boolean | undefined;
2017
+ }[] | undefined;
2018
+ tools?: {
2019
+ function: {
2020
+ name: string;
2021
+ description?: string | undefined;
2022
+ parameters?: Record<string, unknown> | undefined;
2023
+ strict?: boolean | undefined;
2024
+ };
2025
+ type?: "function" | undefined;
2026
+ }[] | undefined;
2027
+ tool_choice?: string | {
2028
+ function: {
2029
+ name: string;
2030
+ };
2031
+ type: string;
2032
+ } | undefined;
2033
+ } | {
2034
+ model: string;
2035
+ messages: {
2036
+ role: string;
2037
+ content: string | z.objectInputType<{
2038
+ type: z.ZodOptional<z.ZodString>;
2039
+ text: z.ZodOptional<z.ZodString>;
2040
+ thinking: z.ZodOptional<z.ZodString>;
2041
+ signature: z.ZodOptional<z.ZodString>;
2042
+ source: z.ZodOptional<z.ZodUnknown>;
2043
+ id: z.ZodOptional<z.ZodString>;
2044
+ name: z.ZodOptional<z.ZodString>;
2045
+ input: z.ZodOptional<z.ZodUnknown>;
2046
+ tool_use_id: z.ZodOptional<z.ZodString>;
2047
+ content: z.ZodOptional<z.ZodUnknown>;
2048
+ is_error: z.ZodOptional<z.ZodBoolean>;
2049
+ data: z.ZodOptional<z.ZodUnknown>;
2050
+ }, z.ZodTypeAny, "passthrough">[];
2051
+ }[];
2052
+ temperature?: number | undefined;
2053
+ top_p?: number | undefined;
2054
+ stream?: boolean | undefined;
2055
+ max_tokens?: number | undefined;
2056
+ tools?: (z.objectInputType<{
2057
+ name: z.ZodString;
2058
+ description: z.ZodOptional<z.ZodString>;
2059
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2060
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
2061
+ type: z.ZodString;
2062
+ name: z.ZodString;
2063
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
2064
+ tool_choice?: {
2065
+ type: "auto";
2066
+ } | {
2067
+ type: "any";
2068
+ } | {
2069
+ name: string;
2070
+ type: "tool";
2071
+ } | {
2072
+ type: "none";
2073
+ } | undefined;
2074
+ thinking?: unknown;
2075
+ system?: string | z.objectInputType<{
2076
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
2077
+ text: z.ZodString;
2078
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
2079
+ metadata?: {
2080
+ user_id?: string | undefined;
2081
+ } | undefined;
2082
+ stop_sequences?: string[] | undefined;
2083
+ top_k?: number | undefined;
2084
+ thinking_config?: unknown;
2085
+ } | {
2086
+ model: string;
2087
+ messages?: {
2088
+ role: string;
2089
+ name?: string | undefined;
2090
+ content?: string | (z.objectInputType<{
2091
+ type: z.ZodOptional<z.ZodLiteral<"text">>;
2092
+ text: z.ZodString;
2093
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
2094
+ type: z.ZodOptional<z.ZodLiteral<"image_url">>;
2095
+ image_url: z.ZodUnion<[z.ZodString, z.ZodObject<{
2096
+ url: z.ZodString;
2097
+ detail: z.ZodOptional<z.ZodString>;
2098
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2099
+ url: z.ZodString;
2100
+ detail: z.ZodOptional<z.ZodString>;
2101
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2102
+ url: z.ZodString;
2103
+ detail: z.ZodOptional<z.ZodString>;
2104
+ }, z.ZodTypeAny, "passthrough">>]>;
2105
+ }, z.ZodTypeAny, "passthrough">)[] | null | undefined;
2106
+ tool_calls?: {
2107
+ function: {
2108
+ name: string;
2109
+ arguments?: string | Record<string, unknown> | undefined;
2110
+ };
2111
+ id: string;
2112
+ type?: "function" | undefined;
2113
+ }[] | undefined;
2114
+ function_call?: {
2115
+ name: string;
2116
+ arguments?: string | Record<string, unknown> | undefined;
2117
+ } | null | undefined;
2118
+ tool_call_id?: string | undefined;
2119
+ }[] | undefined;
2120
+ temperature?: number | undefined;
2121
+ top_p?: number | undefined;
2122
+ stream?: boolean | undefined;
2123
+ tools?: ({
2124
+ name: string;
2125
+ description?: string | undefined;
2126
+ parameters?: Record<string, unknown> | undefined;
2127
+ strict?: boolean | undefined;
2128
+ } | {
2129
+ function: {
2130
+ name: string;
2131
+ description?: string | undefined;
2132
+ parameters?: Record<string, unknown> | undefined;
2133
+ strict?: boolean | undefined;
2134
+ };
2135
+ type?: "function" | undefined;
2136
+ })[] | undefined;
2137
+ input?: string | any[] | undefined;
2138
+ } | undefined;
2139
+ } | undefined;
2140
+ profile?: string | undefined;
2141
+ state?: Record<string, JsonValue> | undefined;
2142
+ }>;
2143
+ export type Request = z.infer<typeof RequestSchema>;
2144
+ export declare const OutputSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2145
+ type: z.ZodLiteral<"message">;
2146
+ role: z.ZodString;
2147
+ content: z.ZodDefault<z.ZodArray<z.ZodObject<{
2148
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
2149
+ text: z.ZodOptional<z.ZodString>;
2150
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
2151
+ url: z.ZodOptional<z.ZodString>;
2152
+ mime: z.ZodOptional<z.ZodString>;
2153
+ }, "strip", z.ZodTypeAny, {
2154
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2155
+ text?: string | undefined;
2156
+ url?: string | undefined;
2157
+ data?: JsonValue | undefined;
2158
+ mime?: string | undefined;
2159
+ }, {
2160
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2161
+ text?: string | undefined;
2162
+ url?: string | undefined;
2163
+ data?: JsonValue | undefined;
2164
+ mime?: string | undefined;
2165
+ }>, "many">>;
2166
+ tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
2167
+ id: z.ZodString;
2168
+ type: z.ZodLiteral<"function">;
2169
+ name: z.ZodString;
2170
+ arguments: z.ZodDefault<z.ZodString>;
2171
+ }, "strip", z.ZodTypeAny, {
2172
+ name: string;
2173
+ type: "function";
2174
+ id: string;
2175
+ arguments: string;
2176
+ }, {
2177
+ name: string;
2178
+ type: "function";
2179
+ id: string;
2180
+ arguments?: string | undefined;
2181
+ }>, "many">>;
2182
+ status: z.ZodOptional<z.ZodString>;
2183
+ }, "strip", z.ZodTypeAny, {
2184
+ type: "message";
2185
+ role: string;
2186
+ content: {
2187
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2188
+ text?: string | undefined;
2189
+ url?: string | undefined;
2190
+ data?: JsonValue | undefined;
2191
+ mime?: string | undefined;
2192
+ }[];
2193
+ status?: string | undefined;
2194
+ tool_calls?: {
2195
+ name: string;
2196
+ type: "function";
2197
+ id: string;
2198
+ arguments: string;
2199
+ }[] | undefined;
2200
+ }, {
2201
+ type: "message";
2202
+ role: string;
2203
+ status?: string | undefined;
2204
+ content?: {
2205
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2206
+ text?: string | undefined;
2207
+ url?: string | undefined;
2208
+ data?: JsonValue | undefined;
2209
+ mime?: string | undefined;
2210
+ }[] | undefined;
2211
+ tool_calls?: {
2212
+ name: string;
2213
+ type: "function";
2214
+ id: string;
2215
+ arguments?: string | undefined;
2216
+ }[] | undefined;
2217
+ }>, z.ZodObject<{
2218
+ type: z.ZodLiteral<"tool_call">;
2219
+ call_id: z.ZodString;
2220
+ name: z.ZodString;
2221
+ arguments: z.ZodString;
2222
+ status: z.ZodOptional<z.ZodString>;
2223
+ }, "strip", z.ZodTypeAny, {
2224
+ name: string;
2225
+ type: "tool_call";
2226
+ arguments: string;
2227
+ call_id: string;
2228
+ status?: string | undefined;
2229
+ }, {
2230
+ name: string;
2231
+ type: "tool_call";
2232
+ arguments: string;
2233
+ call_id: string;
2234
+ status?: string | undefined;
2235
+ }>, z.ZodObject<{
2236
+ type: z.ZodLiteral<"reasoning">;
2237
+ content: z.ZodDefault<z.ZodArray<z.ZodObject<{
2238
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
2239
+ text: z.ZodOptional<z.ZodString>;
2240
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
2241
+ url: z.ZodOptional<z.ZodString>;
2242
+ mime: z.ZodOptional<z.ZodString>;
2243
+ }, "strip", z.ZodTypeAny, {
2244
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2245
+ text?: string | undefined;
2246
+ url?: string | undefined;
2247
+ data?: JsonValue | undefined;
2248
+ mime?: string | undefined;
2249
+ }, {
2250
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2251
+ text?: string | undefined;
2252
+ url?: string | undefined;
2253
+ data?: JsonValue | undefined;
2254
+ mime?: string | undefined;
2255
+ }>, "many">>;
2256
+ summary: z.ZodDefault<z.ZodArray<z.ZodObject<{
2257
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
2258
+ text: z.ZodOptional<z.ZodString>;
2259
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
2260
+ url: z.ZodOptional<z.ZodString>;
2261
+ mime: z.ZodOptional<z.ZodString>;
2262
+ }, "strip", z.ZodTypeAny, {
2263
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2264
+ text?: string | undefined;
2265
+ url?: string | undefined;
2266
+ data?: JsonValue | undefined;
2267
+ mime?: string | undefined;
2268
+ }, {
2269
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2270
+ text?: string | undefined;
2271
+ url?: string | undefined;
2272
+ data?: JsonValue | undefined;
2273
+ mime?: string | undefined;
2274
+ }>, "many">>;
2275
+ }, "strip", z.ZodTypeAny, {
2276
+ type: "reasoning";
2277
+ content: {
2278
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2279
+ text?: string | undefined;
2280
+ url?: string | undefined;
2281
+ data?: JsonValue | undefined;
2282
+ mime?: string | undefined;
2283
+ }[];
2284
+ summary: {
2285
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2286
+ text?: string | undefined;
2287
+ url?: string | undefined;
2288
+ data?: JsonValue | undefined;
2289
+ mime?: string | undefined;
2290
+ }[];
2291
+ }, {
2292
+ type: "reasoning";
2293
+ content?: {
2294
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2295
+ text?: string | undefined;
2296
+ url?: string | undefined;
2297
+ data?: JsonValue | undefined;
2298
+ mime?: string | undefined;
2299
+ }[] | undefined;
2300
+ summary?: {
2301
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2302
+ text?: string | undefined;
2303
+ url?: string | undefined;
2304
+ data?: JsonValue | undefined;
2305
+ mime?: string | undefined;
2306
+ }[] | undefined;
2307
+ }>, z.ZodObject<{
2308
+ type: z.ZodLiteral<"delta">;
2309
+ content: z.ZodDefault<z.ZodArray<z.ZodObject<{
2310
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
2311
+ text: z.ZodOptional<z.ZodString>;
2312
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
2313
+ url: z.ZodOptional<z.ZodString>;
2314
+ mime: z.ZodOptional<z.ZodString>;
2315
+ }, "strip", z.ZodTypeAny, {
2316
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2317
+ text?: string | undefined;
2318
+ url?: string | undefined;
2319
+ data?: JsonValue | undefined;
2320
+ mime?: string | undefined;
2321
+ }, {
2322
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2323
+ text?: string | undefined;
2324
+ url?: string | undefined;
2325
+ data?: JsonValue | undefined;
2326
+ mime?: string | undefined;
2327
+ }>, "many">>;
2328
+ }, "strip", z.ZodTypeAny, {
2329
+ type: "delta";
2330
+ content: {
2331
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2332
+ text?: string | undefined;
2333
+ url?: string | undefined;
2334
+ data?: JsonValue | undefined;
2335
+ mime?: string | undefined;
2336
+ }[];
2337
+ }, {
2338
+ type: "delta";
2339
+ content?: {
2340
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2341
+ text?: string | undefined;
2342
+ url?: string | undefined;
2343
+ data?: JsonValue | undefined;
2344
+ mime?: string | undefined;
2345
+ }[] | undefined;
2346
+ }>]>;
2347
+ export type OutputBlock = z.infer<typeof OutputSchema>;
2348
+ export declare const ResponseSchema: z.ZodObject<{
2349
+ id: z.ZodString;
2350
+ model: z.ZodString;
2351
+ operation: z.ZodNativeEnum<typeof Operation>;
2352
+ output: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2353
+ type: z.ZodLiteral<"message">;
2354
+ role: z.ZodString;
2355
+ content: z.ZodDefault<z.ZodArray<z.ZodObject<{
2356
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
2357
+ text: z.ZodOptional<z.ZodString>;
2358
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
2359
+ url: z.ZodOptional<z.ZodString>;
2360
+ mime: z.ZodOptional<z.ZodString>;
2361
+ }, "strip", z.ZodTypeAny, {
2362
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2363
+ text?: string | undefined;
2364
+ url?: string | undefined;
2365
+ data?: JsonValue | undefined;
2366
+ mime?: string | undefined;
2367
+ }, {
2368
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2369
+ text?: string | undefined;
2370
+ url?: string | undefined;
2371
+ data?: JsonValue | undefined;
2372
+ mime?: string | undefined;
2373
+ }>, "many">>;
2374
+ tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
2375
+ id: z.ZodString;
2376
+ type: z.ZodLiteral<"function">;
2377
+ name: z.ZodString;
2378
+ arguments: z.ZodDefault<z.ZodString>;
2379
+ }, "strip", z.ZodTypeAny, {
2380
+ name: string;
2381
+ type: "function";
2382
+ id: string;
2383
+ arguments: string;
2384
+ }, {
2385
+ name: string;
2386
+ type: "function";
2387
+ id: string;
2388
+ arguments?: string | undefined;
2389
+ }>, "many">>;
2390
+ status: z.ZodOptional<z.ZodString>;
2391
+ }, "strip", z.ZodTypeAny, {
2392
+ type: "message";
2393
+ role: string;
2394
+ content: {
2395
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2396
+ text?: string | undefined;
2397
+ url?: string | undefined;
2398
+ data?: JsonValue | undefined;
2399
+ mime?: string | undefined;
2400
+ }[];
2401
+ status?: string | undefined;
2402
+ tool_calls?: {
2403
+ name: string;
2404
+ type: "function";
2405
+ id: string;
2406
+ arguments: string;
2407
+ }[] | undefined;
2408
+ }, {
2409
+ type: "message";
2410
+ role: string;
2411
+ status?: string | undefined;
2412
+ content?: {
2413
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2414
+ text?: string | undefined;
2415
+ url?: string | undefined;
2416
+ data?: JsonValue | undefined;
2417
+ mime?: string | undefined;
2418
+ }[] | undefined;
2419
+ tool_calls?: {
2420
+ name: string;
2421
+ type: "function";
2422
+ id: string;
2423
+ arguments?: string | undefined;
2424
+ }[] | undefined;
2425
+ }>, z.ZodObject<{
2426
+ type: z.ZodLiteral<"tool_call">;
2427
+ call_id: z.ZodString;
2428
+ name: z.ZodString;
2429
+ arguments: z.ZodString;
2430
+ status: z.ZodOptional<z.ZodString>;
2431
+ }, "strip", z.ZodTypeAny, {
2432
+ name: string;
2433
+ type: "tool_call";
2434
+ arguments: string;
2435
+ call_id: string;
2436
+ status?: string | undefined;
2437
+ }, {
2438
+ name: string;
2439
+ type: "tool_call";
2440
+ arguments: string;
2441
+ call_id: string;
2442
+ status?: string | undefined;
2443
+ }>, z.ZodObject<{
2444
+ type: z.ZodLiteral<"reasoning">;
2445
+ content: z.ZodDefault<z.ZodArray<z.ZodObject<{
2446
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
2447
+ text: z.ZodOptional<z.ZodString>;
2448
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
2449
+ url: z.ZodOptional<z.ZodString>;
2450
+ mime: z.ZodOptional<z.ZodString>;
2451
+ }, "strip", z.ZodTypeAny, {
2452
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2453
+ text?: string | undefined;
2454
+ url?: string | undefined;
2455
+ data?: JsonValue | undefined;
2456
+ mime?: string | undefined;
2457
+ }, {
2458
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2459
+ text?: string | undefined;
2460
+ url?: string | undefined;
2461
+ data?: JsonValue | undefined;
2462
+ mime?: string | undefined;
2463
+ }>, "many">>;
2464
+ summary: z.ZodDefault<z.ZodArray<z.ZodObject<{
2465
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
2466
+ text: z.ZodOptional<z.ZodString>;
2467
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
2468
+ url: z.ZodOptional<z.ZodString>;
2469
+ mime: z.ZodOptional<z.ZodString>;
2470
+ }, "strip", z.ZodTypeAny, {
2471
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2472
+ text?: string | undefined;
2473
+ url?: string | undefined;
2474
+ data?: JsonValue | undefined;
2475
+ mime?: string | undefined;
2476
+ }, {
2477
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2478
+ text?: string | undefined;
2479
+ url?: string | undefined;
2480
+ data?: JsonValue | undefined;
2481
+ mime?: string | undefined;
2482
+ }>, "many">>;
2483
+ }, "strip", z.ZodTypeAny, {
2484
+ type: "reasoning";
2485
+ content: {
2486
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2487
+ text?: string | undefined;
2488
+ url?: string | undefined;
2489
+ data?: JsonValue | undefined;
2490
+ mime?: string | undefined;
2491
+ }[];
2492
+ summary: {
2493
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2494
+ text?: string | undefined;
2495
+ url?: string | undefined;
2496
+ data?: JsonValue | undefined;
2497
+ mime?: string | undefined;
2498
+ }[];
2499
+ }, {
2500
+ type: "reasoning";
2501
+ content?: {
2502
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2503
+ text?: string | undefined;
2504
+ url?: string | undefined;
2505
+ data?: JsonValue | undefined;
2506
+ mime?: string | undefined;
2507
+ }[] | undefined;
2508
+ summary?: {
2509
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2510
+ text?: string | undefined;
2511
+ url?: string | undefined;
2512
+ data?: JsonValue | undefined;
2513
+ mime?: string | undefined;
2514
+ }[] | undefined;
2515
+ }>, z.ZodObject<{
2516
+ type: z.ZodLiteral<"delta">;
2517
+ content: z.ZodDefault<z.ZodArray<z.ZodObject<{
2518
+ type: z.ZodEnum<["text", "image_url", "json", "reasoning", "metadata", "blob"]>;
2519
+ text: z.ZodOptional<z.ZodString>;
2520
+ data: z.ZodOptional<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
2521
+ url: z.ZodOptional<z.ZodString>;
2522
+ mime: z.ZodOptional<z.ZodString>;
2523
+ }, "strip", z.ZodTypeAny, {
2524
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2525
+ text?: string | undefined;
2526
+ url?: string | undefined;
2527
+ data?: JsonValue | undefined;
2528
+ mime?: string | undefined;
2529
+ }, {
2530
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2531
+ text?: string | undefined;
2532
+ url?: string | undefined;
2533
+ data?: JsonValue | undefined;
2534
+ mime?: string | undefined;
2535
+ }>, "many">>;
2536
+ }, "strip", z.ZodTypeAny, {
2537
+ type: "delta";
2538
+ content: {
2539
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2540
+ text?: string | undefined;
2541
+ url?: string | undefined;
2542
+ data?: JsonValue | undefined;
2543
+ mime?: string | undefined;
2544
+ }[];
2545
+ }, {
2546
+ type: "delta";
2547
+ content?: {
2548
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2549
+ text?: string | undefined;
2550
+ url?: string | undefined;
2551
+ data?: JsonValue | undefined;
2552
+ mime?: string | undefined;
2553
+ }[] | undefined;
2554
+ }>]>, "many">>;
2555
+ usage: z.ZodOptional<z.ZodObject<{
2556
+ input_tokens: z.ZodOptional<z.ZodNumber>;
2557
+ output_tokens: z.ZodOptional<z.ZodNumber>;
2558
+ total_tokens: z.ZodOptional<z.ZodNumber>;
2559
+ }, "strip", z.ZodTypeAny, {
2560
+ total_tokens?: number | undefined;
2561
+ input_tokens?: number | undefined;
2562
+ output_tokens?: number | undefined;
2563
+ }, {
2564
+ total_tokens?: number | undefined;
2565
+ input_tokens?: number | undefined;
2566
+ output_tokens?: number | undefined;
2567
+ }>>;
2568
+ finish_reason: z.ZodOptional<z.ZodString>;
2569
+ error: z.ZodOptional<z.ZodObject<{
2570
+ message: z.ZodString;
2571
+ code: z.ZodOptional<z.ZodString>;
2572
+ }, "strip", z.ZodTypeAny, {
2573
+ message: string;
2574
+ code?: string | undefined;
2575
+ }, {
2576
+ message: string;
2577
+ code?: string | undefined;
2578
+ }>>;
2579
+ metadata: z.ZodOptional<z.ZodObject<{
2580
+ provider: z.ZodOptional<z.ZodString>;
2581
+ providerFormat: z.ZodOptional<z.ZodString>;
2582
+ clientFormat: z.ZodOptional<z.ZodString>;
2583
+ providerResponse: z.ZodOptional<z.ZodUnknown>;
2584
+ requestHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2585
+ normalization: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2586
+ synthetic: z.ZodOptional<z.ZodBoolean>;
2587
+ }, "strip", z.ZodTypeAny, {
2588
+ clientFormat?: string | undefined;
2589
+ providerFormat?: string | undefined;
2590
+ provider?: string | undefined;
2591
+ providerResponse?: unknown;
2592
+ requestHeaders?: Record<string, string> | undefined;
2593
+ normalization?: Record<string, unknown> | undefined;
2594
+ synthetic?: boolean | undefined;
2595
+ }, {
2596
+ clientFormat?: string | undefined;
2597
+ providerFormat?: string | undefined;
2598
+ provider?: string | undefined;
2599
+ providerResponse?: unknown;
2600
+ requestHeaders?: Record<string, string> | undefined;
2601
+ normalization?: Record<string, unknown> | undefined;
2602
+ synthetic?: boolean | undefined;
2603
+ }>>;
2604
+ }, "strip", z.ZodTypeAny, {
2605
+ id: string;
2606
+ model: string;
2607
+ output: ({
2608
+ type: "message";
2609
+ role: string;
2610
+ content: {
2611
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2612
+ text?: string | undefined;
2613
+ url?: string | undefined;
2614
+ data?: JsonValue | undefined;
2615
+ mime?: string | undefined;
2616
+ }[];
2617
+ status?: string | undefined;
2618
+ tool_calls?: {
2619
+ name: string;
2620
+ type: "function";
2621
+ id: string;
2622
+ arguments: string;
2623
+ }[] | undefined;
2624
+ } | {
2625
+ name: string;
2626
+ type: "tool_call";
2627
+ arguments: string;
2628
+ call_id: string;
2629
+ status?: string | undefined;
2630
+ } | {
2631
+ type: "reasoning";
2632
+ content: {
2633
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2634
+ text?: string | undefined;
2635
+ url?: string | undefined;
2636
+ data?: JsonValue | undefined;
2637
+ mime?: string | undefined;
2638
+ }[];
2639
+ summary: {
2640
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2641
+ text?: string | undefined;
2642
+ url?: string | undefined;
2643
+ data?: JsonValue | undefined;
2644
+ mime?: string | undefined;
2645
+ }[];
2646
+ } | {
2647
+ type: "delta";
2648
+ content: {
2649
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2650
+ text?: string | undefined;
2651
+ url?: string | undefined;
2652
+ data?: JsonValue | undefined;
2653
+ mime?: string | undefined;
2654
+ }[];
2655
+ })[];
2656
+ operation: Operation;
2657
+ error?: {
2658
+ message: string;
2659
+ code?: string | undefined;
2660
+ } | undefined;
2661
+ finish_reason?: string | undefined;
2662
+ usage?: {
2663
+ total_tokens?: number | undefined;
2664
+ input_tokens?: number | undefined;
2665
+ output_tokens?: number | undefined;
2666
+ } | undefined;
2667
+ metadata?: {
2668
+ clientFormat?: string | undefined;
2669
+ providerFormat?: string | undefined;
2670
+ provider?: string | undefined;
2671
+ providerResponse?: unknown;
2672
+ requestHeaders?: Record<string, string> | undefined;
2673
+ normalization?: Record<string, unknown> | undefined;
2674
+ synthetic?: boolean | undefined;
2675
+ } | undefined;
2676
+ }, {
2677
+ id: string;
2678
+ model: string;
2679
+ operation: Operation;
2680
+ error?: {
2681
+ message: string;
2682
+ code?: string | undefined;
2683
+ } | undefined;
2684
+ finish_reason?: string | undefined;
2685
+ usage?: {
2686
+ total_tokens?: number | undefined;
2687
+ input_tokens?: number | undefined;
2688
+ output_tokens?: number | undefined;
2689
+ } | undefined;
2690
+ metadata?: {
2691
+ clientFormat?: string | undefined;
2692
+ providerFormat?: string | undefined;
2693
+ provider?: string | undefined;
2694
+ providerResponse?: unknown;
2695
+ requestHeaders?: Record<string, string> | undefined;
2696
+ normalization?: Record<string, unknown> | undefined;
2697
+ synthetic?: boolean | undefined;
2698
+ } | undefined;
2699
+ output?: ({
2700
+ type: "message";
2701
+ role: string;
2702
+ status?: string | undefined;
2703
+ content?: {
2704
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2705
+ text?: string | undefined;
2706
+ url?: string | undefined;
2707
+ data?: JsonValue | undefined;
2708
+ mime?: string | undefined;
2709
+ }[] | undefined;
2710
+ tool_calls?: {
2711
+ name: string;
2712
+ type: "function";
2713
+ id: string;
2714
+ arguments?: string | undefined;
2715
+ }[] | undefined;
2716
+ } | {
2717
+ name: string;
2718
+ type: "tool_call";
2719
+ arguments: string;
2720
+ call_id: string;
2721
+ status?: string | undefined;
2722
+ } | {
2723
+ type: "reasoning";
2724
+ content?: {
2725
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2726
+ text?: string | undefined;
2727
+ url?: string | undefined;
2728
+ data?: JsonValue | undefined;
2729
+ mime?: string | undefined;
2730
+ }[] | undefined;
2731
+ summary?: {
2732
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2733
+ text?: string | undefined;
2734
+ url?: string | undefined;
2735
+ data?: JsonValue | undefined;
2736
+ mime?: string | undefined;
2737
+ }[] | undefined;
2738
+ } | {
2739
+ type: "delta";
2740
+ content?: {
2741
+ type: "text" | "image_url" | "metadata" | "reasoning" | "json" | "blob";
2742
+ text?: string | undefined;
2743
+ url?: string | undefined;
2744
+ data?: JsonValue | undefined;
2745
+ mime?: string | undefined;
2746
+ }[] | undefined;
2747
+ })[] | undefined;
2748
+ }>;
2749
+ export type Response = z.infer<typeof ResponseSchema>;
2750
+ export interface Envelope {
2751
+ request: Request;
2752
+ response?: Response;
30
2753
  }
31
- export interface ConvertedRequest<TBody extends JsonValue = JsonValue> {
32
- body: TBody;
33
- headers?: Record<string, string>;
2754
+ export interface TransformContext {
2755
+ request: Request;
2756
+ response?: Response;
34
2757
  }
35
- export interface ConversionContext<TBody extends JsonValue = JsonValue> {
36
- request: ProxyRequest<TBody>;
37
- providerFormat: ProviderFormat;
2758
+ export interface Transform {
2759
+ name: string;
2760
+ stage: "ingress" | "egress";
2761
+ priority?: number;
2762
+ applies(context: TransformContext): boolean;
2763
+ transform(context: TransformContext): Promise<void> | void;
38
2764
  }
39
- export interface ProviderRequestPayload<TBody extends JsonValue = JsonValue> {
40
- body: TBody;
2765
+ export interface ProviderRequest {
2766
+ body: JsonValue;
41
2767
  headers: Record<string, string>;
42
2768
  }
43
- export interface ProviderResponsePayload<TBody extends JsonValue = JsonValue> {
2769
+ export interface ProviderResponse {
44
2770
  status: number;
45
- body: TBody;
2771
+ body: JsonValue;
46
2772
  headers: Record<string, string>;
2773
+ requestBody?: JsonValue;
47
2774
  }
48
- export interface PipelineResult {
49
- statusCode: number;
50
- responseBody: JsonValue;
51
- providerResponse: ProviderResponsePayload;
52
- providerRequestBody: JsonValue;
53
- request: ProxyRequest;
54
- isError: boolean;
2775
+ export interface ProviderAdapter {
2776
+ key: string;
2777
+ providerFormat: string;
2778
+ invoke(request: Request, config?: JsonObject): Promise<ProviderResponse>;
2779
+ toUlxResponse(payload: ProviderResponse, request: Request): Promise<Response> | Response;
55
2780
  }
56
- export type RequestTransformStage = "source" | "post-conversion";
57
- export type ResponseTransformStage = "provider" | "post-conversion";
58
- export interface RequestTransformContext {
59
- request: ProxyRequest;
60
- providerRequest?: ProviderRequestPayload;
2781
+ export interface ClientAdapter {
2782
+ clientFormat: string;
2783
+ toUlx(body: ClientRequest, headers: Record<string, string>): Request;
2784
+ fromUlx(response: Response, request: Request): JsonValue;
61
2785
  }
62
- export interface ResponseTransformContext {
63
- request: ProxyRequest;
64
- providerResponse?: ProviderResponsePayload;
65
- clientResponse?: JsonValue;
66
- }
67
- export interface RequestTransform {
68
- name: string;
69
- stage: RequestTransformStage;
70
- priority?: number;
71
- applies(context: RequestTransformContext): boolean;
72
- transform(context: RequestTransformContext): Promise<void> | void;
73
- }
74
- export interface ResponseTransform {
75
- name: string;
76
- stage: ResponseTransformStage;
77
- priority?: number;
78
- applies(context: ResponseTransformContext): boolean;
79
- transform(context: ResponseTransformContext): Promise<void> | void;
2786
+ export interface PipelineResult {
2787
+ request: Request;
2788
+ response: Response;
2789
+ providerResponse: ProviderResponse;
2790
+ providerAdapter: string;
2791
+ clientResponse: JsonValue;
80
2792
  }
2793
+ export type Json = JsonValue;
2794
+ export declare const isMessage: (value: unknown) => value is Message;