@broberg/ai-sdk 0.5.1 → 0.7.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.
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { z } from 'zod';
5
5
  type Transport = "http" | "subprocess";
6
6
  /** Named capability tier. Resolves to a (provider, model, transport) triple via
7
7
  * the tier map, overridable per call. */
8
- type Tier = "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding";
8
+ type Tier = "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding";
9
9
  /** The concrete routing target a Tier (or a per-call override) resolves to. */
10
10
  interface TierSpec {
11
11
  provider: string;
@@ -13,7 +13,7 @@ interface TierSpec {
13
13
  transport: Transport;
14
14
  }
15
15
  /** High-level capability a call exercises. Mirrors the capability layer (F5). */
16
- type Capability = "chat" | "vision" | "translate" | "image" | "embedding" | "transcribe" | "mockup" | "design" | "extract" | "classify" | "rerank";
16
+ type Capability = "chat" | "vision" | "video" | "translate" | "image" | "embedding" | "transcribe" | "ocr" | "moderation" | "mockup" | "design" | "extract" | "classify" | "rerank";
17
17
  type Role = "system" | "user" | "assistant" | "tool";
18
18
  /** A piece of message content. Text everywhere; image parts feed vision. */
19
19
  type ContentPart = {
@@ -23,6 +23,10 @@ type ContentPart = {
23
23
  type: "image";
24
24
  image: string | Uint8Array;
25
25
  mimeType?: string;
26
+ } | {
27
+ type: "video";
28
+ video: string | Uint8Array;
29
+ mimeType?: string;
26
30
  };
27
31
  interface Message {
28
32
  role: Role;
@@ -176,6 +180,34 @@ interface TranscribeResult {
176
180
  text: string;
177
181
  usage: Usage;
178
182
  }
183
+ interface OcrRequest {
184
+ /** A URL, data-URL, or raw bytes of the document/image. */
185
+ document: string | Uint8Array;
186
+ mimeType?: string;
187
+ spec: TierSpec;
188
+ }
189
+ interface OcrPage {
190
+ index: number;
191
+ markdown: string;
192
+ }
193
+ interface OcrResult {
194
+ pages: OcrPage[];
195
+ usage: Usage;
196
+ }
197
+ interface ModerationRequest {
198
+ input: string[];
199
+ spec: TierSpec;
200
+ }
201
+ interface ModerationItem {
202
+ /** True if any category tripped. */
203
+ flagged: boolean;
204
+ categories: Record<string, boolean>;
205
+ categoryScores: Record<string, number>;
206
+ }
207
+ interface ModerationResult {
208
+ results: ModerationItem[];
209
+ usage: Usage;
210
+ }
179
211
  /** The thin contract every provider implements (F4). A provider need only
180
212
  * support the capabilities it offers — `chat` is the baseline; vision/image/
181
213
  * embedding are optional and absence is a typed capability gap. */
@@ -192,6 +224,8 @@ interface ProviderAdapter {
192
224
  image?(req: ImageRequest): Promise<ImageResult>;
193
225
  embedding?(req: EmbeddingRequest): Promise<EmbeddingResult>;
194
226
  transcribe?(req: TranscribeRequest): Promise<TranscribeResult>;
227
+ ocr?(req: OcrRequest): Promise<OcrResult>;
228
+ moderate?(req: ModerationRequest): Promise<ModerationResult>;
195
229
  }
196
230
  interface TranslateResult {
197
231
  text: string;
@@ -361,7 +395,7 @@ declare const messageSchema: z.ZodObject<{
361
395
  toolCallId?: string | undefined;
362
396
  }>;
363
397
  declare const chatInputSchema: z.ZodObject<{
364
- tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>>;
398
+ tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
365
399
  override: z.ZodOptional<z.ZodObject<{
366
400
  provider: z.ZodOptional<z.ZodString>;
367
401
  model: z.ZodOptional<z.ZodString>;
@@ -375,7 +409,7 @@ declare const chatInputSchema: z.ZodObject<{
375
409
  model?: string | undefined;
376
410
  transport?: "http" | "subprocess" | undefined;
377
411
  }>>;
378
- fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>, z.ZodObject<{
412
+ fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
379
413
  provider: z.ZodString;
380
414
  model: z.ZodString;
381
415
  transport: z.ZodEnum<["http", "subprocess"]>;
@@ -508,13 +542,13 @@ declare const chatInputSchema: z.ZodObject<{
508
542
  temperature?: number | undefined;
509
543
  maxTokens?: number | undefined;
510
544
  responseFormat?: "text" | "json" | undefined;
511
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
545
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
512
546
  override?: {
513
547
  provider?: string | undefined;
514
548
  model?: string | undefined;
515
549
  transport?: "http" | "subprocess" | undefined;
516
550
  } | undefined;
517
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
551
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
518
552
  provider: string;
519
553
  model: string;
520
554
  transport: "http" | "subprocess";
@@ -549,13 +583,13 @@ declare const chatInputSchema: z.ZodObject<{
549
583
  temperature?: number | undefined;
550
584
  maxTokens?: number | undefined;
551
585
  responseFormat?: "text" | "json" | undefined;
552
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
586
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
553
587
  override?: {
554
588
  provider?: string | undefined;
555
589
  model?: string | undefined;
556
590
  transport?: "http" | "subprocess" | undefined;
557
591
  } | undefined;
558
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
592
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
559
593
  provider: string;
560
594
  model: string;
561
595
  transport: "http" | "subprocess";
@@ -564,7 +598,7 @@ declare const chatInputSchema: z.ZodObject<{
564
598
  labels?: Record<string, string> | undefined;
565
599
  }>;
566
600
  declare const visionInputSchema: z.ZodObject<{
567
- tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>>;
601
+ tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
568
602
  override: z.ZodOptional<z.ZodObject<{
569
603
  provider: z.ZodOptional<z.ZodString>;
570
604
  model: z.ZodOptional<z.ZodString>;
@@ -578,7 +612,7 @@ declare const visionInputSchema: z.ZodObject<{
578
612
  model?: string | undefined;
579
613
  transport?: "http" | "subprocess" | undefined;
580
614
  }>>;
581
- fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>, z.ZodObject<{
615
+ fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
582
616
  provider: z.ZodString;
583
617
  model: z.ZodString;
584
618
  transport: z.ZodEnum<["http", "subprocess"]>;
@@ -600,13 +634,13 @@ declare const visionInputSchema: z.ZodObject<{
600
634
  image: string | Uint8Array<ArrayBuffer>;
601
635
  prompt: string;
602
636
  mimeType?: string | undefined;
603
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
637
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
604
638
  override?: {
605
639
  provider?: string | undefined;
606
640
  model?: string | undefined;
607
641
  transport?: "http" | "subprocess" | undefined;
608
642
  } | undefined;
609
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
643
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
610
644
  provider: string;
611
645
  model: string;
612
646
  transport: "http" | "subprocess";
@@ -617,13 +651,81 @@ declare const visionInputSchema: z.ZodObject<{
617
651
  image: string | Uint8Array<ArrayBuffer>;
618
652
  prompt: string;
619
653
  mimeType?: string | undefined;
620
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
654
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
655
+ override?: {
656
+ provider?: string | undefined;
657
+ model?: string | undefined;
658
+ transport?: "http" | "subprocess" | undefined;
659
+ } | undefined;
660
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
661
+ provider: string;
662
+ model: string;
663
+ transport: "http" | "subprocess";
664
+ })[] | undefined;
665
+ purpose?: string | undefined;
666
+ labels?: Record<string, string> | undefined;
667
+ }>;
668
+ declare const videoInputSchema: z.ZodObject<{
669
+ tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
670
+ override: z.ZodOptional<z.ZodObject<{
671
+ provider: z.ZodOptional<z.ZodString>;
672
+ model: z.ZodOptional<z.ZodString>;
673
+ transport: z.ZodOptional<z.ZodEnum<["http", "subprocess"]>>;
674
+ }, "strip", z.ZodTypeAny, {
675
+ provider?: string | undefined;
676
+ model?: string | undefined;
677
+ transport?: "http" | "subprocess" | undefined;
678
+ }, {
679
+ provider?: string | undefined;
680
+ model?: string | undefined;
681
+ transport?: "http" | "subprocess" | undefined;
682
+ }>>;
683
+ fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
684
+ provider: z.ZodString;
685
+ model: z.ZodString;
686
+ transport: z.ZodEnum<["http", "subprocess"]>;
687
+ }, "strip", z.ZodTypeAny, {
688
+ provider: string;
689
+ model: string;
690
+ transport: "http" | "subprocess";
691
+ }, {
692
+ provider: string;
693
+ model: string;
694
+ transport: "http" | "subprocess";
695
+ }>]>, "many">>;
696
+ purpose: z.ZodOptional<z.ZodString>;
697
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
698
+ video: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>;
699
+ prompt: z.ZodString;
700
+ mimeType: z.ZodOptional<z.ZodString>;
701
+ }, "strip", z.ZodTypeAny, {
702
+ video: string | Uint8Array<ArrayBuffer>;
703
+ prompt: string;
704
+ mimeType?: string | undefined;
705
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
706
+ override?: {
707
+ provider?: string | undefined;
708
+ model?: string | undefined;
709
+ transport?: "http" | "subprocess" | undefined;
710
+ } | undefined;
711
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
712
+ provider: string;
713
+ model: string;
714
+ transport: "http" | "subprocess";
715
+ })[] | undefined;
716
+ purpose?: string | undefined;
717
+ labels?: Record<string, string> | undefined;
718
+ }, {
719
+ video: string | Uint8Array<ArrayBuffer>;
720
+ prompt: string;
721
+ mimeType?: string | undefined;
722
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
621
723
  override?: {
622
724
  provider?: string | undefined;
623
725
  model?: string | undefined;
624
726
  transport?: "http" | "subprocess" | undefined;
625
727
  } | undefined;
626
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
728
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
627
729
  provider: string;
628
730
  model: string;
629
731
  transport: "http" | "subprocess";
@@ -632,7 +734,7 @@ declare const visionInputSchema: z.ZodObject<{
632
734
  labels?: Record<string, string> | undefined;
633
735
  }>;
634
736
  declare const translateInputSchema: z.ZodObject<{
635
- tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>>;
737
+ tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
636
738
  override: z.ZodOptional<z.ZodObject<{
637
739
  provider: z.ZodOptional<z.ZodString>;
638
740
  model: z.ZodOptional<z.ZodString>;
@@ -646,7 +748,7 @@ declare const translateInputSchema: z.ZodObject<{
646
748
  model?: string | undefined;
647
749
  transport?: "http" | "subprocess" | undefined;
648
750
  }>>;
649
- fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>, z.ZodObject<{
751
+ fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
650
752
  provider: z.ZodString;
651
753
  model: z.ZodString;
652
754
  transport: z.ZodEnum<["http", "subprocess"]>;
@@ -667,13 +769,13 @@ declare const translateInputSchema: z.ZodObject<{
667
769
  }, "strip", z.ZodTypeAny, {
668
770
  text: string;
669
771
  to: string;
670
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
772
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
671
773
  override?: {
672
774
  provider?: string | undefined;
673
775
  model?: string | undefined;
674
776
  transport?: "http" | "subprocess" | undefined;
675
777
  } | undefined;
676
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
778
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
677
779
  provider: string;
678
780
  model: string;
679
781
  transport: "http" | "subprocess";
@@ -684,13 +786,13 @@ declare const translateInputSchema: z.ZodObject<{
684
786
  }, {
685
787
  text: string;
686
788
  to: string;
687
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
789
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
688
790
  override?: {
689
791
  provider?: string | undefined;
690
792
  model?: string | undefined;
691
793
  transport?: "http" | "subprocess" | undefined;
692
794
  } | undefined;
693
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
795
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
694
796
  provider: string;
695
797
  model: string;
696
798
  transport: "http" | "subprocess";
@@ -700,7 +802,7 @@ declare const translateInputSchema: z.ZodObject<{
700
802
  from?: string | undefined;
701
803
  }>;
702
804
  declare const imageInputSchema: z.ZodObject<{
703
- tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>>;
805
+ tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
704
806
  override: z.ZodOptional<z.ZodObject<{
705
807
  provider: z.ZodOptional<z.ZodString>;
706
808
  model: z.ZodOptional<z.ZodString>;
@@ -714,7 +816,7 @@ declare const imageInputSchema: z.ZodObject<{
714
816
  model?: string | undefined;
715
817
  transport?: "http" | "subprocess" | undefined;
716
818
  }>>;
717
- fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>, z.ZodObject<{
819
+ fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
718
820
  provider: z.ZodString;
719
821
  model: z.ZodString;
720
822
  transport: z.ZodEnum<["http", "subprocess"]>;
@@ -734,13 +836,13 @@ declare const imageInputSchema: z.ZodObject<{
734
836
  height: z.ZodOptional<z.ZodNumber>;
735
837
  }, "strip", z.ZodTypeAny, {
736
838
  prompt: string;
737
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
839
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
738
840
  override?: {
739
841
  provider?: string | undefined;
740
842
  model?: string | undefined;
741
843
  transport?: "http" | "subprocess" | undefined;
742
844
  } | undefined;
743
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
845
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
744
846
  provider: string;
745
847
  model: string;
746
848
  transport: "http" | "subprocess";
@@ -751,13 +853,13 @@ declare const imageInputSchema: z.ZodObject<{
751
853
  height?: number | undefined;
752
854
  }, {
753
855
  prompt: string;
754
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
856
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
755
857
  override?: {
756
858
  provider?: string | undefined;
757
859
  model?: string | undefined;
758
860
  transport?: "http" | "subprocess" | undefined;
759
861
  } | undefined;
760
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
862
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
761
863
  provider: string;
762
864
  model: string;
763
865
  transport: "http" | "subprocess";
@@ -768,7 +870,7 @@ declare const imageInputSchema: z.ZodObject<{
768
870
  height?: number | undefined;
769
871
  }>;
770
872
  declare const embeddingInputSchema: z.ZodObject<{
771
- tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>>;
873
+ tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
772
874
  override: z.ZodOptional<z.ZodObject<{
773
875
  provider: z.ZodOptional<z.ZodString>;
774
876
  model: z.ZodOptional<z.ZodString>;
@@ -782,7 +884,7 @@ declare const embeddingInputSchema: z.ZodObject<{
782
884
  model?: string | undefined;
783
885
  transport?: "http" | "subprocess" | undefined;
784
886
  }>>;
785
- fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>, z.ZodObject<{
887
+ fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
786
888
  provider: z.ZodString;
787
889
  model: z.ZodString;
788
890
  transport: z.ZodEnum<["http", "subprocess"]>;
@@ -800,13 +902,13 @@ declare const embeddingInputSchema: z.ZodObject<{
800
902
  text: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
801
903
  }, "strip", z.ZodTypeAny, {
802
904
  text: string | string[];
803
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
905
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
804
906
  override?: {
805
907
  provider?: string | undefined;
806
908
  model?: string | undefined;
807
909
  transport?: "http" | "subprocess" | undefined;
808
910
  } | undefined;
809
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
911
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
810
912
  provider: string;
811
913
  model: string;
812
914
  transport: "http" | "subprocess";
@@ -815,13 +917,13 @@ declare const embeddingInputSchema: z.ZodObject<{
815
917
  labels?: Record<string, string> | undefined;
816
918
  }, {
817
919
  text: string | string[];
818
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
920
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
819
921
  override?: {
820
922
  provider?: string | undefined;
821
923
  model?: string | undefined;
822
924
  transport?: "http" | "subprocess" | undefined;
823
925
  } | undefined;
824
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
926
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
825
927
  provider: string;
826
928
  model: string;
827
929
  transport: "http" | "subprocess";
@@ -830,7 +932,7 @@ declare const embeddingInputSchema: z.ZodObject<{
830
932
  labels?: Record<string, string> | undefined;
831
933
  }>;
832
934
  declare const transcribeInputSchema: z.ZodObject<{
833
- tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>>;
935
+ tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
834
936
  override: z.ZodOptional<z.ZodObject<{
835
937
  provider: z.ZodOptional<z.ZodString>;
836
938
  model: z.ZodOptional<z.ZodString>;
@@ -844,7 +946,7 @@ declare const transcribeInputSchema: z.ZodObject<{
844
946
  model?: string | undefined;
845
947
  transport?: "http" | "subprocess" | undefined;
846
948
  }>>;
847
- fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>, z.ZodObject<{
949
+ fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
848
950
  provider: z.ZodString;
849
951
  model: z.ZodString;
850
952
  transport: z.ZodEnum<["http", "subprocess"]>;
@@ -867,13 +969,13 @@ declare const transcribeInputSchema: z.ZodObject<{
867
969
  }, "strip", z.ZodTypeAny, {
868
970
  audio: string | Uint8Array<ArrayBuffer>;
869
971
  language?: string | undefined;
870
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
972
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
871
973
  override?: {
872
974
  provider?: string | undefined;
873
975
  model?: string | undefined;
874
976
  transport?: "http" | "subprocess" | undefined;
875
977
  } | undefined;
876
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
978
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
877
979
  provider: string;
878
980
  model: string;
879
981
  transport: "http" | "subprocess";
@@ -884,13 +986,13 @@ declare const transcribeInputSchema: z.ZodObject<{
884
986
  }, {
885
987
  audio: string | Uint8Array<ArrayBuffer>;
886
988
  language?: string | undefined;
887
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | undefined;
989
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
888
990
  override?: {
889
991
  provider?: string | undefined;
890
992
  model?: string | undefined;
891
993
  transport?: "http" | "subprocess" | undefined;
892
994
  } | undefined;
893
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding" | {
995
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
894
996
  provider: string;
895
997
  model: string;
896
998
  transport: "http" | "subprocess";
@@ -899,8 +1001,137 @@ declare const transcribeInputSchema: z.ZodObject<{
899
1001
  labels?: Record<string, string> | undefined;
900
1002
  durationSec?: number | undefined;
901
1003
  }>;
1004
+ declare const ocrInputSchema: z.ZodObject<{
1005
+ tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
1006
+ override: z.ZodOptional<z.ZodObject<{
1007
+ provider: z.ZodOptional<z.ZodString>;
1008
+ model: z.ZodOptional<z.ZodString>;
1009
+ transport: z.ZodOptional<z.ZodEnum<["http", "subprocess"]>>;
1010
+ }, "strip", z.ZodTypeAny, {
1011
+ provider?: string | undefined;
1012
+ model?: string | undefined;
1013
+ transport?: "http" | "subprocess" | undefined;
1014
+ }, {
1015
+ provider?: string | undefined;
1016
+ model?: string | undefined;
1017
+ transport?: "http" | "subprocess" | undefined;
1018
+ }>>;
1019
+ fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
1020
+ provider: z.ZodString;
1021
+ model: z.ZodString;
1022
+ transport: z.ZodEnum<["http", "subprocess"]>;
1023
+ }, "strip", z.ZodTypeAny, {
1024
+ provider: string;
1025
+ model: string;
1026
+ transport: "http" | "subprocess";
1027
+ }, {
1028
+ provider: string;
1029
+ model: string;
1030
+ transport: "http" | "subprocess";
1031
+ }>]>, "many">>;
1032
+ purpose: z.ZodOptional<z.ZodString>;
1033
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1034
+ /** A URL, data-URL, or raw bytes of the document/image. */
1035
+ document: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>;
1036
+ /** image/* → routed as an image; anything else → a document (PDF etc.). */
1037
+ mimeType: z.ZodOptional<z.ZodString>;
1038
+ }, "strip", z.ZodTypeAny, {
1039
+ document: string | Uint8Array<ArrayBuffer>;
1040
+ mimeType?: string | undefined;
1041
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1042
+ override?: {
1043
+ provider?: string | undefined;
1044
+ model?: string | undefined;
1045
+ transport?: "http" | "subprocess" | undefined;
1046
+ } | undefined;
1047
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1048
+ provider: string;
1049
+ model: string;
1050
+ transport: "http" | "subprocess";
1051
+ })[] | undefined;
1052
+ purpose?: string | undefined;
1053
+ labels?: Record<string, string> | undefined;
1054
+ }, {
1055
+ document: string | Uint8Array<ArrayBuffer>;
1056
+ mimeType?: string | undefined;
1057
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1058
+ override?: {
1059
+ provider?: string | undefined;
1060
+ model?: string | undefined;
1061
+ transport?: "http" | "subprocess" | undefined;
1062
+ } | undefined;
1063
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1064
+ provider: string;
1065
+ model: string;
1066
+ transport: "http" | "subprocess";
1067
+ })[] | undefined;
1068
+ purpose?: string | undefined;
1069
+ labels?: Record<string, string> | undefined;
1070
+ }>;
1071
+ declare const moderationInputSchema: z.ZodObject<{
1072
+ tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
1073
+ override: z.ZodOptional<z.ZodObject<{
1074
+ provider: z.ZodOptional<z.ZodString>;
1075
+ model: z.ZodOptional<z.ZodString>;
1076
+ transport: z.ZodOptional<z.ZodEnum<["http", "subprocess"]>>;
1077
+ }, "strip", z.ZodTypeAny, {
1078
+ provider?: string | undefined;
1079
+ model?: string | undefined;
1080
+ transport?: "http" | "subprocess" | undefined;
1081
+ }, {
1082
+ provider?: string | undefined;
1083
+ model?: string | undefined;
1084
+ transport?: "http" | "subprocess" | undefined;
1085
+ }>>;
1086
+ fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
1087
+ provider: z.ZodString;
1088
+ model: z.ZodString;
1089
+ transport: z.ZodEnum<["http", "subprocess"]>;
1090
+ }, "strip", z.ZodTypeAny, {
1091
+ provider: string;
1092
+ model: string;
1093
+ transport: "http" | "subprocess";
1094
+ }, {
1095
+ provider: string;
1096
+ model: string;
1097
+ transport: "http" | "subprocess";
1098
+ }>]>, "many">>;
1099
+ purpose: z.ZodOptional<z.ZodString>;
1100
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1101
+ input: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
1102
+ }, "strip", z.ZodTypeAny, {
1103
+ input: string | string[];
1104
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1105
+ override?: {
1106
+ provider?: string | undefined;
1107
+ model?: string | undefined;
1108
+ transport?: "http" | "subprocess" | undefined;
1109
+ } | undefined;
1110
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1111
+ provider: string;
1112
+ model: string;
1113
+ transport: "http" | "subprocess";
1114
+ })[] | undefined;
1115
+ purpose?: string | undefined;
1116
+ labels?: Record<string, string> | undefined;
1117
+ }, {
1118
+ input: string | string[];
1119
+ tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1120
+ override?: {
1121
+ provider?: string | undefined;
1122
+ model?: string | undefined;
1123
+ transport?: "http" | "subprocess" | undefined;
1124
+ } | undefined;
1125
+ fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1126
+ provider: string;
1127
+ model: string;
1128
+ transport: "http" | "subprocess";
1129
+ })[] | undefined;
1130
+ purpose?: string | undefined;
1131
+ labels?: Record<string, string> | undefined;
1132
+ }>;
902
1133
  declare const aiConfigSchema: z.ZodObject<{
903
- defaults: z.ZodOptional<z.ZodRecord<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "embedding"]>, z.ZodObject<{
1134
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
904
1135
  provider: z.ZodString;
905
1136
  model: z.ZodString;
906
1137
  transport: z.ZodEnum<["http", "subprocess"]>;
@@ -926,7 +1157,7 @@ declare const aiConfigSchema: z.ZodObject<{
926
1157
  rollingUsd?: number | undefined;
927
1158
  }>>;
928
1159
  }, "strip", z.ZodTypeAny, {
929
- defaults?: Partial<Record<"fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding", {
1160
+ defaults?: Partial<Record<"fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding", {
930
1161
  provider: string;
931
1162
  model: string;
932
1163
  transport: "http" | "subprocess";
@@ -938,7 +1169,7 @@ declare const aiConfigSchema: z.ZodObject<{
938
1169
  rollingUsd?: number | undefined;
939
1170
  } | undefined;
940
1171
  }, {
941
- defaults?: Partial<Record<"fast" | "smart" | "powerful" | "cheap" | "vision" | "embedding", {
1172
+ defaults?: Partial<Record<"fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding", {
942
1173
  provider: string;
943
1174
  model: string;
944
1175
  transport: "http" | "subprocess";
@@ -952,10 +1183,13 @@ declare const aiConfigSchema: z.ZodObject<{
952
1183
  }>;
953
1184
  type ChatInput = z.infer<typeof chatInputSchema>;
954
1185
  type VisionInput = z.infer<typeof visionInputSchema>;
1186
+ type VideoInput = z.infer<typeof videoInputSchema>;
955
1187
  type TranslateInput = z.infer<typeof translateInputSchema>;
956
1188
  type ImageInput = z.infer<typeof imageInputSchema>;
957
1189
  type EmbeddingInput = z.infer<typeof embeddingInputSchema>;
958
1190
  type TranscribeInput = z.infer<typeof transcribeInputSchema>;
1191
+ type OcrInput = z.infer<typeof ocrInputSchema>;
1192
+ type ModerationInput = z.infer<typeof moderationInputSchema>;
959
1193
  type AiConfig = z.infer<typeof aiConfigSchema>;
960
1194
  /** The public facade. Defined here because it depends on the derived inputs. */
961
1195
  interface AiClient {
@@ -964,10 +1198,16 @@ interface AiClient {
964
1198
  * caller owns the tool-loop (per-turn engine, not an agent runtime). */
965
1199
  chatStream(input: ChatInput): AsyncIterable<ChatStreamEvent>;
966
1200
  vision(input: VisionInput): Promise<ChatResult>;
1201
+ /** Video Vision (F019) — analyze a video natively. Default tier: "video". */
1202
+ video(input: VideoInput): Promise<ChatResult>;
967
1203
  translate(input: TranslateInput): Promise<TranslateResult>;
968
1204
  image(input: ImageInput): Promise<ImageResult>;
969
1205
  embedding(input: EmbeddingInput): Promise<EmbeddingResult>;
970
1206
  transcribe(input: TranscribeInput): Promise<TranscribeResult>;
1207
+ /** OCR (F016.2) — document/image → structured markdown, billed per page. Mistral. */
1208
+ ocr(input: OcrInput): Promise<OcrResult>;
1209
+ /** Moderation (F016.4) — classify text against safety categories. Mistral. */
1210
+ moderate(input: ModerationInput): Promise<ModerationResult>;
971
1211
  /** Prompt-contract capabilities (F5.5) layered on chat/vision. */
972
1212
  contracts: Contracts;
973
1213
  }
@@ -1016,6 +1256,13 @@ declare function openrouterAdapter(config?: {
1016
1256
  title?: string;
1017
1257
  }): ProviderAdapter;
1018
1258
 
1259
+ declare function mistralAdapter(config?: {
1260
+ apiKey?: string;
1261
+ baseUrl?: string;
1262
+ fetch?: typeof fetch;
1263
+ pricePerPage?: number;
1264
+ }): ProviderAdapter;
1265
+
1019
1266
  interface FalAdapterConfig {
1020
1267
  apiKey?: string;
1021
1268
  /** "sync" (default — fal.run, fast models) or "queue" (queue.fal.run, polled). */
@@ -1063,8 +1310,8 @@ declare const falStubAdapter: ProviderAdapter;
1063
1310
  * wires the live adapters. */
1064
1311
  declare const stubProviders: Record<string, ProviderAdapter>;
1065
1312
 
1066
- declare const VERSION: "0.5.1";
1067
- declare const SDK_TAG: "@broberg/ai-sdk@0.5.1";
1313
+ declare const VERSION: "0.7.0";
1314
+ declare const SDK_TAG: "@broberg/ai-sdk@0.7.0";
1068
1315
 
1069
1316
  /** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
1070
1317
  * per-call override. Model IDs are current at scaffold time; callers pin their
@@ -1257,4 +1504,4 @@ interface StreamTransportRequest extends TransportRequest {
1257
1504
  */
1258
1505
  declare function streamTransport(req: StreamTransportRequest): AsyncIterable<string>;
1259
1506
 
1260
- export { type AiClient, type AiConfig, type BudgetConfig, BudgetExceededError, BudgetGuard, type BudgetStore, type CallOptions, type Capability, type ChatInput, type ChatRequest, type ChatResult, type ChatStreamEvent, type ClassifyInput, type ClassifyResult, type ContentPart, type Contracts, type CostSink, type CostSummary, DEFAULT_TIER_MAP, type DesignInput, type DesignResult, type DiscordSinkConfig, type EmbeddingInput, type EmbeddingRequest, type EmbeddingResult, type ExtractInput, type ExtractResult, type FalAdapterConfig, type HttpResponse, type ImageInput, type ImageRequest, type ImageResult, type Message, type MockupInput, type MockupResult, type OpenAICompatibleConfig, type PricingEntry, type ProviderAdapter, type RerankInput, type RerankResult, type Role, SDK_TAG, type SqliteBudgetStoreConfig, type SqliteSinkConfig, StreamHttpError, type SubprocessResponse, type Tier, type TierSpec, type Tool, type ToolCall, type TranscribeInput, type TranscribeRequest, type TranscribeResult, type TranslateInput, type TranslateResult, type Transport, type TransportRequest, type TransportResponse, type UpmetricsSinkConfig, type Usage, VERSION, type VisionInput, aiConfigSchema, anthropicAdapter, anthropicApiAdapter, anthropicSubprocessAdapter, chatInputSchema, computeCost, createAI, deepinfraAdapter, defaultProviders, discordSink, embeddingInputSchema, falAdapter, falStubAdapter, freshUsage, fromProviderToolCall, geminiAdapter, getCostSummary, getPrice, httpTransport, imageInputSchema, makeContracts, makeOpenAICompatibleAdapter, messageSchema, multiSink, noopSink, openaiAdapter, openaiStubAdapter, openrouterAdapter, parseClaudeCliJson, parseJsonLoose, resolveTier, sqliteBudgetStore, sqliteSink, streamTransport, stubProviders, subprocessTransport, tierSpecSchema, toProviderTools, toolSchema, translateInputSchema, upmetricsSink, visionInputSchema };
1507
+ export { type AiClient, type AiConfig, type BudgetConfig, BudgetExceededError, BudgetGuard, type BudgetStore, type CallOptions, type Capability, type ChatInput, type ChatRequest, type ChatResult, type ChatStreamEvent, type ClassifyInput, type ClassifyResult, type ContentPart, type Contracts, type CostSink, type CostSummary, DEFAULT_TIER_MAP, type DesignInput, type DesignResult, type DiscordSinkConfig, type EmbeddingInput, type EmbeddingRequest, type EmbeddingResult, type ExtractInput, type ExtractResult, type FalAdapterConfig, type HttpResponse, type ImageInput, type ImageRequest, type ImageResult, type Message, type MockupInput, type MockupResult, type ModerationInput, type ModerationItem, type ModerationRequest, type ModerationResult, type OcrInput, type OcrPage, type OcrRequest, type OcrResult, type OpenAICompatibleConfig, type PricingEntry, type ProviderAdapter, type RerankInput, type RerankResult, type Role, SDK_TAG, type SqliteBudgetStoreConfig, type SqliteSinkConfig, StreamHttpError, type SubprocessResponse, type Tier, type TierSpec, type Tool, type ToolCall, type TranscribeInput, type TranscribeRequest, type TranscribeResult, type TranslateInput, type TranslateResult, type Transport, type TransportRequest, type TransportResponse, type UpmetricsSinkConfig, type Usage, VERSION, type VideoInput, type VisionInput, aiConfigSchema, anthropicAdapter, anthropicApiAdapter, anthropicSubprocessAdapter, chatInputSchema, computeCost, createAI, deepinfraAdapter, defaultProviders, discordSink, embeddingInputSchema, falAdapter, falStubAdapter, freshUsage, fromProviderToolCall, geminiAdapter, getCostSummary, getPrice, httpTransport, imageInputSchema, makeContracts, makeOpenAICompatibleAdapter, messageSchema, mistralAdapter, multiSink, noopSink, openaiAdapter, openaiStubAdapter, openrouterAdapter, parseClaudeCliJson, parseJsonLoose, resolveTier, sqliteBudgetStore, sqliteSink, streamTransport, stubProviders, subprocessTransport, tierSpecSchema, toProviderTools, toolSchema, translateInputSchema, upmetricsSink, visionInputSchema };