@opencode/ai 2.0.15 → 2.0.17

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 (224) hide show
  1. package/README.md +441 -99
  2. package/dist/ai-client.d.ts +8 -0
  3. package/dist/ai-client.js +12 -0
  4. package/dist/experimental/evaluation-client.d.ts +3 -3
  5. package/dist/experimental/evaluation-client.js +1 -1
  6. package/dist/experimental/evaluation.js +1 -1
  7. package/dist/generation.d.ts +39 -29
  8. package/dist/generation.js +62 -36
  9. package/dist/image-client.d.ts +59 -17
  10. package/dist/image-client.js +16 -24
  11. package/dist/image.d.ts +394 -55
  12. package/dist/image.js +48 -57
  13. package/dist/index.d.ts +15 -2
  14. package/dist/index.js +10 -0
  15. package/dist/llm.d.ts +7 -5
  16. package/dist/llm.js +10 -4
  17. package/dist/media-client.d.ts +30 -0
  18. package/dist/media-client.js +51 -0
  19. package/dist/media-model.d.ts +43 -0
  20. package/dist/media-model.js +47 -0
  21. package/dist/media.d.ts +10 -9
  22. package/dist/media.js +11 -12
  23. package/dist/promise.d.ts +473 -15
  24. package/dist/promise.js +71 -13
  25. package/dist/protocols/alibaba-chat.d.ts +12 -0
  26. package/dist/protocols/alibaba-chat.js +4 -1
  27. package/dist/protocols/alibaba-messages.d.ts +1 -1
  28. package/dist/protocols/alibaba-messages.js +6 -4
  29. package/dist/protocols/alibaba-responses.d.ts +2 -2
  30. package/dist/protocols/anthropic-messages.d.ts +34 -34
  31. package/dist/protocols/anthropic-messages.js +14 -9
  32. package/dist/protocols/assemblyai-transcription.d.ts +41 -0
  33. package/dist/protocols/assemblyai-transcription.js +136 -0
  34. package/dist/protocols/bedrock-converse.d.ts +7 -0
  35. package/dist/protocols/bedrock-converse.js +39 -19
  36. package/dist/protocols/bfl-images.d.ts +38 -0
  37. package/dist/protocols/bfl-images.js +153 -0
  38. package/dist/protocols/cartesia-speech.d.ts +143 -0
  39. package/dist/protocols/cartesia-speech.js +120 -0
  40. package/dist/protocols/deepgram-speech.d.ts +135 -0
  41. package/dist/protocols/deepgram-speech.js +91 -0
  42. package/dist/protocols/deepgram-transcription.d.ts +26 -0
  43. package/dist/protocols/deepgram-transcription.js +125 -0
  44. package/dist/protocols/elevenlabs-speech.d.ts +138 -0
  45. package/dist/protocols/elevenlabs-speech.js +111 -0
  46. package/dist/protocols/fal-images.d.ts +25 -0
  47. package/dist/protocols/fal-images.js +104 -0
  48. package/dist/protocols/fal-video.d.ts +29 -0
  49. package/dist/protocols/fal-video.js +73 -0
  50. package/dist/protocols/gemini.d.ts +22 -22
  51. package/dist/protocols/gemini.js +19 -36
  52. package/dist/protocols/google-images.d.ts +3 -3
  53. package/dist/protocols/google-images.js +12 -34
  54. package/dist/protocols/google-speech.d.ts +146 -0
  55. package/dist/protocols/google-speech.js +88 -0
  56. package/dist/protocols/google-transcription.d.ts +174 -0
  57. package/dist/protocols/google-transcription.js +126 -0
  58. package/dist/protocols/google-video.d.ts +26 -0
  59. package/dist/protocols/google-video.js +142 -0
  60. package/dist/protocols/meta-images.d.ts +3 -4
  61. package/dist/protocols/meta-images.js +13 -29
  62. package/dist/protocols/meta-messages.d.ts +5 -5
  63. package/dist/protocols/meta-responses.d.ts +4 -4
  64. package/dist/protocols/meta-responses.js +6 -4
  65. package/dist/protocols/open-responses.d.ts +10 -9
  66. package/dist/protocols/open-responses.js +4 -9
  67. package/dist/protocols/openai-chat.d.ts +84 -0
  68. package/dist/protocols/openai-chat.js +28 -17
  69. package/dist/protocols/openai-compatible-chat.d.ts +12 -0
  70. package/dist/protocols/openai-compatible-responses.d.ts +2 -2
  71. package/dist/protocols/openai-images.d.ts +130 -7
  72. package/dist/protocols/openai-images.js +143 -91
  73. package/dist/protocols/openai-responses.d.ts +20 -20
  74. package/dist/protocols/openai-responses.js +31 -31
  75. package/dist/protocols/openai-speech.d.ts +136 -0
  76. package/dist/protocols/openai-speech.js +97 -0
  77. package/dist/protocols/openai-transcription.d.ts +211 -0
  78. package/dist/protocols/openai-transcription.js +202 -0
  79. package/dist/protocols/replicate-images.d.ts +28 -0
  80. package/dist/protocols/replicate-images.js +127 -0
  81. package/dist/protocols/runway-video.d.ts +38 -0
  82. package/dist/protocols/runway-video.js +140 -0
  83. package/dist/protocols/shared.d.ts +21 -17
  84. package/dist/protocols/shared.js +27 -36
  85. package/dist/protocols/stability-images.d.ts +39 -0
  86. package/dist/protocols/stability-images.js +136 -0
  87. package/dist/protocols/utils/fal-queue.d.ts +26 -0
  88. package/dist/protocols/utils/fal-queue.js +67 -0
  89. package/dist/protocols/utils/gemini-generate-content.d.ts +65 -0
  90. package/dist/protocols/utils/gemini-generate-content.js +65 -0
  91. package/dist/protocols/utils/gemini-json-schema.d.ts +3 -0
  92. package/dist/protocols/utils/gemini-json-schema.js +76 -0
  93. package/dist/protocols/utils/media-input.d.ts +23 -1
  94. package/dist/protocols/utils/media-input.js +40 -0
  95. package/dist/protocols/utils/responses-checkpoint.js +3 -7
  96. package/dist/protocols/utils/responses-compaction.d.ts +3 -1
  97. package/dist/protocols/utils/responses-compaction.js +16 -3
  98. package/dist/protocols/utils/speech-stream.d.ts +49 -0
  99. package/dist/protocols/utils/speech-stream.js +64 -0
  100. package/dist/protocols/utils/tool-schema.d.ts +2 -2
  101. package/dist/protocols/utils/tool-schema.js +62 -19
  102. package/dist/protocols/xai-images.d.ts +4 -4
  103. package/dist/protocols/xai-images.js +14 -40
  104. package/dist/protocols/xai-responses.d.ts +2 -2
  105. package/dist/protocols/xai-responses.js +1 -1
  106. package/dist/protocols/xai-video.d.ts +34 -0
  107. package/dist/protocols/xai-video.js +141 -0
  108. package/dist/protocols/zai-chat.d.ts +13 -1
  109. package/dist/protocols/zai-images.d.ts +2 -2
  110. package/dist/protocols/zai-images.js +11 -14
  111. package/dist/protocols/zai-messages.d.ts +1 -1
  112. package/dist/provider-error.js +10 -1
  113. package/dist/providers/alibaba.d.ts +15 -3
  114. package/dist/providers/amazon-bedrock-mantle.d.ts +14 -2
  115. package/dist/providers/amazon-bedrock.d.ts +2 -0
  116. package/dist/providers/amazon-bedrock.js +1 -0
  117. package/dist/providers/anthropic-compatible.d.ts +5 -5
  118. package/dist/providers/anthropic.d.ts +5 -5
  119. package/dist/providers/assemblyai.d.ts +25 -0
  120. package/dist/providers/assemblyai.js +24 -0
  121. package/dist/providers/azure.d.ts +20 -8
  122. package/dist/providers/azure.js +2 -2
  123. package/dist/providers/baseten.d.ts +24 -0
  124. package/dist/providers/black-forest-labs.d.ts +25 -0
  125. package/dist/providers/black-forest-labs.js +23 -0
  126. package/dist/providers/cartesia.d.ts +24 -0
  127. package/dist/providers/cartesia.js +17 -0
  128. package/dist/providers/cerebras.d.ts +24 -0
  129. package/dist/providers/cloudflare-ai-gateway.d.ts +42 -18
  130. package/dist/providers/cloudflare-workers-ai.d.ts +24 -0
  131. package/dist/providers/deepgram.d.ts +29 -0
  132. package/dist/providers/deepgram.js +25 -0
  133. package/dist/providers/deepinfra.d.ts +24 -0
  134. package/dist/providers/deepseek.d.ts +24 -0
  135. package/dist/providers/elevenlabs.d.ts +24 -0
  136. package/dist/providers/elevenlabs.js +23 -0
  137. package/dist/providers/fal.d.ts +29 -0
  138. package/dist/providers/fal.js +26 -0
  139. package/dist/providers/fireworks.d.ts +24 -0
  140. package/dist/providers/google-vertex-chat.d.ts +12 -0
  141. package/dist/providers/google-vertex-messages.d.ts +5 -5
  142. package/dist/providers/google-vertex-responses.d.ts +2 -2
  143. package/dist/providers/google-vertex.d.ts +6 -6
  144. package/dist/providers/google.d.ts +21 -6
  145. package/dist/providers/google.js +13 -9
  146. package/dist/providers/groq.d.ts +24 -0
  147. package/dist/providers/index.d.ts +9 -0
  148. package/dist/providers/index.js +9 -0
  149. package/dist/providers/meta.d.ts +22 -10
  150. package/dist/providers/meta.js +4 -8
  151. package/dist/providers/minimax.d.ts +19 -7
  152. package/dist/providers/moonshot.d.ts +19 -7
  153. package/dist/providers/moonshot.js +3 -3
  154. package/dist/providers/openai-compatible-responses.d.ts +2 -2
  155. package/dist/providers/openai-compatible.d.ts +12 -0
  156. package/dist/providers/openai-options.d.ts +3 -9
  157. package/dist/providers/openai-options.js +4 -7
  158. package/dist/providers/openai.d.ts +33 -12
  159. package/dist/providers/openai.js +17 -9
  160. package/dist/providers/opencode-zen.js +1 -1
  161. package/dist/providers/openrouter.d.ts +54 -7
  162. package/dist/providers/openrouter.js +10 -5
  163. package/dist/providers/replicate.d.ts +25 -0
  164. package/dist/providers/replicate.js +17 -0
  165. package/dist/providers/runway.d.ts +24 -0
  166. package/dist/providers/runway.js +17 -0
  167. package/dist/providers/stability.d.ts +28 -0
  168. package/dist/providers/stability.js +18 -0
  169. package/dist/providers/togetherai.d.ts +24 -0
  170. package/dist/providers/typesafe-ai.js +1 -1
  171. package/dist/providers/vercel-ai-gateway.js +1 -1
  172. package/dist/providers/xai.d.ts +17 -0
  173. package/dist/providers/xai.js +7 -9
  174. package/dist/providers/zai-coding-plan.d.ts +16 -4
  175. package/dist/providers/zai.d.ts +13 -1
  176. package/dist/providers/zai.js +4 -8
  177. package/dist/route/auth.d.ts +5 -2
  178. package/dist/route/auth.js +20 -13
  179. package/dist/route/client.d.ts +9 -7
  180. package/dist/route/client.js +6 -8
  181. package/dist/route/endpoint.d.ts +1 -0
  182. package/dist/route/endpoint.js +2 -2
  183. package/dist/route/executor-service.d.ts +4 -2
  184. package/dist/route/executor-service.js +2 -1
  185. package/dist/route/executor.d.ts +3 -1
  186. package/dist/route/executor.js +7 -0
  187. package/dist/route/framing.d.ts +15 -2
  188. package/dist/route/framing.js +53 -4
  189. package/dist/route/index.d.ts +1 -1
  190. package/dist/route/media-protocol.d.ts +145 -18
  191. package/dist/route/media-protocol.js +96 -28
  192. package/dist/route/media.d.ts +54 -9
  193. package/dist/route/media.js +194 -38
  194. package/dist/route/protocol.d.ts +3 -1
  195. package/dist/schema/events.d.ts +0 -6
  196. package/dist/schema/messages.d.ts +0 -3
  197. package/dist/schema/options.d.ts +10 -6
  198. package/dist/schema/options.js +10 -5
  199. package/dist/speech-client.d.ts +66 -0
  200. package/dist/speech-client.js +21 -0
  201. package/dist/speech.d.ts +1307 -0
  202. package/dist/speech.js +124 -0
  203. package/dist/testing.d.ts +2 -2
  204. package/dist/transcription-client.d.ts +82 -0
  205. package/dist/transcription-client.js +13 -0
  206. package/dist/transcription.d.ts +1492 -0
  207. package/dist/transcription.js +127 -0
  208. package/dist/utils/bytes.d.ts +1 -0
  209. package/dist/utils/bytes.js +10 -0
  210. package/dist/utils/json.d.ts +4 -0
  211. package/dist/utils/json.js +4 -0
  212. package/dist/utils/media-type.d.ts +3 -1
  213. package/dist/utils/media-type.js +25 -2
  214. package/dist/video-client.d.ts +59 -0
  215. package/dist/video-client.js +20 -0
  216. package/dist/video.d.ts +1351 -0
  217. package/dist/video.js +118 -0
  218. package/package.json +3 -3
  219. package/dist/protocols/utils/gemini-tool-schema.d.ts +0 -2
  220. package/dist/protocols/utils/gemini-tool-schema.js +0 -103
  221. package/dist/protocols/utils/meta-image.d.ts +0 -2
  222. package/dist/protocols/utils/meta-image.js +0 -13
  223. package/dist/protocols/utils/openai-image.d.ts +0 -5
  224. package/dist/protocols/utils/openai-image.js +0 -18
