@opencode/ai 2.0.15 → 2.0.16

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 (168) hide show
  1. package/README.md +286 -2
  2. package/dist/generation.d.ts +36 -22
  3. package/dist/generation.js +53 -24
  4. package/dist/image-client.d.ts +14 -7
  5. package/dist/image-client.js +24 -8
  6. package/dist/image.d.ts +398 -47
  7. package/dist/image.js +47 -45
  8. package/dist/index.d.ts +13 -1
  9. package/dist/index.js +9 -0
  10. package/dist/media-model.d.ts +44 -0
  11. package/dist/media-model.js +49 -0
  12. package/dist/media.d.ts +10 -9
  13. package/dist/media.js +9 -10
  14. package/dist/promise.d.ts +428 -8
  15. package/dist/promise.js +40 -3
  16. package/dist/protocols/alibaba-chat.d.ts +12 -0
  17. package/dist/protocols/alibaba-responses.d.ts +2 -2
  18. package/dist/protocols/anthropic-messages.js +1 -2
  19. package/dist/protocols/assemblyai-transcription.d.ts +40 -0
  20. package/dist/protocols/assemblyai-transcription.js +138 -0
  21. package/dist/protocols/bedrock-converse.js +5 -11
  22. package/dist/protocols/bfl-images.d.ts +32 -0
  23. package/dist/protocols/bfl-images.js +153 -0
  24. package/dist/protocols/cartesia-speech.d.ts +127 -0
  25. package/dist/protocols/cartesia-speech.js +126 -0
  26. package/dist/protocols/deepgram-speech.d.ts +119 -0
  27. package/dist/protocols/deepgram-speech.js +92 -0
  28. package/dist/protocols/deepgram-transcription.d.ts +25 -0
  29. package/dist/protocols/deepgram-transcription.js +129 -0
  30. package/dist/protocols/elevenlabs-speech.d.ts +122 -0
  31. package/dist/protocols/elevenlabs-speech.js +115 -0
  32. package/dist/protocols/fal-images.d.ts +24 -0
  33. package/dist/protocols/fal-images.js +114 -0
  34. package/dist/protocols/fal-video.d.ts +29 -0
  35. package/dist/protocols/fal-video.js +88 -0
  36. package/dist/protocols/gemini.d.ts +9 -9
  37. package/dist/protocols/gemini.js +8 -34
  38. package/dist/protocols/google-images.js +2 -14
  39. package/dist/protocols/google-speech.d.ts +130 -0
  40. package/dist/protocols/google-speech.js +84 -0
  41. package/dist/protocols/google-transcription.d.ts +173 -0
  42. package/dist/protocols/google-transcription.js +138 -0
  43. package/dist/protocols/google-video.d.ts +26 -0
  44. package/dist/protocols/google-video.js +158 -0
  45. package/dist/protocols/meta-images.js +2 -9
  46. package/dist/protocols/meta-responses.d.ts +4 -4
  47. package/dist/protocols/meta-responses.js +1 -1
  48. package/dist/protocols/open-responses.d.ts +6 -6
  49. package/dist/protocols/open-responses.js +1 -2
  50. package/dist/protocols/openai-chat.d.ts +84 -0
  51. package/dist/protocols/openai-chat.js +26 -14
  52. package/dist/protocols/openai-compatible-chat.d.ts +12 -0
  53. package/dist/protocols/openai-compatible-responses.d.ts +2 -2
  54. package/dist/protocols/openai-images.d.ts +124 -3
  55. package/dist/protocols/openai-images.js +107 -54
  56. package/dist/protocols/openai-responses.d.ts +15 -15
  57. package/dist/protocols/openai-responses.js +5 -6
  58. package/dist/protocols/openai-speech.d.ts +116 -0
  59. package/dist/protocols/openai-speech.js +98 -0
  60. package/dist/protocols/openai-transcription.d.ts +207 -0
  61. package/dist/protocols/openai-transcription.js +190 -0
  62. package/dist/protocols/replicate-images.d.ts +28 -0
  63. package/dist/protocols/replicate-images.js +133 -0
  64. package/dist/protocols/runway-video.d.ts +38 -0
  65. package/dist/protocols/runway-video.js +146 -0
  66. package/dist/protocols/shared.d.ts +13 -3
  67. package/dist/protocols/shared.js +23 -3
  68. package/dist/protocols/stability-images.d.ts +38 -0
  69. package/dist/protocols/stability-images.js +148 -0
  70. package/dist/protocols/utils/fal-queue.d.ts +28 -0
  71. package/dist/protocols/utils/fal-queue.js +69 -0
  72. package/dist/protocols/utils/gemini-generate-content.d.ts +65 -0
  73. package/dist/protocols/utils/gemini-generate-content.js +65 -0
  74. package/dist/protocols/utils/gemini-json-schema.d.ts +3 -0
  75. package/dist/protocols/utils/gemini-json-schema.js +76 -0
  76. package/dist/protocols/utils/media-input.d.ts +8 -0
  77. package/dist/protocols/utils/media-input.js +18 -0
  78. package/dist/protocols/utils/speech-stream.d.ts +49 -0
  79. package/dist/protocols/utils/speech-stream.js +67 -0
  80. package/dist/protocols/utils/tool-schema.d.ts +2 -2
  81. package/dist/protocols/utils/tool-schema.js +40 -17
  82. package/dist/protocols/xai-images.js +1 -12
  83. package/dist/protocols/xai-responses.d.ts +2 -2
  84. package/dist/protocols/xai-video.d.ts +34 -0
  85. package/dist/protocols/xai-video.js +147 -0
  86. package/dist/protocols/zai-chat.d.ts +13 -1
  87. package/dist/provider-error.js +3 -0
  88. package/dist/providers/alibaba.d.ts +14 -2
  89. package/dist/providers/amazon-bedrock-mantle.d.ts +14 -2
  90. package/dist/providers/assemblyai.d.ts +25 -0
  91. package/dist/providers/assemblyai.js +29 -0
  92. package/dist/providers/azure.d.ts +18 -6
  93. package/dist/providers/baseten.d.ts +24 -0
  94. package/dist/providers/black-forest-labs.d.ts +25 -0
  95. package/dist/providers/black-forest-labs.js +28 -0
  96. package/dist/providers/cartesia.d.ts +24 -0
  97. package/dist/providers/cartesia.js +22 -0
  98. package/dist/providers/cerebras.d.ts +24 -0
  99. package/dist/providers/cloudflare-ai-gateway.d.ts +30 -6
  100. package/dist/providers/cloudflare-workers-ai.d.ts +24 -0
  101. package/dist/providers/deepgram.d.ts +29 -0
  102. package/dist/providers/deepgram.js +31 -0
  103. package/dist/providers/deepinfra.d.ts +24 -0
  104. package/dist/providers/deepseek.d.ts +24 -0
  105. package/dist/providers/elevenlabs.d.ts +24 -0
  106. package/dist/providers/elevenlabs.js +28 -0
  107. package/dist/providers/fal.d.ts +29 -0
  108. package/dist/providers/fal.js +33 -0
  109. package/dist/providers/fireworks.d.ts +24 -0
  110. package/dist/providers/google-vertex-chat.d.ts +12 -0
  111. package/dist/providers/google-vertex-responses.d.ts +2 -2
  112. package/dist/providers/google-vertex.d.ts +3 -3
  113. package/dist/providers/google.d.ts +18 -3
  114. package/dist/providers/google.js +11 -2
  115. package/dist/providers/groq.d.ts +24 -0
  116. package/dist/providers/index.d.ts +9 -0
  117. package/dist/providers/index.js +9 -0
  118. package/dist/providers/meta.d.ts +14 -2
  119. package/dist/providers/minimax.d.ts +14 -2
  120. package/dist/providers/moonshot.d.ts +14 -2
  121. package/dist/providers/moonshot.js +3 -3
  122. package/dist/providers/openai-compatible-responses.d.ts +2 -2
  123. package/dist/providers/openai-compatible.d.ts +12 -0
  124. package/dist/providers/openai.d.ts +25 -3
  125. package/dist/providers/openai.js +10 -1
  126. package/dist/providers/openrouter.d.ts +48 -0
  127. package/dist/providers/replicate.d.ts +25 -0
  128. package/dist/providers/replicate.js +22 -0
  129. package/dist/providers/runway.d.ts +24 -0
  130. package/dist/providers/runway.js +22 -0
  131. package/dist/providers/stability.d.ts +28 -0
  132. package/dist/providers/stability.js +23 -0
  133. package/dist/providers/togetherai.d.ts +24 -0
  134. package/dist/providers/xai.d.ts +17 -0
  135. package/dist/providers/xai.js +5 -2
  136. package/dist/providers/zai-coding-plan.d.ts +15 -3
  137. package/dist/providers/zai.d.ts +13 -1
  138. package/dist/route/auth.d.ts +4 -1
  139. package/dist/route/auth.js +6 -0
  140. package/dist/route/framing.d.ts +5 -1
  141. package/dist/route/framing.js +9 -0
  142. package/dist/route/media-protocol.d.ts +116 -3
  143. package/dist/route/media-protocol.js +60 -4
  144. package/dist/route/media.d.ts +58 -7
  145. package/dist/route/media.js +201 -29
  146. package/dist/schema/events.d.ts +0 -6
  147. package/dist/schema/messages.d.ts +0 -3
  148. package/dist/schema/options.d.ts +4 -3
  149. package/dist/schema/options.js +3 -2
  150. package/dist/speech-client.d.ts +21 -0
  151. package/dist/speech-client.js +25 -0
  152. package/dist/speech.d.ts +1150 -0
  153. package/dist/speech.js +119 -0
  154. package/dist/transcription-client.d.ts +28 -0
  155. package/dist/transcription-client.js +44 -0
  156. package/dist/transcription.d.ts +1504 -0
  157. package/dist/transcription.js +133 -0
  158. package/dist/utils/bytes.d.ts +1 -0
  159. package/dist/utils/bytes.js +10 -0
  160. package/dist/utils/media-type.d.ts +1 -0
  161. package/dist/utils/media-type.js +22 -1
  162. package/dist/video-client.d.ts +28 -0
  163. package/dist/video-client.js +40 -0
  164. package/dist/video.d.ts +1359 -0
  165. package/dist/video.js +119 -0
  166. package/package.json +3 -3
  167. package/dist/protocols/utils/gemini-tool-schema.d.ts +0 -2
  168. package/dist/protocols/utils/gemini-tool-schema.js +0 -103
