@opencode/ai 2.1.2 → 2.1.4

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 (140) hide show
  1. package/dist/cache-policy.js +6 -5
  2. package/dist/experimental/evaluation.d.ts +7 -6
  3. package/dist/experimental/evaluation.js +3 -11
  4. package/dist/experimental/realtime.d.ts +59 -0
  5. package/dist/experimental/realtime.js +21 -13
  6. package/dist/experimental.d.ts +1 -1
  7. package/dist/generation.js +1 -1
  8. package/dist/image-client.d.ts +11 -9
  9. package/dist/image.d.ts +158 -150
  10. package/dist/image.js +2 -2
  11. package/dist/llm.d.ts +2 -4
  12. package/dist/llm.js +2 -2
  13. package/dist/media-model.d.ts +2 -2
  14. package/dist/media-model.js +1 -1
  15. package/dist/promise.d.ts +121 -121
  16. package/dist/promise.js +3 -5
  17. package/dist/protocols/alibaba-chat.d.ts +18 -18
  18. package/dist/protocols/alibaba-chat.js +3 -3
  19. package/dist/protocols/alibaba-messages.d.ts +12 -12
  20. package/dist/protocols/alibaba-messages.js +1 -1
  21. package/dist/protocols/alibaba-responses.d.ts +38 -38
  22. package/dist/protocols/anthropic-messages.d.ts +40 -44
  23. package/dist/protocols/anthropic-messages.js +13 -15
  24. package/dist/protocols/bedrock-converse.d.ts +36 -85
  25. package/dist/protocols/bedrock-converse.js +6 -6
  26. package/dist/protocols/bedrock-event-stream.d.ts +6 -1
  27. package/dist/protocols/bedrock-event-stream.js +9 -8
  28. package/dist/protocols/cartesia-speech.d.ts +32 -32
  29. package/dist/protocols/cohere-chat.d.ts +13 -10
  30. package/dist/protocols/cohere-chat.js +2 -2
  31. package/dist/protocols/deepgram-speech.d.ts +32 -32
  32. package/dist/protocols/elevenlabs-speech.d.ts +32 -32
  33. package/dist/protocols/gemini.d.ts +46 -36
  34. package/dist/protocols/gemini.js +12 -15
  35. package/dist/protocols/google-interactions.d.ts +14 -13
  36. package/dist/protocols/google-interactions.js +16 -11
  37. package/dist/protocols/google-speech.d.ts +32 -32
  38. package/dist/protocols/google-transcription.d.ts +32 -32
  39. package/dist/protocols/meta-messages.d.ts +23 -23
  40. package/dist/protocols/meta-responses.d.ts +84 -84
  41. package/dist/protocols/mistral-chat.d.ts +81 -78
  42. package/dist/protocols/mistral-chat.js +3 -5
  43. package/dist/protocols/open-responses-channel.js +47 -46
  44. package/dist/protocols/open-responses-continuation.d.ts +8 -2
  45. package/dist/protocols/open-responses-continuation.js +3 -1
  46. package/dist/protocols/open-responses.d.ts +419 -419
  47. package/dist/protocols/open-responses.js +11 -10
  48. package/dist/protocols/openai-chat.d.ts +68 -67
  49. package/dist/protocols/openai-chat.js +7 -8
  50. package/dist/protocols/openai-compatible-chat.d.ts +13 -14
  51. package/dist/protocols/openai-compatible-responses.d.ts +39 -40
  52. package/dist/protocols/openai-images.d.ts +32 -32
  53. package/dist/protocols/openai-responses.d.ts +253 -253
  54. package/dist/protocols/openai-responses.js +1 -1
  55. package/dist/protocols/openai-speech.d.ts +32 -32
  56. package/dist/protocols/openai-transcription.d.ts +32 -32
  57. package/dist/protocols/openai-transcription.js +12 -7
  58. package/dist/protocols/utils/open-responses-options.d.ts +8 -8
  59. package/dist/protocols/utils/open-responses-options.js +4 -6
  60. package/dist/protocols/utils/partial-json-options.d.ts +0 -1
  61. package/dist/protocols/utils/partial-json-options.js +0 -1
  62. package/dist/protocols/utils/partial-json.js +5 -4
  63. package/dist/protocols/utils/tool-schema.d.ts +0 -3
  64. package/dist/protocols/utils/tool-schema.js +0 -4
  65. package/dist/protocols/utils/tool-stream.d.ts +1 -1
  66. package/dist/protocols/venice-chat.d.ts +52 -53
  67. package/dist/protocols/venice-chat.js +6 -5
  68. package/dist/protocols/xai-images.js +3 -4
  69. package/dist/protocols/xai-responses.d.ts +81 -81
  70. package/dist/protocols/zai-chat.d.ts +33 -30
  71. package/dist/protocols/zai-chat.js +8 -3
  72. package/dist/protocols/zai-messages.d.ts +21 -19
  73. package/dist/protocols/zai-messages.js +3 -2
  74. package/dist/provider-error.js +8 -7
  75. package/dist/providers/alibaba.d.ts +74 -74
  76. package/dist/providers/amazon-bedrock-mantle.d.ts +202 -202
  77. package/dist/providers/amazon-bedrock.d.ts +16 -13
  78. package/dist/providers/anthropic-compatible.d.ts +13 -13
  79. package/dist/providers/anthropic.d.ts +13 -13
  80. package/dist/providers/azure.d.ts +112 -112
  81. package/dist/providers/baseten.d.ts +24 -24
  82. package/dist/providers/cerebras.d.ts +24 -24
  83. package/dist/providers/cloudflare-ai-gateway.d.ts +237 -234
  84. package/dist/providers/cloudflare-ai-gateway.js +3 -6
  85. package/dist/providers/cloudflare-workers-ai.d.ts +24 -24
  86. package/dist/providers/cohere.d.ts +78 -74
  87. package/dist/providers/deepinfra.d.ts +24 -24
  88. package/dist/providers/deepseek.d.ts +24 -24
  89. package/dist/providers/digitalocean.d.ts +36 -36
  90. package/dist/providers/fireworks.d.ts +24 -24
  91. package/dist/providers/google-vertex-chat.d.ts +12 -12
  92. package/dist/providers/google-vertex-interactions.d.ts +3 -3
  93. package/dist/providers/google-vertex-messages.d.ts +20 -20
  94. package/dist/providers/google-vertex-mistral.d.ts +14 -14
  95. package/dist/providers/google-vertex-responses.d.ts +38 -38
  96. package/dist/providers/google-vertex.d.ts +17 -17
  97. package/dist/providers/google-vertex.js +2 -2
  98. package/dist/providers/google.d.ts +79 -79
  99. package/dist/providers/groq.d.ts +24 -24
  100. package/dist/providers/meta.d.ts +189 -189
  101. package/dist/providers/minimax.d.ts +202 -202
  102. package/dist/providers/mistral.d.ts +28 -28
  103. package/dist/providers/moonshot.d.ts +202 -202
  104. package/dist/providers/open-responses-options.d.ts +0 -1
  105. package/dist/providers/open-responses-options.js +1 -1
  106. package/dist/providers/openai-compatible-responses.d.ts +38 -38
  107. package/dist/providers/openai-compatible.d.ts +12 -12
  108. package/dist/providers/openai-compatible.js +1 -1
  109. package/dist/providers/openai-options.d.ts +3 -4
  110. package/dist/providers/openai-options.js +0 -1
  111. package/dist/providers/openai.d.ts +103 -103
  112. package/dist/providers/openrouter.d.ts +171 -112
  113. package/dist/providers/openrouter.js +40 -33
  114. package/dist/providers/togetherai.d.ts +24 -24
  115. package/dist/providers/venice.d.ts +195 -20
  116. package/dist/providers/xai.d.ts +12 -12
  117. package/dist/providers/zai-coding-plan.d.ts +152 -72
  118. package/dist/providers/zai.d.ts +84 -19
  119. package/dist/route/auth-options.d.ts +0 -3
  120. package/dist/route/auth.d.ts +0 -2
  121. package/dist/route/auth.js +0 -2
  122. package/dist/route/client.d.ts +0 -218
  123. package/dist/route/client.js +3 -7
  124. package/dist/route/executor-service.js +1 -1
  125. package/dist/route/transport/http.js +5 -8
  126. package/dist/schema/errors.d.ts +1 -1
  127. package/dist/schema/errors.js +1 -1
  128. package/dist/schema/messages.js +4 -7
  129. package/dist/speech-client.d.ts +11 -9
  130. package/dist/speech.d.ts +158 -150
  131. package/dist/speech.js +2 -2
  132. package/dist/transcription-client.d.ts +11 -9
  133. package/dist/transcription.d.ts +158 -150
  134. package/dist/transcription.js +2 -2
  135. package/dist/video-client.d.ts +11 -9
  136. package/dist/video.d.ts +124 -116
  137. package/dist/video.js +2 -2
  138. package/package.json +7 -6
  139. package/dist/protocols/utils/openai-options.d.ts +0 -16
  140. package/dist/protocols/utils/openai-options.js +0 -15