@@ -2,21 +2,20 @@ import { Schema } from "effect";
2
2
  import { Route, type RouteDefaultsInput } from "../route/client.js";
3
3
  import { Protocol } from "../route/protocol.js";
4
4
  import { type ProviderAuthOption } from "../route/auth-options.js";
5
- import { type ModelID } from "../schema/index.js";
5
+ import { type ModelID, type OpenString } from "../schema/index.js";
6
6
  import type { ProviderPackage } from "../provider-package.js";
7
7
  import { OpenAIChat } from "../protocols/openai-chat.js";
8
8
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
9
- type OpenRouterString<Known extends string> = Known | (string & {});
10
9
  export interface OpenRouterProviderRouting {
11
10
  readonly [key: string]: unknown;
12
11
  readonly order?: ReadonlyArray<string>;
13
12
  readonly allow_fallbacks?: boolean;
14
13
  readonly require_parameters?: boolean;
15
- readonly data_collection?: OpenRouterString<"allow" | "deny">;
14
+ readonly data_collection?: OpenString<"allow" | "deny">;
16
15
  readonly only?: ReadonlyArray<string>;
17
16
  readonly ignore?: ReadonlyArray<string>;
18
17
  readonly quantizations?: ReadonlyArray<string>;
19
- readonly sort?: OpenRouterString<"price" | "throughput" | "latency">;
18
+ readonly sort?: OpenString<"price" | "throughput" | "latency">;
20
19
  readonly max_price?: Readonly<{
21
20
  prompt?: number | string;
22
21
  completion?: number | string;
@@ -30,7 +29,7 @@ export type OpenRouterPlugin = Readonly<{
30
29
  id: "web";
31
30
  max_results?: number;
32
31
  search_prompt?: string;
33
- engine?: OpenRouterString<"native" | "exa">;
32
+ engine?: OpenString<"native" | "exa">;
34
33
  }> | Readonly<{
35
34
  id: "file-parser";
36
35
  max_files?: number;
@@ -59,7 +58,7 @@ export interface OpenRouterOptions {
59
58
  readonly reasoning?: Readonly<{
60
59
  enabled?: boolean;
61
60
  exclude?: boolean;
62
- effort?: OpenRouterString<"none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max">;
61
+ effort?: OpenString<"none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max">;
63
62
  max_tokens?: number;
64
63
  }>;
65
64
  readonly usage?: boolean | Readonly<{
@@ -69,7 +68,7 @@ export interface OpenRouterOptions {
69
68
  readonly web_search_options?: Readonly<{
70
69
  max_results?: number;
71
70
  search_prompt?: string;
72
- engine?: OpenRouterString<"native" | "exa">;
71
+ engine?: OpenString<"native" | "exa">;
73
72
  }>;
74
73
  }
75
74
  export type OpenRouterProviderOptionsInput = OpenRouterOptions;
@@ -104,6 +103,12 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
104
103
  readonly image_url: Schema.Struct<{
105
104
  readonly url: Schema.String;
106
105
  }>;
106
+ }>, Schema.Struct<{
107
+ readonly type: Schema.Literal<"file">;
108
+ readonly file: Schema.Struct<{
109
+ readonly filename: Schema.String;
110
+ readonly file_data: Schema.String;
111
+ }>;
107
112
  }>]>>]>;
108
113
  }>, Schema.Struct<{
109
114
  readonly role: Schema.Literal<"user">;
@@ -119,6 +124,12 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
119
124
  readonly image_url: Schema.Struct<{
120
125
  readonly url: Schema.String;
121
126
  }>;
127
+ }>, Schema.Struct<{
128
+ readonly type: Schema.Literal<"file">;
129
+ readonly file: Schema.Struct<{
130
+ readonly filename: Schema.String;
131
+ readonly file_data: Schema.String;
132
+ }>;
122
133
  }>]>>]>;