@@ -370,8 +370,8 @@ export declare const routes: (Route<{
370
370
  } | {
371
371
  readonly type: "input_file";
372
372
  readonly filename: string;
373
- readonly detail?: string | undefined;
374
373
  readonly file_data?: string | undefined;
374
+ readonly detail?: string | undefined;
375
375
  readonly file_url?: string | undefined;
376
376
  } | {
377
377
  readonly type: "input_text";
@@ -407,8 +407,8 @@ export declare const routes: (Route<{
407
407
  } | {
408
408
  readonly type: "input_file";
409
409
  readonly filename: string;
410
- readonly detail?: string | undefined;
411
410
  readonly file_data?: string | undefined;
411
+ readonly detail?: string | undefined;
412
412
  readonly file_url?: string | undefined;
413
413
  } | {
414
414
  readonly type: "input_text";
@@ -484,6 +484,12 @@ export declare const routes: (Route<{
484
484
  readonly image_url: {
485
485
  readonly url: string;
486
486
  };
487
+ } | {
488
+ readonly type: "file";
489
+ readonly file: {
490
+ readonly filename: string;
491
+ readonly file_data: string;
492
+ };
487
493
  })[];
488
494
  } | {
489
495
  readonly role: "user";
@@ -499,6 +505,12 @@ export declare const routes: (Route<{
499
505
  readonly image_url: {
500
506
  readonly url: string;
501
507
  };
508
+ } | {
509
+ readonly type: "file";
510
+ readonly file: {
511
+ readonly filename: string;
512
+ readonly file_data: string;
513
+ };
502
514
  })[];
503
515
  } | {
504
516
  readonly [x: string]: unknown;
@@ -64,17 +64,17 @@ export const configure = (input = {}) => {
64
64
  supportsStore: false,
65
65
  supportsStrictMode: false,
66
66
  supportsPromptCacheKey: true,
67
- toolSchema: "moonshot",
67
+ sanitizer: "moonshot",
68
68
  reasoningField: "reasoning_content",
69
69
  },
70
70
  });
71
71
  const messages = (modelID) => messagesRoute.with(defaults).model({
72
72
  id: modelID,
73
- compatibility: { requireSignature: false, toolSchema: "moonshot" },
73
+ compatibility: { requireSignature: false, sanitizer: "moonshot" },
74
74
  });
75
75
  const responses = (modelID) => responsesRoute
76
76
  .with(defaults)
77
- .model({ id: modelID, compatibility: { toolSchema: "moonshot" } });
77
+ .model({ id: modelID, compatibility: { sanitizer: "moonshot" } });
78
78
  return { id, model: chat, chat, messages, responses, configure };
79
79
  };
80
80
  export const provider = configure();
@@ -82,8 +82,8 @@ export declare const routes: import("../route/client.js").Route<{
82
82
  } | {
83
83
  readonly type: "input_file";
84
84
  readonly filename: string;
85
- readonly detail?: string | undefined;
86
85
  readonly file_data?: string | undefined;
86
+ readonly detail?: string | undefined;
87
87
  readonly file_url?: string | undefined;
88
88
  } | {
89
89
  readonly type: "input_text";
@@ -119,8 +119,8 @@ export declare const routes: import("../route/client.js").Route<{
119
119
  } | {
120
120
  readonly type: "input_file";
121
121
  readonly filename: string;
122
- readonly detail?: string | undefined;
123
122
  readonly file_data?: string | undefined;
123
+ readonly detail?: string | undefined;
124
124
  readonly file_url?: string | undefined;
125
125
  } | {
126
126
  readonly type: "input_text";
@@ -30,6 +30,12 @@ export declare const routes: import("../route/client.js").Route<{
30
30
  readonly image_url: {
31
31
  readonly url: string;
32
32
  };
33
+ } | {
34
+ readonly type: "file";
35
+ readonly file: {
36
+ readonly filename: string;
37
+ readonly file_data: string;
38
+ };
33
39
  })[];
34
40
  } | {
35
41
  readonly role: "user";
@@ -45,6 +51,12 @@ export declare const routes: import("../route/client.js").Route<{
45
51
  readonly image_url: {
46
52
  readonly url: string;
47
53
  };
54
+ } | {
55
+ readonly type: "file";
56
+ readonly file: {
57
+ readonly filename: string;
58
+ readonly file_data: string;
59
+ };
48
60
  })[];
49
61
  } | {
50
62
  readonly [x: string]: unknown;
@@ -7,6 +7,8 @@ import { type OpenAIProviderOptionsInput } from "./openai-options.js";
7
7
  import { type OpenAIImageString } from "../protocols/openai-images.js";
8
8
  export type { OpenAIOptionsInput, OpenAIResponseIncludable } from "./openai-options.js";
9
9
  export type { OpenAIImageOptions } from "../protocols/openai-images.js";
10
+ export type { OpenAISpeechOptions } from "../protocols/openai-speech.js";
11
+ export type { OpenAITranscriptionOptions } from "../protocols/openai-transcription.js";
10
12
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
11
13
  export declare const routes: (Route<{
12
14
  readonly model: string;
@@ -24,6 +26,12 @@ export declare const routes: (Route<{
24
26
  readonly image_url: {
25
27
  readonly url: string;
26
28
  };
29
+ } | {
30
+ readonly type: "file";
31
+ readonly file: {
32
+ readonly filename: string;
33
+ readonly file_data: string;
34
+ };
27
35
  })[];
28
36
  } | {
29
37
  readonly role: "user";
@@ -39,6 +47,12 @@ export declare const routes: (Route<{
39
47
  readonly image_url: {
40
48
  readonly url: string;
41
49
  };
50
+ } | {
51
+ readonly type: "file";
52
+ readonly file: {
53
+ readonly filename: string;
54
+ readonly file_data: string;
55
+ };
42
56
  })[];
43
57
  } | {
44
58
  readonly [x: string]: unknown;
@@ -178,8 +192,8 @@ export declare const routes: (Route<{
178
192
  } | {
179
193
  readonly type: "input_file";
180
194
  readonly filename: string;
181
- readonly detail?: string | undefined;
182
195
  readonly file_data?: string | undefined;
196
+ readonly detail?: string | undefined;
183
197
  readonly file_url?: string | undefined;
184
198
  } | {
185
199
  readonly type: "input_text";
@@ -215,8 +229,8 @@ export declare const routes: (Route<{
215
229
  } | {
216
230
  readonly type: "input_file";
217
231
  readonly filename: string;
218
- readonly detail?: string | undefined;
219
232
  readonly file_data?: string | undefined;
233
+ readonly detail?: string | undefined;
220
234
  readonly file_url?: string | undefined;
221
235
  } | {
222
236
  readonly type: "input_text";
@@ -277,11 +291,11 @@ export declare const routes: (Route<{
277
291
  readonly size?: string | undefined;
278
292
  readonly action?: "generate" | "auto" | "edit" | undefined;
279
293
  readonly output_format?: "png" | "jpeg" | "webp" | undefined;
294
+ readonly partial_images?: number | undefined;
280
295
  readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
281
296
  readonly background?: "auto" | "opaque" | "transparent" | undefined;
282
297
  readonly output_compression?: number | undefined;
283
298
  readonly input_fidelity?: "low" | "high" | undefined;
284
- readonly partial_images?: number | undefined;
285
299
  } | {
286
300
  readonly type: "namespace";
287
301
  readonly name: string;
@@ -372,6 +386,8 @@ export declare const configure: (input?: Config) => {
372
386
  }>;
373
387
  chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
374
388
  image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
389
+ speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
390
+ transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
375
391
  configure: (input?: Config) => /*elided*/ any;
376
392
  };
377
393
  export declare const provider: {
@@ -386,6 +402,8 @@ export declare const provider: {
386
402
  }>;
387
403
  chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
388
404
  image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
405
+ speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
406
+ transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
389
407
  configure: (input?: Config) => {
390
408
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
391
409
  model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, {
@@ -398,6 +416,8 @@ export declare const provider: {
398
416
  }>;
399
417
  chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
400
418
  image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
419
+ speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
420
+ transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
401
421
  configure: /*elided*/ any;
402
422
  };
403
423
  };
@@ -409,3 +429,5 @@ export declare const responses: (id: string | ModelID) => import("../schema/opti
409
429
  }>;
410
430
  export declare const chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, CompactionOperations | undefined>;
411
431
  export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
432
+ export declare const speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
433
+ export declare const transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
@@ -4,6 +4,8 @@ import * as OpenAIChat from "../protocols/openai-chat.js";
4
4
  import * as OpenAIResponses from "../protocols/openai-responses.js";
5
5
  import { withOpenAIOptions } from "./openai-options.js";
6
6
  import { OpenAIImages } from "../protocols/openai-images.js";
7
+ import { OpenAISpeech } from "../protocols/openai-speech.js";
8
+ import { OpenAITranscription } from "../protocols/openai-transcription.js";
7
9
  export const id = ProviderID.make("openai");
8
10
  export const routes = [OpenAIResponses.route, OpenAIChat.route];
9
11
  export const imageGeneration = (options = {}) => ToolDefinition.make({
@@ -44,19 +46,24 @@ export const configure = (input = {}) => {
44
46
  id,
45
47
  compatibility: { supportsPromptCacheKey: true },
46
48
  });
47
- const image = (modelID) => OpenAIImages.model({
49
+ const media = (modelID) => ({
48
50
  id: modelID,
49
51
  auth: auth(input),
50
52
  baseURL: input.baseURL,
51
53
  headers: input.headers,
52
54
  http: mergeHttpOptions(input.http === undefined ? undefined : HttpOptions.make(input.http), input.queryParams === undefined ? undefined : new HttpOptions({ query: input.queryParams })),
53
55
  });
56
+ const image = (modelID) => OpenAIImages.model(media(modelID));
57
+ const speech = (modelID) => OpenAISpeech.model(media(modelID));
58
+ const transcription = (modelID) => OpenAITranscription.model(media(modelID));
54
59
  return {
55
60
  id,
56
61
  model: responses,
57
62
  responses,
58
63
  chat,
59
64
  image,
65
+ speech,
66
+ transcription,
60
67
  configure,
61
68
  };
62
69
  };
@@ -83,3 +90,5 @@ export const chatModel = (modelID, settings) => configure(config(settings)).chat
83
90
  export const responses = provider.responses;
84
91
  export const chat = provider.chat;
85
92
  export const image = provider.image;
93
+ export const speech = provider.speech;
94
+ export const transcription = provider.transcription;
@@ -104,6 +104,12 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
104
104
  readonly image_url: Schema.Struct<{
105
105
  readonly url: Schema.String;
106
106
  }>;
107
+ }>, Schema.Struct<{
108
+ readonly type: Schema.Literal<"file">;
109
+ readonly file: Schema.Struct<{
110
+ readonly filename: Schema.String;
111
+ readonly file_data: Schema.String;
112
+ }>;
107
113
  }>]>>]>;
108
114
  }>, Schema.Struct<{
109
115
  readonly role: Schema.Literal<"user">;
@@ -119,6 +125,12 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
119
125
  readonly image_url: Schema.Struct<{
120
126
  readonly url: Schema.String;
121
127
  }>;
128
+ }>, Schema.Struct<{
129
+ readonly type: Schema.Literal<"file">;
130
+ readonly file: Schema.Struct<{
131
+ readonly filename: Schema.String;
132
+ readonly file_data: Schema.String;
133
+ }>;
122
134
  }>]>>]>;
123
135
  }>, Schema.StructWithRest<Schema.Struct<{
124
136
  readonly role: Schema.Literal<"assistant">;
@@ -202,6 +214,12 @@ export declare const protocol: Protocol<{
202
214
  readonly image_url: {
203
215
  readonly url: string;
204
216
  };
217
+ } | {
218
+ readonly type: "file";
219
+ readonly file: {
220
+ readonly filename: string;
221
+ readonly file_data: string;
222
+ };
205
223
  })[];
206
224
  } | {
207
225
  readonly role: "user";
@@ -217,6 +235,12 @@ export declare const protocol: Protocol<{
217
235
  readonly image_url: {
218
236
  readonly url: string;
219
237
  };
238
+ } | {
239
+ readonly type: "file";
240
+ readonly file: {
241
+ readonly filename: string;
242
+ readonly file_data: string;
243
+ };
220
244
  })[];
221
245
  } | {
222
246
  readonly [x: string]: unknown;
@@ -369,6 +393,12 @@ export declare const route: Route<{
369
393
  readonly image_url: {
370
394
  readonly url: string;
371
395
  };
396
+ } | {
397
+ readonly type: "file";
398
+ readonly file: {
399
+ readonly filename: string;
400
+ readonly file_data: string;
401
+ };
372
402
  })[];
373
403
  } | {
374
404
  readonly role: "user";
@@ -384,6 +414,12 @@ export declare const route: Route<{
384
414
  readonly image_url: {
385
415
  readonly url: string;
386
416
  };
417
+ } | {
418
+ readonly type: "file";
419
+ readonly file: {
420
+ readonly filename: string;
421
+ readonly file_data: string;
422
+ };
387
423
  })[];
388
424
  } | {
389
425
  readonly [x: string]: unknown;
@@ -469,6 +505,12 @@ export declare const routes: Route<{
469
505
  readonly image_url: {
470
506
  readonly url: string;
471
507
  };
508
+ } | {
509
+ readonly type: "file";
510
+ readonly file: {
511
+ readonly filename: string;
512
+ readonly file_data: string;
513
+ };
472
514
  })[];