package/dist/speech.d.ts CHANGED
@@ -13,7 +13,11 @@ export declare class SpeechModel<Options extends SpeechOptions = SpeechOptions>
13
13
  static fromRoute<Options extends SpeechOptions, Frame, State>(route: MediaModel.StreamRouteInput<SpeechRequestFor<Options>, SpeechEvent, Frame, State>, input: MediaRoute.ModelInput): SpeechModel<Options>;
14
14
  static fromRoute<Options extends SpeechOptions, Token>(route: MediaModel.QueuedRouteInput<SpeechRequestFor<Options>, SpeechResponse, Token>, input: MediaRoute.ModelInput): SpeechModel<Options>;
15
15
  }
16
- export declare const SpeechModelSchema: Schema.declare<SpeechModel<MediaModel.Options>, SpeechModel<MediaModel.Options>>;
16
+ export declare const SpeechModelSchema: Schema.declare<SpeechModel<{
17
+ readonly [x: string]: unknown;
18
+ }>, SpeechModel<{
19
+ readonly [x: string]: unknown;
20
+ }>>;
17
21
  /** Provider-native: a name on OpenAI and Gemini, a voice id on ElevenLabs and Cartesia; `{ id }` is an OpenAI custom voice. */
18
22
  export declare const SpeechVoice: Schema.Union<readonly [Schema.String, Schema.Struct<{
19
23
  readonly id: Schema.String;
@@ -28,7 +32,11 @@ export declare const SpeechTimestamp: Schema.Struct<{
28
32
  }>;
29
33
  export type SpeechTimestamp = Schema.Schema.Type<typeof SpeechTimestamp>;
30
34
  declare const SpeechRequest_base: Schema.Class<SpeechRequest, Schema.Struct<{
31
- readonly model: Schema.declare<SpeechModel<MediaModel.Options>, SpeechModel<MediaModel.Options>>;
35
+ readonly model: Schema.declare<SpeechModel<{
36
+ readonly [x: string]: unknown;
37
+ }>, SpeechModel<{
38
+ readonly [x: string]: unknown;
39
+ }>>;
32
40
  readonly text: Schema.String;
33
41
  readonly voice: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Struct<{
34
42
  readonly id: Schema.String;
@@ -432,14 +440,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
432
440
  }>;
433
441
  };
434
442
  readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
435
- readonly type: "generation-queued";
436
- readonly id: string;
437
- readonly position?: number | undefined;
438
- } | {
439
- readonly type: "generation-progress";
440
- readonly id: string;
441
- readonly progress?: number | undefined;
442
- } | {
443
443
  readonly type: "audio-delta";
444
444
  readonly chunk: Uint8Array<ArrayBufferLike>;
445
445
  } | {
@@ -449,18 +449,18 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
449
449
  readonly startSeconds: number;
450
450
  readonly endSeconds: number;
451
451
  }[];
452
+ } | {
453
+ readonly type: "generation-queued";
454
+ readonly id: string;
455
+ readonly position?: number | undefined;
456
+ } | {
457
+ readonly type: "generation-progress";
458
+ readonly id: string;
459
+ readonly progress?: number | undefined;
452
460
  } | {
453
461
  readonly type: "finish";
454
462
  readonly audio: Media.Asset;
455
463
  readonly usage?: {
456
- readonly type: "tokens";
457
- readonly input?: number | undefined;
458
- readonly output?: number | undefined;
459
- readonly total?: number | undefined;
460
- readonly details?: {
461
- readonly [x: string]: unknown;
462
- } | undefined;
463
- } | {
464
464
  readonly type: "seconds";
465
465
  readonly seconds: number;
466
466
  } | {
@@ -472,6 +472,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
472
472
  } | {
473
473
  readonly type: "compute";
474
474
  readonly seconds: number;
475
+ } | {
476
+ readonly type: "tokens";
477
+ readonly input?: number | undefined;
478
+ readonly output?: number | undefined;
479
+ readonly total?: number | undefined;
480
+ readonly details?: {
481
+ readonly [x: string]: unknown;
482
+ } | undefined;
475
483
  } | undefined;
476
484
  readonly notices?: readonly {
477
485
  readonly type: "filtered" | "moderated" | "other";
@@ -488,18 +496,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
488
496
  };
489
497
  } | undefined;
