@adaline/open-router 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.
@@ -0,0 +1,1008 @@
1
+ import * as zod from 'zod';
2
+ import { z } from 'zod';
3
+ import { ChatModelV1, ChatModelSchemaType, UrlType, HeadersType, ParamsType, ProviderV1, EmbeddingModelV1, EmbeddingModelSchemaType } from '@adaline/provider';
4
+ import { MessageType, ConfigType, ToolType, ChatResponseType, PartialChatResponseType } from '@adaline/types';
5
+
6
+ declare const OpenRouterChatModelConfigs: {
7
+ readonly base: (maxOutputTokens: number, maxSequences: number) => {
8
+ def: {
9
+ readonly temperature: {
10
+ type: "range";
11
+ param: string;
12
+ title: string;
13
+ description: string;
14
+ max: number;
15
+ min: number;
16
+ step: number;
17
+ default: number;
18
+ };
19
+ readonly maxTokens: {
20
+ type: "range";
21
+ param: string;
22
+ title: string;
23
+ description: string;
24
+ max: number;
25
+ min: number;
26
+ step: number;
27
+ default: number;
28
+ };
29
+ readonly stop: {
30
+ type: "multi-string";
31
+ param: string;
32
+ title: string;
33
+ description: string;
34
+ max: number;
35
+ };
36
+ readonly topP: {
37
+ type: "range";
38
+ param: string;
39
+ title: string;
40
+ description: string;
41
+ max: number;
42
+ min: number;
43
+ step: number;
44
+ default: number;
45
+ };
46
+ readonly frequencyPenalty: {
47
+ type: "range";
48
+ param: string;
49
+ title: string;
50
+ description: string;
51
+ max: number;
52
+ min: number;
53
+ step: number;
54
+ default: number;
55
+ };
56
+ readonly presencePenalty: {
57
+ type: "range";
58
+ param: string;
59
+ title: string;
60
+ description: string;
61
+ max: number;
62
+ min: number;
63
+ step: number;
64
+ default: number;
65
+ };
66
+ readonly seed: {
67
+ type: "range";
68
+ param: string;
69
+ title: string;
70
+ description: string;
71
+ max: number;
72
+ min: number;
73
+ step: number;
74
+ default: number;
75
+ };
76
+ readonly logProbs: {
77
+ type: "select-boolean";
78
+ param: string;
79
+ title: string;
80
+ description: string;
81
+ default: boolean | null;
82
+ };
83
+ readonly topLogProbs: {
84
+ type: "range";
85
+ param: string;
86
+ title: string;
87
+ description: string;
88
+ max: number;
89
+ min: number;
90
+ step: number;
91
+ default: number;
92
+ };
93
+ readonly toolChoice: {
94
+ type: "select-string";
95
+ param: string;
96
+ title: string;
97
+ description: string;
98
+ default: string | null;
99
+ choices: string[];
100
+ };
101
+ };
102
+ schema: zod.ZodObject<{
103
+ temperature: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
104
+ maxTokens: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
105
+ stop: zod.ZodOptional<zod.ZodDefault<zod.ZodArray<zod.ZodString, "many">>>;
106
+ topP: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
107
+ frequencyPenalty: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
108
+ presencePenalty: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
109
+ seed: zod.ZodEffects<zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>, number | undefined, number | undefined>;
110
+ logProbs: zod.ZodOptional<zod.ZodDefault<zod.ZodNullable<zod.ZodBoolean>>>;
111
+ topLogProbs: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
112
+ toolChoice: zod.ZodOptional<zod.ZodDefault<zod.ZodNullable<zod.ZodEnum<[string, ...string[]]>>>>;
113
+ }, "strip", zod.ZodTypeAny, {
114
+ temperature?: number | undefined;
115
+ seed?: number | undefined;
116
+ stop?: string[] | undefined;
117
+ maxTokens?: number | undefined;
118
+ topP?: number | undefined;
119
+ frequencyPenalty?: number | undefined;
120
+ presencePenalty?: number | undefined;
121
+ logProbs?: boolean | null | undefined;
122
+ topLogProbs?: number | undefined;
123
+ toolChoice?: string | null | undefined;
124
+ }, {
125
+ temperature?: number | undefined;
126
+ seed?: number | undefined;
127
+ stop?: string[] | undefined;
128
+ maxTokens?: number | undefined;
129
+ topP?: number | undefined;
130
+ frequencyPenalty?: number | undefined;
131
+ presencePenalty?: number | undefined;
132
+ logProbs?: boolean | null | undefined;
133
+ topLogProbs?: number | undefined;
134
+ toolChoice?: string | null | undefined;
135
+ }>;
136
+ };
137
+ };
138
+
139
+ declare const ChatModelBaseConfigSchema: (maxOutputTokens: number, maxSequences: number) => z.ZodObject<{
140
+ temperature: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
141
+ maxTokens: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
142
+ stop: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
143
+ topP: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
144
+ frequencyPenalty: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
145
+ presencePenalty: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
146
+ seed: z.ZodEffects<z.ZodOptional<z.ZodDefault<z.ZodNumber>>, number | undefined, number | undefined>;
147
+ logProbs: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodBoolean>>>;
148
+ topLogProbs: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
149
+ toolChoice: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodEnum<[string, ...string[]]>>>>;
150
+ }, "strip", z.ZodTypeAny, {
151
+ temperature?: number | undefined;
152
+ seed?: number | undefined;
153
+ stop?: string[] | undefined;
154
+ maxTokens?: number | undefined;
155
+ topP?: number | undefined;
156
+ frequencyPenalty?: number | undefined;
157
+ presencePenalty?: number | undefined;
158
+ logProbs?: boolean | null | undefined;
159
+ topLogProbs?: number | undefined;
160
+ toolChoice?: string | null | undefined;
161
+ }, {
162
+ temperature?: number | undefined;
163
+ seed?: number | undefined;
164
+ stop?: string[] | undefined;
165
+ maxTokens?: number | undefined;
166
+ topP?: number | undefined;
167
+ frequencyPenalty?: number | undefined;
168
+ presencePenalty?: number | undefined;
169
+ logProbs?: boolean | null | undefined;
170
+ topLogProbs?: number | undefined;
171
+ toolChoice?: string | null | undefined;
172
+ }>;
173
+ declare const ChatModelBaseConfigDef: (maxOutputTokens: number, maxSequences: number) => {
174
+ readonly temperature: {
175
+ type: "range";
176
+ param: string;
177
+ title: string;
178
+ description: string;
179
+ max: number;
180
+ min: number;
181
+ step: number;
182
+ default: number;
183
+ };
184
+ readonly maxTokens: {
185
+ type: "range";
186
+ param: string;
187
+ title: string;
188
+ description: string;
189
+ max: number;
190
+ min: number;
191
+ step: number;
192
+ default: number;
193
+ };
194
+ readonly stop: {
195
+ type: "multi-string";
196
+ param: string;
197
+ title: string;
198
+ description: string;
199
+ max: number;
200
+ };
201
+ readonly topP: {
202
+ type: "range";
203
+ param: string;
204
+ title: string;
205
+ description: string;
206
+ max: number;
207
+ min: number;
208
+ step: number;
209
+ default: number;
210
+ };
211
+ readonly frequencyPenalty: {
212
+ type: "range";
213
+ param: string;
214
+ title: string;
215
+ description: string;
216
+ max: number;
217
+ min: number;
218
+ step: number;
219
+ default: number;
220
+ };
221
+ readonly presencePenalty: {
222
+ type: "range";
223
+ param: string;
224
+ title: string;
225
+ description: string;
226
+ max: number;
227
+ min: number;
228
+ step: number;
229
+ default: number;
230
+ };
231
+ readonly seed: {
232
+ type: "range";
233
+ param: string;
234
+ title: string;
235
+ description: string;
236
+ max: number;
237
+ min: number;
238
+ step: number;
239
+ default: number;
240
+ };
241
+ readonly logProbs: {
242
+ type: "select-boolean";
243
+ param: string;
244
+ title: string;
245
+ description: string;
246
+ default: boolean | null;
247
+ };
248
+ readonly topLogProbs: {
249
+ type: "range";
250
+ param: string;
251
+ title: string;
252
+ description: string;
253
+ max: number;
254
+ min: number;
255
+ step: number;
256
+ default: number;
257
+ };
258
+ readonly toolChoice: {
259
+ type: "select-string";
260
+ param: string;
261
+ title: string;
262
+ description: string;
263
+ default: string | null;
264
+ choices: string[];
265
+ };
266
+ };
267
+
268
+ declare const temperature: {
269
+ def: {
270
+ type: "range";
271
+ param: string;
272
+ title: string;
273
+ description: string;
274
+ max: number;
275
+ min: number;
276
+ step: number;
277
+ default: number;
278
+ };
279
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
280
+ };
281
+ declare const maxTokens: (maxOutputTokens: number) => {
282
+ def: {
283
+ type: "range";
284
+ param: string;
285
+ title: string;
286
+ description: string;
287
+ max: number;
288
+ min: number;
289
+ step: number;
290
+ default: number;
291
+ };
292
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
293
+ };
294
+ declare const stop: (maxSequences: number) => {
295
+ def: {
296
+ type: "multi-string";
297
+ param: string;
298
+ title: string;
299
+ description: string;
300
+ max: number;
301
+ };
302
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodArray<zod.ZodString, "many">>>;
303
+ };
304
+ declare const topA: {
305
+ def: {
306
+ type: "range";
307
+ param: string;
308
+ title: string;
309
+ description: string;
310
+ max: number;
311
+ min: number;
312
+ step: number;
313
+ default: number;
314
+ };
315
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
316
+ };
317
+ declare const topK: {
318
+ def: {
319
+ type: "range";
320
+ param: string;
321
+ title: string;
322
+ description: string;
323
+ max: number;
324
+ min: number;
325
+ step: number;
326
+ default: number;
327
+ };
328
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
329
+ };
330
+ declare const topP: {
331
+ def: {
332
+ type: "range";
333
+ param: string;
334
+ title: string;
335
+ description: string;
336
+ max: number;
337
+ min: number;
338
+ step: number;
339
+ default: number;
340
+ };
341
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
342
+ };
343
+ declare const minP: {
344
+ def: {
345
+ type: "range";
346
+ param: string;
347
+ title: string;
348
+ description: string;
349
+ max: number;
350
+ min: number;
351
+ step: number;
352
+ default: number;
353
+ };
354
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
355
+ };
356
+ declare const frequencyPenalty: {
357
+ def: {
358
+ type: "range";
359
+ param: string;
360
+ title: string;
361
+ description: string;
362
+ max: number;
363
+ min: number;
364
+ step: number;
365
+ default: number;
366
+ };
367
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
368
+ };
369
+ declare const presencePenalty: {
370
+ def: {
371
+ type: "range";
372
+ param: string;
373
+ title: string;
374
+ description: string;
375
+ max: number;
376
+ min: number;
377
+ step: number;
378
+ default: number;
379
+ };
380
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
381
+ };
382
+ declare const repetitionPenalty: {
383
+ def: {
384
+ type: "range";
385
+ param: string;
386
+ title: string;
387
+ description: string;
388
+ max: number;
389
+ min: number;
390
+ step: number;
391
+ default: number;
392
+ };
393
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
394
+ };
395
+ declare const seed: {
396
+ def: {
397
+ type: "range";
398
+ param: string;
399
+ title: string;
400
+ description: string;
401
+ max: number;
402
+ min: number;
403
+ step: number;
404
+ default: number;
405
+ };
406
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
407
+ };
408
+ declare const logProbs: {
409
+ def: {
410
+ type: "select-boolean";
411
+ param: string;
412
+ title: string;
413
+ description: string;
414
+ default: boolean | null;
415
+ };
416
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNullable<zod.ZodBoolean>>>;
417
+ };
418
+ declare const topLogProbs: {
419
+ def: {
420
+ type: "range";
421
+ param: string;
422
+ title: string;
423
+ description: string;
424
+ max: number;
425
+ min: number;
426
+ step: number;
427
+ default: number;
428
+ };
429
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
430
+ };
431
+ declare const toolChoice: {
432
+ def: {
433
+ type: "select-string";
434
+ param: string;
435
+ title: string;
436
+ description: string;
437
+ default: string | null;
438
+ choices: string[];
439
+ };
440
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNullable<zod.ZodEnum<[string, ...string[]]>>>>;
441
+ };
442
+ declare const responseFormat: {
443
+ def: {
444
+ type: "select-string";
445
+ param: string;
446
+ title: string;
447
+ description: string;
448
+ default: string | null;
449
+ choices: string[];
450
+ };
451
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNullable<zod.ZodEnum<[string, ...string[]]>>>>;
452
+ };
453
+
454
+ declare const OpenRouterChatRequest: z.ZodObject<{
455
+ model: z.ZodOptional<z.ZodString>;
456
+ messages: z.ZodArray<z.ZodUnion<[z.ZodObject<{
457
+ role: z.ZodLiteral<"system">;
458
+ content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{
459
+ text: z.ZodString;
460
+ type: z.ZodLiteral<"text">;
461
+ }, "strip", z.ZodTypeAny, {
462
+ type: "text";
463
+ text: string;
464
+ }, {
465
+ type: "text";
466
+ text: string;
467
+ }>, "many">]>;
468
+ }, "strip", z.ZodTypeAny, {
469
+ role: "system";
470
+ content: string | {
471
+ type: "text";
472
+ text: string;
473
+ }[];
474
+ }, {
475
+ role: "system";
476
+ content: string | {
477
+ type: "text";
478
+ text: string;
479
+ }[];
480
+ }>, z.ZodObject<{
481
+ role: z.ZodLiteral<"user">;
482
+ content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
483
+ text: z.ZodString;
484
+ type: z.ZodLiteral<"text">;
485
+ }, "strip", z.ZodTypeAny, {
486
+ type: "text";
487
+ text: string;
488
+ }, {
489
+ type: "text";
490
+ text: string;
491
+ }>, z.ZodObject<{
492
+ type: z.ZodLiteral<"image_url">;
493
+ image_url: z.ZodObject<{
494
+ url: z.ZodString;
495
+ detail: z.ZodOptional<z.ZodEnum<["low", "high", "auto"]>>;
496
+ }, "strip", z.ZodTypeAny, {
497
+ url: string;
498
+ detail?: "auto" | "low" | "high" | undefined;
499
+ }, {
500
+ url: string;
501
+ detail?: "auto" | "low" | "high" | undefined;
502
+ }>;
503
+ }, "strip", z.ZodTypeAny, {
504
+ type: "image_url";
505
+ image_url: {
506
+ url: string;
507
+ detail?: "auto" | "low" | "high" | undefined;
508
+ };
509
+ }, {
510
+ type: "image_url";
511
+ image_url: {
512
+ url: string;
513
+ detail?: "auto" | "low" | "high" | undefined;
514
+ };
515
+ }>]>, "many">]>;
516
+ }, "strip", z.ZodTypeAny, {
517
+ role: "user";
518
+ content: string | ({
519
+ type: "text";
520
+ text: string;
521
+ } | {
522
+ type: "image_url";
523
+ image_url: {
524
+ url: string;
525
+ detail?: "auto" | "low" | "high" | undefined;
526
+ };
527
+ })[];
528
+ }, {
529
+ role: "user";
530
+ content: string | ({
531
+ type: "text";
532
+ text: string;
533
+ } | {
534
+ type: "image_url";
535
+ image_url: {
536
+ url: string;
537
+ detail?: "auto" | "low" | "high" | undefined;
538
+ };
539
+ })[];
540
+ }>, z.ZodObject<{
541
+ role: z.ZodLiteral<"assistant">;
542
+ content: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{
543
+ text: z.ZodString;
544
+ type: z.ZodLiteral<"text">;
545
+ }, "strip", z.ZodTypeAny, {
546
+ type: "text";
547
+ text: string;
548
+ }, {
549
+ type: "text";
550
+ text: string;
551
+ }>, "many">]>>;
552
+ tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
553
+ id: z.ZodString;
554
+ type: z.ZodLiteral<"function">;
555
+ function: z.ZodObject<{
556
+ name: z.ZodString;
557
+ arguments: z.ZodString;
558
+ }, "strip", z.ZodTypeAny, {
559
+ name: string;
560
+ arguments: string;
561
+ }, {
562
+ name: string;
563
+ arguments: string;
564
+ }>;
565
+ }, "strip", z.ZodTypeAny, {
566
+ function: {
567
+ name: string;
568
+ arguments: string;
569
+ };
570
+ type: "function";
571
+ id: string;
572
+ }, {
573
+ function: {
574
+ name: string;
575
+ arguments: string;
576
+ };
577
+ type: "function";
578
+ id: string;
579
+ }>, "many">>;
580
+ }, "strip", z.ZodTypeAny, {
581
+ role: "assistant";
582
+ content?: string | {
583
+ type: "text";
584
+ text: string;
585
+ }[] | undefined;
586
+ tool_calls?: {
587
+ function: {
588
+ name: string;
589
+ arguments: string;
590
+ };
591
+ type: "function";
592
+ id: string;
593
+ }[] | undefined;
594
+ }, {
595
+ role: "assistant";
596
+ content?: string | {
597
+ type: "text";
598
+ text: string;
599
+ }[] | undefined;
600
+ tool_calls?: {
601
+ function: {
602
+ name: string;
603
+ arguments: string;
604
+ };
605
+ type: "function";
606
+ id: string;
607
+ }[] | undefined;
608
+ }>, z.ZodObject<{
609
+ role: z.ZodLiteral<"tool">;
610
+ tool_call_id: z.ZodString;
611
+ content: z.ZodString;
612
+ }, "strip", z.ZodTypeAny, {
613
+ role: "tool";
614
+ content: string;
615
+ tool_call_id: string;
616
+ }, {
617
+ role: "tool";
618
+ content: string;
619
+ tool_call_id: string;
620
+ }>]>, "many">;
621
+ frequency_penalty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
622
+ logprobs: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
623
+ top_logprobs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
624
+ max_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
625
+ presence_penalty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
626
+ repetition_penalty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
627
+ response_format: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
628
+ type: z.ZodEnum<["text", "json_object"]>;
629
+ }, "strip", z.ZodTypeAny, {
630
+ type: "text" | "json_object";
631
+ }, {
632
+ type: "text" | "json_object";
633
+ }>, z.ZodObject<{
634
+ type: z.ZodLiteral<"json_schema">;
635
+ json_schema: z.ZodObject<{
636
+ name: z.ZodString;
637
+ description: z.ZodOptional<z.ZodString>;
638
+ strict: z.ZodOptional<z.ZodBoolean>;
639
+ schema: z.ZodAny;
640
+ }, "strip", z.ZodTypeAny, {
641
+ name: string;
642
+ description?: string | undefined;
643
+ strict?: boolean | undefined;
644
+ schema?: any;
645
+ }, {
646
+ name: string;
647
+ description?: string | undefined;
648
+ strict?: boolean | undefined;
649
+ schema?: any;
650
+ }>;
651
+ }, "strip", z.ZodTypeAny, {
652
+ type: "json_schema";
653
+ json_schema: {
654
+ name: string;
655
+ description?: string | undefined;
656
+ strict?: boolean | undefined;
657
+ schema?: any;
658
+ };
659
+ }, {
660
+ type: "json_schema";
661
+ json_schema: {
662
+ name: string;
663
+ description?: string | undefined;
664
+ strict?: boolean | undefined;
665
+ schema?: any;
666
+ };
667
+ }>]>>;
668
+ seed: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
669
+ stop: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
670
+ top_a: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
671
+ temperature: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
672
+ top_p: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
673
+ top_k: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
674
+ min_p: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
675
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
676
+ type: z.ZodLiteral<"function">;
677
+ function: z.ZodObject<{
678
+ name: z.ZodString;
679
+ description: z.ZodOptional<z.ZodString>;
680
+ strict: z.ZodOptional<z.ZodBoolean>;
681
+ parameters: z.ZodAny;
682
+ }, "strip", z.ZodTypeAny, {
683
+ name: string;
684
+ description?: string | undefined;
685
+ strict?: boolean | undefined;
686
+ parameters?: any;
687
+ }, {
688
+ name: string;
689
+ description?: string | undefined;
690
+ strict?: boolean | undefined;
691
+ parameters?: any;
692
+ }>;
693
+ }, "strip", z.ZodTypeAny, {
694
+ function: {
695
+ name: string;
696
+ description?: string | undefined;
697
+ strict?: boolean | undefined;
698
+ parameters?: any;
699
+ };
700
+ type: "function";
701
+ }, {
702
+ function: {
703
+ name: string;
704
+ description?: string | undefined;
705
+ strict?: boolean | undefined;
706
+ parameters?: any;
707
+ };
708
+ type: "function";
709
+ }>, "many">>;
710
+ tool_choice: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["none", "auto", "required"]>, z.ZodObject<{
711
+ type: z.ZodLiteral<"function">;
712
+ function: z.ZodObject<{
713
+ name: z.ZodString;
714
+ }, "strip", z.ZodTypeAny, {
715
+ name: string;
716
+ }, {
717
+ name: string;
718
+ }>;
719
+ }, "strip", z.ZodTypeAny, {
720
+ function: {
721
+ name: string;
722
+ };
723
+ type: "function";
724
+ }, {
725
+ function: {
726
+ name: string;
727
+ };
728
+ type: "function";
729
+ }>]>>;
730
+ }, "strip", z.ZodTypeAny, {
731
+ messages: ({
732
+ role: "system";
733
+ content: string | {
734
+ type: "text";
735
+ text: string;
736
+ }[];
737
+ } | {
738
+ role: "user";
739
+ content: string | ({
740
+ type: "text";
741
+ text: string;
742
+ } | {
743
+ type: "image_url";
744
+ image_url: {
745
+ url: string;
746
+ detail?: "auto" | "low" | "high" | undefined;
747
+ };
748
+ })[];
749
+ } | {
750
+ role: "assistant";
751
+ content?: string | {
752
+ type: "text";
753
+ text: string;
754
+ }[] | undefined;
755
+ tool_calls?: {
756
+ function: {
757
+ name: string;
758
+ arguments: string;
759
+ };
760
+ type: "function";
761
+ id: string;
762
+ }[] | undefined;
763
+ } | {
764
+ role: "tool";
765
+ content: string;
766
+ tool_call_id: string;
767
+ })[];
768
+ temperature?: number | null | undefined;
769
+ top_a?: number | null | undefined;
770
+ top_k?: number | null | undefined;
771
+ top_p?: number | null | undefined;
772
+ min_p?: number | null | undefined;
773
+ frequency_penalty?: number | null | undefined;
774
+ presence_penalty?: number | null | undefined;
775
+ repetition_penalty?: number | null | undefined;
776
+ seed?: number | null | undefined;
777
+ logprobs?: boolean | null | undefined;
778
+ top_logprobs?: number | null | undefined;
779
+ tool_choice?: "auto" | "required" | "none" | {
780
+ function: {
781
+ name: string;
782
+ };
783
+ type: "function";
784
+ } | undefined;
785
+ response_format?: {
786
+ type: "text" | "json_object";
787
+ } | {
788
+ type: "json_schema";
789
+ json_schema: {
790
+ name: string;
791
+ description?: string | undefined;
792
+ strict?: boolean | undefined;
793
+ schema?: any;
794
+ };
795
+ } | undefined;
796
+ max_tokens?: number | null | undefined;
797
+ stop?: string | string[] | null | undefined;
798
+ model?: string | undefined;
799
+ tools?: {
800
+ function: {
801
+ name: string;
802
+ description?: string | undefined;
803
+ strict?: boolean | undefined;
804
+ parameters?: any;
805
+ };
806
+ type: "function";
807
+ }[] | undefined;
808
+ }, {
809
+ messages: ({
810
+ role: "system";
811
+ content: string | {
812
+ type: "text";
813
+ text: string;
814
+ }[];
815
+ } | {
816
+ role: "user";
817
+ content: string | ({
818
+ type: "text";
819
+ text: string;
820
+ } | {
821
+ type: "image_url";
822
+ image_url: {
823
+ url: string;
824
+ detail?: "auto" | "low" | "high" | undefined;
825
+ };
826
+ })[];
827
+ } | {
828
+ role: "assistant";
829
+ content?: string | {
830
+ type: "text";
831
+ text: string;
832
+ }[] | undefined;
833
+ tool_calls?: {
834
+ function: {
835
+ name: string;
836
+ arguments: string;
837
+ };
838
+ type: "function";
839
+ id: string;
840
+ }[] | undefined;
841
+ } | {
842
+ role: "tool";
843
+ content: string;
844
+ tool_call_id: string;
845
+ })[];
846
+ temperature?: number | null | undefined;
847
+ top_a?: number | null | undefined;
848
+ top_k?: number | null | undefined;
849
+ top_p?: number | null | undefined;
850
+ min_p?: number | null | undefined;
851
+ frequency_penalty?: number | null | undefined;
852
+ presence_penalty?: number | null | undefined;
853
+ repetition_penalty?: number | null | undefined;
854
+ seed?: number | null | undefined;
855
+ logprobs?: boolean | null | undefined;
856
+ top_logprobs?: number | null | undefined;
857
+ tool_choice?: "auto" | "required" | "none" | {
858
+ function: {
859
+ name: string;
860
+ };
861
+ type: "function";
862
+ } | undefined;
863
+ response_format?: {
864
+ type: "text" | "json_object";
865
+ } | {
866
+ type: "json_schema";
867
+ json_schema: {
868
+ name: string;
869
+ description?: string | undefined;
870
+ strict?: boolean | undefined;
871
+ schema?: any;
872
+ };
873
+ } | undefined;
874
+ max_tokens?: number | null | undefined;
875
+ stop?: string | string[] | null | undefined;
876
+ model?: string | undefined;
877
+ tools?: {
878
+ function: {
879
+ name: string;
880
+ description?: string | undefined;
881
+ strict?: boolean | undefined;
882
+ parameters?: any;
883
+ };
884
+ type: "function";
885
+ }[] | undefined;
886
+ }>;
887
+ type OpenRouterChatRequestType = z.infer<typeof OpenRouterChatRequest>;
888
+
889
+ declare const BaseChatModelOptions: z.ZodObject<{
890
+ apiKey: z.ZodString;
891
+ modelName: z.ZodString;
892
+ openRouterReferer: z.ZodOptional<z.ZodString>;
893
+ openRouterTitle: z.ZodOptional<z.ZodString>;
894
+ }, "strip", z.ZodTypeAny, {
895
+ apiKey: string;
896
+ modelName: string;
897
+ openRouterReferer?: string | undefined;
898
+ openRouterTitle?: string | undefined;
899
+ }, {
900
+ apiKey: string;
901
+ modelName: string;
902
+ openRouterReferer?: string | undefined;
903
+ openRouterTitle?: string | undefined;
904
+ }>;
905
+ type BaseChatModelOptionsType = z.infer<typeof BaseChatModelOptions>;
906
+ declare class BaseChatModel implements ChatModelV1<ChatModelSchemaType> {
907
+ readonly version: "v1";
908
+ modelSchema: ChatModelSchemaType;
909
+ private readonly modelName;
910
+ private readonly apiKey;
911
+ private readonly baseUrl;
912
+ private readonly streamChatUrl;
913
+ private readonly completeChatUrl;
914
+ private readonly openRouterReferer;
915
+ private readonly openRouterTitle;
916
+ constructor(modelSchema: ChatModelSchemaType, options: BaseChatModelOptionsType);
917
+ getDefaultBaseUrl(): UrlType;
918
+ getDefaultHeaders(): HeadersType;
919
+ getDefaultParams(): ParamsType;
920
+ getRetryDelay(responseHeaders: HeadersType): {
921
+ shouldRetry: boolean;
922
+ delayMs: number;
923
+ };
924
+ getTokenCount(messages: MessageType[]): number;
925
+ transformModelRequest(request: OpenRouterChatRequestType): {
926
+ modelName: string | undefined;
927
+ config: ConfigType;
928
+ messages: MessageType[];
929
+ tools: ToolType[] | undefined;
930
+ };
931
+ transformConfig(config: ConfigType, messages?: MessageType[], tools?: ToolType[]): ParamsType;
932
+ transformMessages(messages: MessageType[]): ParamsType;
933
+ transformTools(tools: ToolType[]): ParamsType;
934
+ getCompleteChatUrl(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<UrlType>;
935
+ getCompleteChatHeaders(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<HeadersType>;
936
+ getCompleteChatData(config: ConfigType, messages: MessageType[], tools?: ToolType[]): Promise<ParamsType>;
937
+ transformCompleteChatResponse(response: any): ChatResponseType;
938
+ getStreamChatUrl(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<UrlType>;
939
+ getStreamChatHeaders(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<HeadersType>;
940
+ getStreamChatData(config: ConfigType, messages: MessageType[], tools?: ToolType[]): Promise<ParamsType>;
941
+ transformStreamChatResponseChunk(chunk: string, buffer: string): AsyncGenerator<{
942
+ partialResponse: PartialChatResponseType;
943
+ buffer: string;
944
+ }>;
945
+ }
946
+
947
+ declare const BaseChatModelSchema: {
948
+ description: string;
949
+ name: string;
950
+ roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
951
+ modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
952
+ maxInputTokens: number;
953
+ maxOutputTokens: number;
954
+ config: {
955
+ def: Record<string, {
956
+ type: "multi-string";
957
+ param: string;
958
+ title: string;
959
+ description: string;
960
+ max: number;
961
+ } | {
962
+ type: "range";
963
+ param: string;
964
+ title: string;
965
+ description: string;
966
+ max: number;
967
+ min: number;
968
+ step: number;
969
+ default: number;
970
+ } | {
971
+ type: "select-string";
972
+ param: string;
973
+ title: string;
974
+ description: string;
975
+ default: string | null;
976
+ choices: string[];
977
+ } | {
978
+ type: "object-schema";
979
+ param: string;
980
+ title: string;
981
+ description: string;
982
+ objectSchema?: any;
983
+ } | {
984
+ type: "select-boolean";
985
+ param: string;
986
+ title: string;
987
+ description: string;
988
+ default: boolean | null;
989
+ }>;
990
+ schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
991
+ };
992
+ };
993
+
994
+ declare class OpenRouter<O extends Record<string, any> = Record<string, any>> implements ProviderV1<O> {
995
+ readonly version: "v1";
996
+ readonly name = "open-router";
997
+ static readonly baseUrl = "https://openrouter.ai/api/v1";
998
+ chatModelLiterals(): string[];
999
+ chatModel(name: string, options: O): ChatModelV1;
1000
+ chatModelSchema(name: string): ChatModelSchemaType;
1001
+ chatModelSchemas(): Record<string, ChatModelSchemaType>;
1002
+ embeddingModelLiterals(): string[];
1003
+ embeddingModel(name: string, options: O): EmbeddingModelV1;
1004
+ embeddingModelSchema(name: string): EmbeddingModelSchemaType;
1005
+ embeddingModelSchemas(): Record<string, EmbeddingModelSchemaType>;
1006
+ }
1007
+
1008
+ export { BaseChatModel, type BaseChatModelOptionsType, BaseChatModelSchema, ChatModelBaseConfigDef, ChatModelBaseConfigSchema, OpenRouter, OpenRouterChatModelConfigs, frequencyPenalty, logProbs, maxTokens, minP, presencePenalty, repetitionPenalty, responseFormat, seed, stop, temperature, toolChoice, topA, topK, topLogProbs, topP };