473
515
  } | {
474
516
  readonly role: "user";
@@ -484,6 +526,12 @@ export declare const routes: Route<{
484
526
  readonly image_url: {
485
527
  readonly url: string;
486
528
  };
529
+ } | {
530
+ readonly type: "file";
531
+ readonly file: {
532
+ readonly filename: string;
533
+ readonly file_data: string;
534
+ };
487
535
  })[];
488
536
  } | {
489
537
  readonly [x: string]: unknown;
@@ -0,0 +1,25 @@
1
+ import { type ProviderAuthOption } from "../route/auth-options.js";
2
+ import { HttpOptions, type ModelID } from "../schema/index.js";
3
+ export type { ReplicateImageOptions } from "../protocols/replicate-images.js";
4
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
5
+ export type Config = ProviderAuthOption<"optional"> & {
6
+ readonly baseURL?: string;
7
+ /** `{ Prefer: "wait=60" }` holds the submission open until the prediction finishes (up to 60 seconds). */
8
+ readonly headers?: Record<string, string>;
9
+ readonly http?: HttpOptions.Input;
10
+ };
11
+ export declare const configure: (input?: Config) => {
12
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
13
+ image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/replicate-images.js").ReplicateImageOptions>;
14
+ configure: (input?: Config) => /*elided*/ any;
15
+ };
16
+ export declare const provider: {
17
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
18
+ image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/replicate-images.js").ReplicateImageOptions>;
19
+ configure: (input?: Config) => {
20
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
21
+ image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/replicate-images.js").ReplicateImageOptions>;
22
+ configure: /*elided*/ any;
23
+ };
24
+ };
25
+ export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/replicate-images.js").ReplicateImageOptions>;
@@ -0,0 +1,22 @@
1
+ import { AuthOptions } from "../route/auth-options.js";
2
+ import { HttpOptions, ProviderID } from "../schema/index.js";
3
+ import { DEFAULT_BASE_URL, ReplicateImages } from "../protocols/replicate-images.js";
4
+ export const id = ProviderID.make("replicate");
5
+ const baseURL = DEFAULT_BASE_URL;
6
+ const auth = (options) => AuthOptions.bearer(options, "REPLICATE_API_TOKEN");
7
+ export const configure = (input = {}) => {
8
+ const image = (modelID) => ReplicateImages.model({
9
+ id: modelID,
10
+ auth: auth(input),
11
+ baseURL: input.baseURL ?? baseURL,
12
+ headers: input.headers,
13
+ http: input.http === undefined ? undefined : HttpOptions.make(input.http),
14
+ });
15
+ return {
16
+ id,
17
+ image,
18
+ configure,
19
+ };
20
+ };
21
+ export const provider = configure();
22
+ export const image = provider.image;
@@ -0,0 +1,24 @@
1
+ import { type ProviderAuthOption } from "../route/auth-options.js";
2
+ import { HttpOptions, type ModelID } from "../schema/index.js";
3
+ export type { RunwayVideoOptions } from "../protocols/runway-video.js";
4
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
5
+ export type Config = ProviderAuthOption<"optional"> & {
6
+ readonly baseURL?: string;
7
+ readonly headers?: Record<string, string>;
8
+ readonly http?: HttpOptions.Input;
9
+ };
10
+ export declare const configure: (input?: Config) => {
11
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
12
+ video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/runway-video.js").RunwayVideoOptions>;
13
+ configure: (input?: Config) => /*elided*/ any;
14
+ };
15
+ export declare const provider: {
16
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
17
+ video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/runway-video.js").RunwayVideoOptions>;
18
+ configure: (input?: Config) => {
19
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
20
+ video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/runway-video.js").RunwayVideoOptions>;
21
+ configure: /*elided*/ any;
22
+ };
23
+ };
24
+ export declare const video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/runway-video.js").RunwayVideoOptions>;
@@ -0,0 +1,22 @@
1
+ import { AuthOptions } from "../route/auth-options.js";
2
+ import { HttpOptions, ProviderID } from "../schema/index.js";
3
+ import { DEFAULT_BASE_URL, RunwayVideo } from "../protocols/runway-video.js";
4
+ export const id = ProviderID.make("runway");
5
+ const baseURL = DEFAULT_BASE_URL;
6
+ const auth = (options) => AuthOptions.bearer(options, "RUNWAYML_API_SECRET");
7
+ export const configure = (input = {}) => {
8
+ const video = (modelID) => RunwayVideo.model({
9
+ id: modelID,
10
+ auth: auth(input),
11
+ baseURL: input.baseURL ?? baseURL,
12
+ headers: input.headers,
13
+ http: input.http === undefined ? undefined : HttpOptions.make(input.http),
14
+ });
15
+ return {
16
+ id,
17
+ video,
18
+ configure,
19
+ };
20
+ };
21
+ export const provider = configure();
22
+ export const video = provider.video;
@@ -0,0 +1,28 @@
1
+ import { type ProviderAuthOption } from "../route/auth-options.js";
2
+ import { HttpOptions, type ModelID } from "../schema/index.js";
3
+ export type { StabilityImageOptions, StabilityUpscaleOptions } from "../protocols/stability-images.js";
4
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
5
+ export type Config = ProviderAuthOption<"optional"> & {
6
+ readonly baseURL?: string;
7
+ readonly headers?: Record<string, string>;
8
+ readonly http?: HttpOptions.Input;
9
+ };
10
+ export declare const configure: (input?: Config) => {
11
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
12
+ image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityImageOptions>;
13
+ upscale: () => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityUpscaleOptions>;
14
+ configure: (input?: Config) => /*elided*/ any;
15
+ };
16
+ export declare const provider: {
17
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
18
+ image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityImageOptions>;
19
+ upscale: () => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityUpscaleOptions>;
20
+ configure: (input?: Config) => {
21
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
22
+ image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityImageOptions>;
23
+ upscale: () => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityUpscaleOptions>;
24
+ configure: /*elided*/ any;
25
+ };
26
+ };
27
+ export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityImageOptions>;
28
+ export declare const upscale: () => import("../image.js").ImageModel<import("../protocols/stability-images.js").StabilityUpscaleOptions>;
@@ -0,0 +1,23 @@
1
+ import { AuthOptions } from "../route/auth-options.js";
2
+ import { HttpOptions, ProviderID } from "../schema/index.js";
3
+ import { DEFAULT_BASE_URL, StabilityImages } from "../protocols/stability-images.js";
4
+ export const id = ProviderID.make("stability");
5
+ const baseURL = DEFAULT_BASE_URL;
6
+ const auth = (options) => AuthOptions.bearer(options, "STABILITY_API_KEY");
7
+ export const configure = (input = {}) => {
8
+ const deployment = {
9
+ auth: auth(input),
10
+ baseURL: input.baseURL ?? baseURL,
11
+ headers: input.headers,
12
+ http: input.http === undefined ? undefined : HttpOptions.make(input.http),
13
+ };
14
+ return {
15
+ id,
16
+ image: (modelID) => StabilityImages.model({ ...deployment, id: modelID }),
17
+ upscale: () => StabilityImages.upscaleModel(deployment),
18
+ configure,
19
+ };
20
+ };
21
+ export const provider = configure();
22
+ export const image = provider.image;
23
+ export const upscale = provider.upscale;
@@ -28,6 +28,12 @@ export declare const route: Route<{
28
28
  readonly image_url: {
29
29
  readonly url: string;
30
30
  };
31
+ } | {
32
+ readonly type: "file";
33
+ readonly file: {
34
+ readonly filename: string;
35
+ readonly file_data: string;
36
+ };
31
37
  })[];