123
134
  }>, Schema.StructWithRest<Schema.Struct<{
124
135
  readonly role: Schema.Literal<"assistant">;
@@ -202,6 +213,12 @@ export declare const protocol: Protocol<{
202
213
  readonly image_url: {
203
214
  readonly url: string;
204
215
  };
216
+ } | {
217
+ readonly type: "file";
218
+ readonly file: {
219
+ readonly filename: string;
220
+ readonly file_data: string;
221
+ };
205
222
  })[];
206
223
  } | {
207
224
  readonly role: "user";
@@ -217,6 +234,12 @@ export declare const protocol: Protocol<{
217
234
  readonly image_url: {
218
235
  readonly url: string;
219
236
  };
237
+ } | {
238
+ readonly type: "file";
239
+ readonly file: {
240
+ readonly filename: string;
241
+ readonly file_data: string;
242
+ };
220
243
  })[];
221
244
  } | {
222
245
  readonly [x: string]: unknown;
@@ -369,6 +392,12 @@ export declare const route: Route<{
369
392
  readonly image_url: {
370
393
  readonly url: string;
371
394
  };
395
+ } | {
396
+ readonly type: "file";
397
+ readonly file: {
398
+ readonly filename: string;
399
+ readonly file_data: string;
400
+ };
372
401
  })[];