490
498
  }) => value is Extract<{
491
- readonly type: "generation-queued";
492
- readonly id: string;
493
- readonly position?: number | undefined;
494
- }, {
495
- readonly type: Keys;
496
- }> | Extract<{
497
- readonly type: "generation-progress";
498
- readonly id: string;
499
- readonly progress?: number | undefined;
500
- }, {
501
- readonly type: Keys;
502
- }> | Extract<{
503
499
  readonly type: "audio-delta";
504
500
  readonly chunk: Uint8Array<ArrayBufferLike>;
505
501
  }, {
@@ -513,18 +509,22 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
513
509
  }[];
514
510
  }, {
515
511
  readonly type: Keys;
512
+ }> | Extract<{
513
+ readonly type: "generation-queued";
514
+ readonly id: string;
515
+ readonly position?: number | undefined;
516
+ }, {
517
+ readonly type: Keys;
518
+ }> | Extract<{
519
+ readonly type: "generation-progress";
520
+ readonly id: string;
521
+ readonly progress?: number | undefined;
522
+ }, {
523
+ readonly type: Keys;
516
524
  }> | Extract<{
517
525
  readonly type: "finish";
518
526
  readonly audio: Media.Asset;
519
527
  readonly usage?: {
520
- readonly type: "tokens";
521
- readonly input?: number | undefined;
522
- readonly output?: number | undefined;
523
- readonly total?: number | undefined;
524
- readonly details?: {
525
- readonly [x: string]: unknown;
526
- } | undefined;
527
- } | {
528
528
  readonly type: "seconds";
529
529
  readonly seconds: number;
530
530
  } | {
@@ -536,6 +536,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
536
536
  } | {
537
537
  readonly type: "compute";
538
538
  readonly seconds: number;
539
+ } | {
540
+ readonly type: "tokens";
541
+ readonly input?: number | undefined;
542
+ readonly output?: number | undefined;
543
+ readonly total?: number | undefined;
544
+ readonly details?: {
545
+ readonly [x: string]: unknown;
546
+ } | undefined;
539
547
  } | undefined;
540
548
  readonly notices?: readonly {
541
549
  readonly type: "filtered" | "moderated" | "other";
@@ -563,14 +571,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
563
571
  readonly type: "finish";
564
572
  readonly audio: Media.Asset;
565
573
  readonly usage?: {
566
- readonly type: "tokens";
567
- readonly input?: number | undefined;
568
- readonly output?: number | undefined;
569
- readonly total?: number | undefined;
570
- readonly details?: {
571
- readonly [x: string]: unknown;
572
- } | undefined;
573
- } | {
574
574
  readonly type: "seconds";
575
575
  readonly seconds: number;
576
576
  } | {
@@ -582,6 +582,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
582
582
  } | {
583
583
  readonly type: "compute";
584
584
  readonly seconds: number;
585
+ } | {
586
+ readonly type: "tokens";
587
+ readonly input?: number | undefined;
588
+ readonly output?: number | undefined;
589
+ readonly total?: number | undefined;
590
+ readonly details?: {
591
+ readonly [x: string]: unknown;
592
+ } | undefined;
585
593
  } | undefined;
586
594
  readonly notices?: readonly {
587
595
  readonly type: "filtered" | "moderated" | "other";
@@ -695,14 +703,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
695
703
  }>>>;
696
704
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
697
705
  }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(value: {
698
- readonly type: "generation-queued";
699
- readonly id: string;
700
- readonly position?: number | undefined;
701
- } | {
702
- readonly type: "generation-progress";
703
- readonly id: string;
704
- readonly progress?: number | undefined;
705
- } | {
706
706
  readonly type: "audio-delta";
707
707
  readonly chunk: Uint8Array<ArrayBufferLike>;
708
708
  } | {
@@ -712,18 +712,18 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
712
712
  readonly startSeconds: number;
713
713
  readonly endSeconds: number;
714
714
  }[];
715
+ } | {
716
+ readonly type: "generation-queued";
717
+ readonly id: string;
718
+ readonly position?: number | undefined;
719
+ } | {
720
+ readonly type: "generation-progress";
721
+ readonly id: string;
722
+ readonly progress?: number | undefined;
715
723
  } | {
716
724
  readonly type: "finish";
717
725
  readonly audio: Media.Asset;
718
726
  readonly usage?: {
719
- readonly type: "tokens";
720
- readonly input?: number | undefined;
721
- readonly output?: number | undefined;
722
- readonly total?: number | undefined;
723
- readonly details?: {
724
- readonly [x: string]: unknown;
725
- } | undefined;
726
- } | {
727
727
  readonly type: "seconds";
728
728
  readonly seconds: number;
729
729
  } | {
@@ -735,6 +735,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
735
735
  } | {
736
736
  readonly type: "compute";
737
737
  readonly seconds: number;
738
+ } | {
739
+ readonly type: "tokens";
740
+ readonly input?: number | undefined;
741
+ readonly output?: number | undefined;
742
+ readonly total?: number | undefined;
743
+ readonly details?: {
744
+ readonly [x: string]: unknown;
745
+ } | undefined;
738
746
  } | undefined;
739
747
  readonly notices?: readonly {
740
748
  readonly type: "filtered" | "moderated" | "other";
@@ -828,14 +836,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
828
836
  }>>>;
829
837
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
830
838
  }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(cases: Cases): (value: {
831
- readonly type: "generation-queued";
832
- readonly id: string;
833
- readonly position?: number | undefined;
834
- } | {
835
- readonly type: "generation-progress";
836
- readonly id: string;
837
- readonly progress?: number | undefined;
838
- } | {
839
839
  readonly type: "audio-delta";
840
840
  readonly chunk: Uint8Array<ArrayBufferLike>;
841
841
  } | {
@@ -845,18 +845,18 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
845
845
  readonly startSeconds: number;
846
846
  readonly endSeconds: number;
847
847
  }[];
848
+ } | {
849
+ readonly type: "generation-queued";
850
+ readonly id: string;
851
+ readonly position?: number | undefined;
852
+ } | {
853
+ readonly type: "generation-progress";
854
+ readonly id: string;
855
+ readonly progress?: number | undefined;
848
856
  } | {
849
857
  readonly type: "finish";
850
858
  readonly audio: Media.Asset;
851
859
  readonly usage?: {
852
- readonly type: "tokens";
853
- readonly input?: number | undefined;
854
- readonly output?: number | undefined;
855
- readonly total?: number | undefined;
856
- readonly details?: {
857
- readonly [x: string]: unknown;
858
- } | undefined;
859
- } | {
860
860
  readonly type: "seconds";
861
861
  readonly seconds: number;
862
862
  } | {
@@ -868,6 +868,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
868
868
  } | {
869
869
  readonly type: "compute";
870
870
  readonly seconds: number;
871
+ } | {
872
+ readonly type: "tokens";
873
+ readonly input?: number | undefined;
874
+ readonly output?: number | undefined;
875
+ readonly total?: number | undefined;
876
+ readonly details?: {
877
+ readonly [x: string]: unknown;
878
+ } | undefined;
871
879
  } | undefined;
872
880
  readonly notices?: readonly {
873
881
  readonly type: "filtered" | "moderated" | "other";
@@ -963,14 +971,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
963
971
  }>>>;
964
972
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
965
973
  }> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps">]: never; }, OrElse extends (value: Exclude<{
966
- readonly type: "generation-queued";
967
- readonly id: string;
968
- readonly position?: number | undefined;
969
- } | {
970
- readonly type: "generation-progress";
971
- readonly id: string;
972
- readonly progress?: number | undefined;
973
- } | {
974
974
  readonly type: "audio-delta";
975
975
  readonly chunk: Uint8Array<ArrayBufferLike>;
976
976
  } | {
@@ -980,18 +980,18 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
980
980
  readonly startSeconds: number;
981
981
  readonly endSeconds: number;
982
982
  }[];