32
38
  } | {
33
39
  readonly role: "user";
@@ -43,6 +49,12 @@ export declare const route: Route<{
43
49
  readonly image_url: {
44
50
  readonly url: string;
45
51
  };
52
+ } | {
53
+ readonly type: "file";
54
+ readonly file: {
55
+ readonly filename: string;
56
+ readonly file_data: string;
57
+ };
46
58
  })[];
47
59
  } | {
48
60
  readonly [x: string]: unknown;
@@ -127,6 +139,12 @@ export declare const routes: Route<{
127
139
  readonly image_url: {
128
140
  readonly url: string;
129
141
  };
142
+ } | {
143
+ readonly type: "file";
144
+ readonly file: {
145
+ readonly filename: string;
146
+ readonly file_data: string;
147
+ };
130
148
  })[];
131
149
  } | {
132
150
  readonly role: "user";
@@ -142,6 +160,12 @@ export declare const routes: Route<{
142
160
  readonly image_url: {
143
161
  readonly url: string;
144
162
  };
163
+ } | {
164
+ readonly type: "file";
165
+ readonly file: {
166
+ readonly filename: string;
167
+ readonly file_data: string;
168
+ };
145
169
  })[];
146
170
  } | {
147
171
  readonly [x: string]: unknown;
@@ -16,6 +16,7 @@ export type Settings = ProviderPackage.Settings & XAIProviderOptionsInput & {
16
16
  readonly baseURL?: string;
17
17
  };
18
18
  export type { XAIImageOptions } from "../protocols/xai-images.js";
19
+ export type { XAIVideoOptions } from "../protocols/xai-video.js";
19
20
  declare const responsesRoute: Route<unknown, import("../protocols/open-responses-channel.js").Prepared, {
20
21
  endpoint: import("../route/client.js").CompactOperation;
21
22
  }>;
@@ -35,6 +36,12 @@ export declare const routes: (Route<{
35
36
  readonly image_url: {
36
37
  readonly url: string;
37
38
  };
39
+ } | {
40
+ readonly type: "file";
41
+ readonly file: {
42
+ readonly filename: string;
43
+ readonly file_data: string;
44
+ };
38
45
  })[];
39
46
  } | {
40
47
  readonly role: "user";
@@ -50,6 +57,12 @@ export declare const routes: (Route<{
50
57
  readonly image_url: {
51
58
  readonly url: string;
52
59
  };
60
+ } | {
61
+ readonly type: "file";
62
+ readonly file: {
63
+ readonly filename: string;
64
+ readonly file_data: string;
65
+ };
53
66
  })[];
54
67
  } | {
55
68
  readonly [x: string]: unknown;
@@ -130,6 +143,7 @@ export declare const configure: (input?: LanguageModelOptions) => {
130
143
  }>;
131
144
  chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<XAIProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
132
145
  image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
146
+ video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
133
147
  configure: (input?: LanguageModelOptions) => /*elided*/ any;
134
148
  };