373
402
  } | {
374
403
  readonly role: "user";
@@ -384,6 +413,12 @@ export declare const route: Route<{
384
413
  readonly image_url: {
385
414
  readonly url: string;
386
415
  };
416
+ } | {
417
+ readonly type: "file";
418
+ readonly file: {
419
+ readonly filename: string;
420
+ readonly file_data: string;
421
+ };
387
422
  })[];
388
423
  } | {
389
424
  readonly [x: string]: unknown;
@@ -469,6 +504,12 @@ export declare const routes: Route<{
469
504
  readonly image_url: {
470
505
  readonly url: string;
471
506
  };
507
+ } | {
508
+ readonly type: "file";
509
+ readonly file: {
510
+ readonly filename: string;
511
+ readonly file_data: string;
512
+ };
472
513
  })[];
473
514
  } | {
474
515
  readonly role: "user";
@@ -484,6 +525,12 @@ export declare const routes: Route<{
484
525
  readonly image_url: {
485
526
  readonly url: string;
486
527
  };
528
+ } | {
529
+ readonly type: "file";
530
+ readonly file: {
531
+ readonly filename: string;
532
+ readonly file_data: string;
533
+ };
487
534
  })[];
488
535
  } | {
489
536
  readonly [x: string]: unknown;
@@ -7,7 +7,7 @@ import { HttpOptions, ProviderID } from "../schema/index.js";
7
7
  import { SystemOne } from "../experimental/system-one.js";
8
8
  import { OpenAIChat } from "../protocols/openai-chat.js";
9
9
  import { newBreakpoints, ttlBucket } from "../protocols/utils/cache.js";
10
- import { isRecord } from "../protocols/shared.js";
10
+ import { isRecord, ProviderShared } from "../protocols/shared.js";
11
11
  export const id = ProviderID.make("openrouter");
12
12
  const baseURL = "https://openrouter.ai/api/v1";
13
13
  const ADAPTER = "openrouter";
@@ -41,7 +41,7 @@ export const protocol = Protocol.make({
41
41
  return {
42
42
  ...body,
43
43
  messages,
44
- ...bodyOptions(request.providerOptions),
44
+ ...bodyOptions(request.providerOptions, request.generation?.maxTokens),
45
45
  };
46
46
  })),