983
+ } | {
984
+ readonly type: "generation-queued";
985
+ readonly id: string;
986
+ readonly position?: number | undefined;
987
+ } | {
988
+ readonly type: "generation-progress";
989
+ readonly id: string;
990
+ readonly progress?: number | undefined;
983
991
  } | {
984
992
  readonly type: "finish";
985
993
  readonly audio: Media.Asset;
986
994
  readonly usage?: {
987
- readonly type: "tokens";
988
- readonly input?: number | undefined;
989
- readonly output?: number | undefined;
990
- readonly total?: number | undefined;
991
- readonly details?: {
992
- readonly [x: string]: unknown;
993
- } | undefined;
994
- } | {
995
995
  readonly type: "seconds";
996
996
  readonly seconds: number;
997
997
  } | {
@@ -1003,6 +1003,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1003
1003
  } | {
1004
1004
  readonly type: "compute";
1005
1005
  readonly seconds: number;
1006
+ } | {
1007
+ readonly type: "tokens";
1008
+ readonly input?: number | undefined;
1009
+ readonly output?: number | undefined;
1010
+ readonly total?: number | undefined;
1011
+ readonly details?: {
1012
+ readonly [x: string]: unknown;
1013
+ } | undefined;
1006
1014
  } | undefined;
1007
1015
  readonly notices?: readonly {
1008
1016
  readonly type: "filtered" | "moderated" | "other";
@@ -1019,14 +1027,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1019
1027
  };
1020
1028
  } | undefined;