135
149
  export declare const provider: {
@@ -142,6 +156,7 @@ export declare const provider: {
142
156
  }>;
143
157
  chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<XAIProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
144
158
  image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
159
+ video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
145
160
  configure: (input?: LanguageModelOptions) => {
146
161
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
147
162
  model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<XAIProviderOptionsInput, {
@@ -152,6 +167,7 @@ export declare const provider: {
152
167
  }>;
153
168
  chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<XAIProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
154
169
  image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
170
+ video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
155
171
  configure: /*elided*/ any;
156
172
  };
157
173
  };
@@ -161,3 +177,4 @@ export declare const responses: (modelID: string | ModelID) => import("../schema
161
177
  }>;
162
178
  export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<XAIProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
163
179
  export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
180
+ export declare const video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
@@ -6,6 +6,7 @@ import { OpenAIChat } from "../protocols/openai-chat.js";
6
6
  import { OpenResponsesChannel } from "../protocols/open-responses-channel.js";
7
7
  import { XAIResponses } from "../protocols/xai-responses.js";
8
8
  import { XAIImages } from "../protocols/xai-images.js";
9
+ import { XAIVideo } from "../protocols/xai-video.js";
9
10
  export const id = ProviderID.make("xai");
10
11
  const baseURL = "https://api.x.ai/v1";
11
12
  const RESPONSES_WEBSOCKET_ROTATE_AFTER_MS = 24 * 60 * 1000;
@@ -59,7 +60,7 @@ export const configure = (input = {}) => {
59
60
  const chatRoute = configuredChatRoute(input);
60
61
  const responses = (modelID) => responsesRoute.model({ id: modelID });
61
62
  const chat = (modelID) => chatRoute.model({ id: modelID });
62
- const image = (modelID) => XAIImages.model({
63
+ const media = (modelID) => ({
63
64
  id: modelID,
64
65
  auth: auth(input),
65
66
  baseURL: input.baseURL ?? baseURL,
@@ -71,7 +72,8 @@ export const configure = (input = {}) => {
71
72
  model: responses,
72
73
  responses,
73
74
  chat,
74
- image,
75
+ image: (modelID) => XAIImages.model(media(modelID)),
76
+ video: (modelID) => XAIVideo.model(media(modelID)),
75
77
  configure,
76
78
  };
77
79
  };
@@ -86,3 +88,4 @@ export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOpti
86
88
  export const responses = provider.responses;
87
89
  export const chat = provider.chat;
88
90
  export const image = provider.image;
91
+ export const video = provider.video;