47
47
  },
@@ -59,7 +59,12 @@ const cacheControl = () => {
59
59
  };
60
60
  };
61
61
  };
62
- const bodyOptions = (input) => {
62
+ // OpenRouter forwards `reasoning.max_tokens` as the upstream thinking budget. Upstreams such as Anthropic and Alibaba
63
+ // reject one that is not below the output limit; 1,024 is Anthropic's minimum budget.
64
+ const fitReasoning = (reasoning, maxTokens) => typeof reasoning.max_tokens === "number"
65
+ ? { ...reasoning, max_tokens: ProviderShared.fitThinkingBudget(reasoning.max_tokens, maxTokens, 1_024) }
66
+ : reasoning;
67
+ const bodyOptions = (input, maxTokens) => {
63
68
  const openrouter = isRecord(input) ? input : {};
64
69
  const { usage, models, provider, plugins, web_search_options, debug, user, reasoning, promptCacheKey, ...options } = openrouter;
65
70
  return {
@@ -77,7 +82,7 @@ const bodyOptions = (input) => {
77
82
  ...(isRecord(web_search_options) ? { web_search_options } : {}),
78
83
  ...(isRecord(debug) ? { debug } : {}),
79
84
  ...(typeof user === "string" ? { user } : {}),
80
- ...(isRecord(reasoning) ? { reasoning } : {}),
85
+ ...(isRecord(reasoning) ? { reasoning: fitReasoning(reasoning, maxTokens) } : {}),
81
86
  };
82
87
  };
83
88
  export const route = Route.make({
@@ -106,7 +111,7 @@ export const configure = (input = {}) => {
106
111
  auth: AuthOptions.bearer(input, "OPENROUTER_API_KEY"),
107
112
  baseURL: input.baseURL ?? baseURL,
108
113
  headers: input.headers,
109
- http: input.http === undefined ? undefined : HttpOptions.make(input.http),
114
+ http: HttpOptions.make(input.http),
110
115
  });
111
116
  return {
112
117
  id,
@@ -0,0 +1,25 @@
1
+ import { type ProviderAuthOption } from "../route/auth-options.js";
2
+ import { type 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,17 @@
1
+ import { AuthOptions } from "../route/auth-options.js";
2
+ import { MediaRoute } from "../route/media.js";
3
+ import { ProviderID } from "../schema/index.js";
4
+ import { ReplicateImages } from "../protocols/replicate-images.js";
5
+ export const id = ProviderID.make("replicate");
6
+ const auth = (options) => AuthOptions.bearer(options, "REPLICATE_API_TOKEN");
7
+ export const configure = (input = {}) => {
8
+ const media = MediaRoute.deployment(input, auth(input));
9
+ const image = (modelID) => ReplicateImages.model({ ...media, id: modelID });
10
+ return {
11
+ id,
12
+ image,
13
+ configure,
14
+ };
15
+ };
16
+ export const provider = configure();
17
+ export const image = provider.image;
@@ -0,0 +1,24 @@
1
+ import { type ProviderAuthOption } from "../route/auth-options.js";
2
+ import { type 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,17 @@
1
+ import { AuthOptions } from "../route/auth-options.js";
2
+ import { MediaRoute } from "../route/media.js";
3
+ import { ProviderID } from "../schema/index.js";
4
+ import { RunwayVideo } from "../protocols/runway-video.js";
5
+ export const id = ProviderID.make("runway");
6
+ const auth = (options) => AuthOptions.bearer(options, "RUNWAYML_API_SECRET");
7
+ export const configure = (input = {}) => {
8
+ const media = MediaRoute.deployment(input, auth(input));
9
+ const video = (modelID) => RunwayVideo.model({ ...media, id: modelID });
10
+ return {
11
+ id,
12
+ video,
13
+ configure,
14
+ };
15
+ };
16
+ export const provider = configure();
17
+ export const video = provider.video;
@@ -0,0 +1,28 @@
1
+ import { type ProviderAuthOption } from "../route/auth-options.js";
2
+ import { type 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,18 @@
1
+ import { AuthOptions } from "../route/auth-options.js";
2
+ import { MediaRoute } from "../route/media.js";
3
+ import { ProviderID } from "../schema/index.js";
4
+ import { StabilityImages } from "../protocols/stability-images.js";
5
+ export const id = ProviderID.make("stability");
6
+ const auth = (options) => AuthOptions.bearer(options, "STABILITY_API_KEY");
7
+ export const configure = (input = {}) => {
8
+ const media = MediaRoute.deployment(input, auth(input));
9
+ return {
10
+ id,
11
+ image: (modelID) => StabilityImages.model({ ...media, id: modelID }),
12
+ upscale: () => StabilityImages.upscaleModel(media),
13
+ configure,
14
+ };
15
+ };
16
+ export const provider = configure();
17
+ export const image = provider.image;
18
+ 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;
@@ -11,7 +11,7 @@ export const configure = (input = {}) => {
11
11
  auth: AuthOptions.bearer(input, "TYPESAFE_API_KEY"),
12
12
  baseURL: input.baseURL ?? baseURL,
13
13
  headers: input.headers,
14
- http: input.http === undefined ? undefined : HttpOptions.make(input.http),
14
+ http: HttpOptions.make(input.http),
15
15
  });
16
16
  return { id, experimental: { evaluation }, configure };
17
17
  };
@@ -26,7 +26,7 @@ export const configure = (input = {}) => {
26
26
  const evaluation = (modelID) => EvaluationModel.make({
27
27
  id: modelID,
28
28
  provider: id,
29
- http: input.http === undefined ? undefined : HttpOptions.make(input.http),
29
+ http: HttpOptions.make(input.http),
30
30
  route: {
31
31
  id: "vercel-evaluation",
32
32
  evaluate: (req, send) => Effect.gen(function* () {
@@ -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>;
@@ -1,11 +1,13 @@
1
1
  import { AuthOptions } from "../route/auth-options.js";
2
2
  import { Route } from "../route/client.js";
3
3
  import { Endpoint } from "../route/endpoint.js";
4
- import { HttpOptions, ProviderID } from "../schema/index.js";
4
+ import { MediaRoute } from "../route/media.js";
5
+ import { ProviderID } from "../schema/index.js";
5
6
  import { OpenAIChat } from "../protocols/openai-chat.js";
6
7
  import { OpenResponsesChannel } from "../protocols/open-responses-channel.js";
7
8
  import { XAIResponses } from "../protocols/xai-responses.js";
8
9
  import { XAIImages } from "../protocols/xai-images.js";
10
+ import { XAIVideo } from "../protocols/xai-video.js";
9
11
  export const id = ProviderID.make("xai");
10
12
  const baseURL = "https://api.x.ai/v1";
11
13
  const RESPONSES_WEBSOCKET_ROTATE_AFTER_MS = 24 * 60 * 1000;
@@ -59,19 +61,14 @@ export const configure = (input = {}) => {
59
61
  const chatRoute = configuredChatRoute(input);
60
62
  const responses = (modelID) => responsesRoute.model({ id: modelID });
61
63
  const chat = (modelID) => chatRoute.model({ id: modelID });
62
- const image = (modelID) => XAIImages.model({
63
- id: modelID,
64
- auth: auth(input),
65
- baseURL: input.baseURL ?? baseURL,
66
- headers: input.headers,
67
- http: input.http === undefined ? undefined : HttpOptions.make(input.http),
68
- });
64
+ const media = MediaRoute.deployment(input, auth(input));
69
65
  return {
70
66
  id,
71
67
  model: responses,
72
68
  responses,
73
69
  chat,
74
- image,
70
+ image: (modelID) => XAIImages.model({ ...media, id: modelID }),
71
+ video: (modelID) => XAIVideo.model({ ...media, id: modelID }),
75
72
  configure,
76
73
  };
77
74
  };
@@ -86,3 +83,4 @@ export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOpti
86
83
  export const responses = provider.responses;
87
84
  export const chat = provider.chat;
88
85
  export const image = provider.image;
86
+ export const video = provider.video;
@@ -86,8 +86,8 @@ export declare const routes: (Route<{
86
86
  } | {
87
87
  readonly type: "input_file";
88
88
  readonly filename: string;
89
- readonly detail?: string | undefined;
90
89
  readonly file_data?: string | undefined;
90
+ readonly detail?: string | undefined;
91
91
  readonly file_url?: string | undefined;
92
92
  } | {
93
93
  readonly type: "input_text";
@@ -123,8 +123,8 @@ export declare const routes: (Route<{
123
123
  } | {
124
124
  readonly type: "input_file";
125
125
  readonly filename: string;
126
- readonly detail?: string | undefined;
127
126
  readonly file_data?: string | undefined;
127
+ readonly detail?: string | undefined;
128
128
  readonly file_url?: string | undefined;
129
129
  } | {
130
130
  readonly type: "input_text";
@@ -200,6 +200,12 @@ export declare const routes: (Route<{
200
200
  readonly image_url: {
201
201
  readonly url: string;
202
202
  };
203
+ } | {
204
+ readonly type: "file";
205
+ readonly file: {
206
+ readonly filename: string;
207
+ readonly file_data: string;
208
+ };
203
209
  })[];
204
210
  } | {
205
211
  readonly role: "user";
@@ -215,6 +221,12 @@ export declare const routes: (Route<{
215
221
  readonly image_url: {
216
222
  readonly url: string;
217
223
  };
224
+ } | {
225
+ readonly type: "file";
226
+ readonly file: {
227
+ readonly filename: string;
228
+ readonly file_data: string;
229
+ };
218
230
  })[];
219
231
  } | {
220
232
  readonly [x: string]: unknown;
@@ -290,8 +302,8 @@ export declare const routes: (Route<{
290
302
  readonly response_format?: {
291
303
  readonly type: string;
292
304
  } | undefined;
293
- readonly do_sample?: boolean | undefined;
294
305
  readonly request_id?: string | undefined;
306
+ readonly do_sample?: boolean | undefined;
295
307
  }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined> | Route<{
296
308
  readonly max_tokens: number;
297
309
  readonly model: string;
@@ -508,7 +520,7 @@ export declare const routes: (Route<{
508
520
  readonly thinking?: {
509
521
  readonly type: string;
510
522
  } | undefined;
511
- readonly service_tier?: "auto" | (string & {}) | "standard_only" | undefined;
523
+ readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
512
524
  readonly container?: string | {
513
525
  readonly id?: string | null | undefined;
514
526
  readonly skills?: readonly {
@@ -30,6 +30,12 @@ export declare const routes: 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: 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;
@@ -120,8 +132,8 @@ export declare const routes: Route<{
120
132
  readonly response_format?: {
121
133
  readonly type: string;
122
134
  } | undefined;
123
- readonly do_sample?: boolean | undefined;
124
135
  readonly request_id?: string | undefined;
136
+ readonly do_sample?: boolean | undefined;
125
137
  }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
126
138
  export declare const configure: (input?: Config) => {
127
139
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -4,7 +4,8 @@ import { OpenAIChat } from "../protocols/openai-chat.js";
4
4
  import { AuthOptions } from "../route/auth-options.js";
5
5
  import { Route } from "../route/client.js";
6
6
  import { Endpoint } from "../route/endpoint.js";
7
- import { HttpOptions, ProviderID } from "../schema/index.js";
7
+ import { MediaRoute } from "../route/media.js";
8
+ import { ProviderID } from "../schema/index.js";
8
9
  export const id = ProviderID.make("zai");
9
10
  const auth = (options) => AuthOptions.bearer(options, "ZAI_API_KEY");
10
11
  const chatRoute = Route.make({
@@ -25,13 +26,8 @@ export const configure = (input = {}) => {
25
26
  auth: auth(input),
26
27
  })
27
28
  .model({ id: modelID, compatibility: ZAIChat.compatibility });
28
- const image = (modelID) => ZAIImages.model({
29
- id: modelID,
30
- auth: auth(input),
31
- baseURL: input.baseURL,
32
- headers: input.headers,
33
- http: input.http === undefined ? undefined : HttpOptions.make(input.http),
34
- });
29
+ const media = MediaRoute.deployment(input, auth(input));
30
+ const image = (modelID) => ZAIImages.model({ ...media, id: modelID });
35
31
  return {
36
32
  id,
37
33
  model: chat,