1021
1029
  }, { readonly [K in "type"]: keyof Cases; }>) => any>(value: {
1022
- readonly type: "generation-queued";
1023
- readonly id: string;
1024
- readonly position?: number | undefined;
1025
- } | {
1026
- readonly type: "generation-progress";
1027
- readonly id: string;
1028
- readonly progress?: number | undefined;
1029
- } | {
1030
1030
  readonly type: "audio-delta";
1031
1031
  readonly chunk: Uint8Array<ArrayBufferLike>;
1032
1032
  } | {
@@ -1036,18 +1036,18 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1036
1036
  readonly startSeconds: number;
1037
1037
  readonly endSeconds: number;
1038
1038
  }[];
1039
+ } | {
1040
+ readonly type: "generation-queued";
1041
+ readonly id: string;
1042
+ readonly position?: number | undefined;
1043
+ } | {
1044
+ readonly type: "generation-progress";
1045
+ readonly id: string;
1046
+ readonly progress?: number | undefined;
1039
1047
  } | {
1040
1048
  readonly type: "finish";
1041
1049
  readonly audio: Media.Asset;
1042
1050
  readonly usage?: {
1043
- readonly type: "tokens";
1044
- readonly input?: number | undefined;
1045
- readonly output?: number | undefined;
1046
- readonly total?: number | undefined;
1047
- readonly details?: {
1048
- readonly [x: string]: unknown;
1049
- } | undefined;
1050
- } | {
1051
1051
  readonly type: "seconds";
1052
1052
  readonly seconds: number;
1053
1053
  } | {
@@ -1059,6 +1059,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1059
1059
  } | {
1060
1060
  readonly type: "compute";
1061
1061
  readonly seconds: number;
1062
+ } | {
1063
+ readonly type: "tokens";
1064
+ readonly input?: number | undefined;
1065
+ readonly output?: number | undefined;
1066
+ readonly total?: number | undefined;
1067
+ readonly details?: {
1068
+ readonly [x: string]: unknown;
1069
+ } | undefined;
1062
1070
  } | undefined;
1063
1071
  readonly notices?: readonly {
1064
1072
  readonly type: "filtered" | "moderated" | "other";
@@ -1152,14 +1160,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1152
1160
  }>>>;
1153
1161
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1154
1162
  }> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps">]: never; }, OrElse extends (value: Exclude<{
1155
- readonly type: "generation-queued";
1156
- readonly id: string;
1157
- readonly position?: number | undefined;
1158
- } | {
1159
- readonly type: "generation-progress";
1160
- readonly id: string;
1161
- readonly progress?: number | undefined;
1162
- } | {
1163
1163
  readonly type: "audio-delta";
1164
1164
  readonly chunk: Uint8Array<ArrayBufferLike>;
1165
1165
  } | {
@@ -1169,18 +1169,18 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1169
1169
  readonly startSeconds: number;
1170
1170
  readonly endSeconds: number;
1171
1171
  }[];
1172
+ } | {
1173
+ readonly type: "generation-queued";
1174
+ readonly id: string;
1175
+ readonly position?: number | undefined;
1176
+ } | {
1177
+ readonly type: "generation-progress";
1178
+ readonly id: string;
1179
+ readonly progress?: number | undefined;
1172
1180
  } | {
1173
1181
  readonly type: "finish";
1174
1182
  readonly audio: Media.Asset;
1175
1183
  readonly usage?: {
1176
- readonly type: "tokens";
1177
- readonly input?: number | undefined;
1178
- readonly output?: number | undefined;
1179
- readonly total?: number | undefined;
1180
- readonly details?: {
1181
- readonly [x: string]: unknown;
1182
- } | undefined;
1183
- } | {
1184
1184
  readonly type: "seconds";
1185
1185
  readonly seconds: number;
1186
1186
  } | {
@@ -1192,6 +1192,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1192
1192
  } | {
1193
1193
  readonly type: "compute";
1194
1194
  readonly seconds: number;
1195
+ } | {
1196
+ readonly type: "tokens";
1197
+ readonly input?: number | undefined;
1198
+ readonly output?: number | undefined;
1199
+ readonly total?: number | undefined;
1200
+ readonly details?: {
1201
+ readonly [x: string]: unknown;
1202
+ } | undefined;
1195
1203
  } | undefined;
1196
1204
  readonly notices?: readonly {
1197
1205
  readonly type: "filtered" | "moderated" | "other";
@@ -1208,14 +1216,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1208
1216
  };
1209
1217
  } | undefined;
1210
1218
  }, { readonly [K in "type"]: keyof Cases; }>) => any>(cases: Cases, orElse: OrElse): (value: {
1211
- readonly type: "generation-queued";
1212
- readonly id: string;
1213
- readonly position?: number | undefined;
1214
- } | {
1215
- readonly type: "generation-progress";
1216
- readonly id: string;
1217
- readonly progress?: number | undefined;
1218
- } | {
1219
1219
  readonly type: "audio-delta";
1220
1220
  readonly chunk: Uint8Array<ArrayBufferLike>;
1221
1221
  } | {
@@ -1225,18 +1225,18 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1225
1225
  readonly startSeconds: number;
1226
1226
  readonly endSeconds: number;
1227
1227
  }[];
1228
+ } | {
1229
+ readonly type: "generation-queued";
1230
+ readonly id: string;
1231
+ readonly position?: number | undefined;
1232
+ } | {
1233
+ readonly type: "generation-progress";
1234
+ readonly id: string;
1235
+ readonly progress?: number | undefined;
1228
1236
  } | {
1229
1237
  readonly type: "finish";
1230
1238
  readonly audio: Media.Asset;
1231
1239
  readonly usage?: {
1232
- readonly type: "tokens";
1233
- readonly input?: number | undefined;
1234
- readonly output?: number | undefined;
1235
- readonly total?: number | undefined;
1236
- readonly details?: {
1237
- readonly [x: string]: unknown;
1238
- } | undefined;
1239
- } | {
1240
1240
  readonly type: "seconds";
1241
1241
  readonly seconds: number;
1242
1242
  } | {
@@ -1248,6 +1248,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1248
1248
  } | {
1249
1249
  readonly type: "compute";
1250
1250
  readonly seconds: number;
1251
+ } | {
1252
+ readonly type: "tokens";
1253
+ readonly input?: number | undefined;
1254
+ readonly output?: number | undefined;
1255
+ readonly total?: number | undefined;
1256
+ readonly details?: {
1257
+ readonly [x: string]: unknown;
1258
+ } | undefined;
1251
1259
  } | undefined;
1252
1260
  readonly notices?: readonly {
1253
1261
  readonly type: "filtered" | "moderated" | "other";
@@ -1293,14 +1301,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1293
1301
  readonly type: "finish";
1294
1302
  readonly audio: Media.Asset;
1295
1303
  readonly usage?: {
1296
- readonly type: "tokens";
1297
- readonly input?: number | undefined;
1298
- readonly output?: number | undefined;
1299
- readonly total?: number | undefined;
1300
- readonly details?: {
1301
- readonly [x: string]: unknown;
1302
- } | undefined;
1303
- } | {
1304
1304
  readonly type: "seconds";
1305
1305
  readonly seconds: number;
1306
1306
  } | {
@@ -1312,6 +1312,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1312
1312
  } | {
1313
1313
  readonly type: "compute";
1314
1314
  readonly seconds: number;
1315
+ } | {
1316
+ readonly type: "tokens";
1317
+ readonly input?: number | undefined;
1318
+ readonly output?: number | undefined;
1319
+ readonly total?: number | undefined;
1320
+ readonly details?: {
1321
+ readonly [x: string]: unknown;
1322
+ } | undefined;
1315
1323
  } | undefined;
1316
1324
  readonly notices?: readonly {
1317
1325
  readonly type: "filtered" | "moderated" | "other";
package/dist/speech.js CHANGED
@@ -3,7 +3,7 @@ import { ProgressEvent, QueuedEvent } from "./generation.js";
3
3
  import { Media } from "./media.js";
4
4
  import { MediaModel, composeRoute, tryRequest } from "./media-model.js";
5
5
  import { MediaRoute } from "./route/media.js";
6
- import { AIError, HttpOptions, MediaUsage, ProviderMetadata } from "./schema/index.js";
6
+ import { AIError, HttpOptions, MediaUsage, ProviderMetadata, ProviderOptions, } from "./schema/index.js";
7
7
  import { SpeechClient, Service } from "./speech-client.js";
8
8
  export class SpeechModel extends MediaModel {
9
9
  static fromRoute(route, input) {
@@ -40,7 +40,7 @@ export class SpeechRequest extends Schema.Class("Speech.Request")({
40
40
  language: Schema.optional(Schema.String),
41
41
  instructions: Schema.optional(Schema.String),
42
42
  timestamps: Schema.optional(Schema.Boolean),
43
- providerOptions: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
43
+ providerOptions: Schema.optional(ProviderOptions),
44
44
  http: Schema.optional(HttpOptions),
45
45
  }) {
46
46
  }
@@ -39,14 +39,6 @@ export declare const TranscriptionClient: {
39
39
  readonly language?: string | undefined;
40
40
  readonly durationSeconds?: number | undefined;
41
41
  readonly usage?: {
42
- readonly type: "tokens";
43
- readonly input?: number | undefined;
44
- readonly output?: number | undefined;
45
- readonly total?: number | undefined;
46
- readonly details?: {
47
- readonly [x: string]: unknown;
48
- } | undefined;
49
- } | {
50
42
  readonly type: "seconds";
51
43
  readonly seconds: number;
52
44
  } | {
@@ -58,6 +50,14 @@ export declare const TranscriptionClient: {
58
50
  } | {
59
51
  readonly type: "compute";
60
52
  readonly seconds: number;
53
+ } | {
54
+ readonly type: "tokens";
55
+ readonly input?: number | undefined;
56
+ readonly output?: number | undefined;
57
+ readonly total?: number | undefined;
58
+ readonly details?: {
59
+ readonly [x: string]: unknown;
60
+ } | undefined;
61
61
  } | undefined;
62
62
  readonly notices?: readonly {
63
63
  readonly type: "filtered" | "moderated" | "other";
@@ -76,7 +76,9 @@ export declare const TranscriptionClient: {
76
76
  readonly type: "finish";
77
77
  } | import("./generation.js").Observation, import("./index.js").AIError, TranscriptionClientService>;
78
78
  readonly start: (request: TranscriptionRequestFor) => import("effect/Effect").Effect<import("./generation.js").Generation<TranscriptionResponse>, import("./index.js").AIError, TranscriptionClientService>;
79
- readonly resume: (model: import("./transcription.js").TranscriptionModel<import("./media-model.js").MediaModel.Options>, token: unknown) => import("effect/Effect").Effect<import("./generation.js").Generation<TranscriptionResponse>, import("./index.js").AIError, TranscriptionClientService>;
79
+ readonly resume: (model: import("./transcription.js").TranscriptionModel<{
80
+ readonly [x: string]: unknown;
81
+ }>, token: unknown) => import("effect/Effect").Effect<import("./generation.js").Generation<TranscriptionResponse>, import("./index.js").AIError, TranscriptionClientService>;
80
82
  readonly Service: typeof TranscriptionClientService;
81
83
  };
82
84
  export {};