@opencode/ai 2.2.0 → 2.2.2

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 (189) hide show
  1. package/README.md +66 -62
  2. package/dist/effect.d.ts +1 -1
  3. package/dist/effect.js +1 -1
  4. package/dist/image-client.d.ts +45 -0
  5. package/dist/image.d.ts +1 -0
  6. package/dist/index.d.ts +38 -20
  7. package/dist/index.js +14 -2
  8. package/dist/media-client.d.ts +1 -0
  9. package/dist/media-client.js +1 -0
  10. package/dist/protocols/alibaba-chat.d.ts +39 -4
  11. package/dist/protocols/alibaba-responses.d.ts +20 -3
  12. package/dist/protocols/google-images.js +3 -1
  13. package/dist/protocols/meta-responses.d.ts +40 -6
  14. package/dist/protocols/meta-responses.js +1 -1
  15. package/dist/protocols/minimax-images.d.ts +25 -0
  16. package/dist/protocols/minimax-images.js +150 -0
  17. package/dist/protocols/open-responses.d.ts +182 -27
  18. package/dist/protocols/open-responses.js +108 -36
  19. package/dist/protocols/openai-chat.d.ts +438 -46
  20. package/dist/protocols/openai-chat.js +121 -39
  21. package/dist/protocols/openai-compatible-chat.d.ts +35 -4
  22. package/dist/protocols/openai-compatible-responses.d.ts +20 -3
  23. package/dist/protocols/openai-freeform.d.ts +47 -0
  24. package/dist/protocols/openai-freeform.js +54 -0
  25. package/dist/protocols/openai-images.d.ts +16 -1
  26. package/dist/protocols/openai-images.js +49 -17
  27. package/dist/protocols/openai-responses.d.ts +120 -18
  28. package/dist/protocols/openai-responses.js +17 -8
  29. package/dist/protocols/venice-chat.d.ts +39 -4
  30. package/dist/protocols/venice-chat.js +1 -1
  31. package/dist/protocols/xai-images.d.ts +6 -0
  32. package/dist/protocols/xai-images.js +4 -5
  33. package/dist/protocols/xai-responses.d.ts +20 -3
  34. package/dist/protocols/xai-responses.js +2 -1
  35. package/dist/protocols/zai-chat.d.ts +39 -4
  36. package/dist/provider-error.js +5 -4
  37. package/dist/provider-package.d.ts +2 -0
  38. package/dist/providers/alibaba.d.ts +58 -10
  39. package/dist/providers/amazon-bedrock-mantle.d.ts +66 -11
  40. package/dist/providers/amazon-bedrock-mantle.js +1 -1
  41. package/dist/providers/amazon-bedrock.d.ts +1 -1
  42. package/dist/providers/amazon-bedrock.js +1 -1
  43. package/dist/providers/anthropic-compatible.d.ts +1 -1
  44. package/dist/providers/anthropic.d.ts +1 -1
  45. package/dist/providers/anthropic.js +1 -1
  46. package/dist/providers/azure.d.ts +79 -15
  47. package/dist/providers/baseten.d.ts +74 -12
  48. package/dist/providers/baseten.js +1 -1
  49. package/dist/providers/cerebras.d.ts +73 -11
  50. package/dist/providers/cerebras.js +1 -1
  51. package/dist/providers/cloudflare-ai-gateway.d.ts +113 -17
  52. package/dist/providers/cloudflare-workers-ai.d.ts +73 -11
  53. package/dist/providers/cohere/chat.d.ts +1 -1
  54. package/dist/providers/cohere/chat.js +1 -1
  55. package/dist/providers/cohere.d.ts +73 -11
  56. package/dist/providers/cohere.js +1 -1
  57. package/dist/providers/deepinfra.d.ts +73 -11
  58. package/dist/providers/deepinfra.js +1 -1
  59. package/dist/providers/deepseek.d.ts +73 -11
  60. package/dist/providers/deepseek.js +1 -1
  61. package/dist/providers/digitalocean/responses.d.ts +4 -0
  62. package/dist/providers/digitalocean/responses.js +1 -0
  63. package/dist/providers/digitalocean.d.ts +320 -21
  64. package/dist/providers/digitalocean.js +18 -7
  65. package/dist/providers/fireworks.d.ts +73 -11
  66. package/dist/providers/fireworks.js +1 -1
  67. package/dist/providers/google/interactions.d.ts +1 -1
  68. package/dist/providers/google/interactions.js +1 -1
  69. package/dist/providers/google-vertex-chat.d.ts +36 -5
  70. package/dist/providers/google-vertex-chat.js +1 -1
  71. package/dist/providers/google-vertex-interactions.d.ts +1 -1
  72. package/dist/providers/google-vertex-interactions.js +1 -1
  73. package/dist/providers/google-vertex-messages.d.ts +1 -1
  74. package/dist/providers/google-vertex-messages.js +1 -1
  75. package/dist/providers/google-vertex-mistral.d.ts +1 -1
  76. package/dist/providers/google-vertex-mistral.js +1 -1
  77. package/dist/providers/google-vertex-responses.d.ts +21 -4
  78. package/dist/providers/google-vertex-responses.js +1 -1
  79. package/dist/providers/google-vertex.d.ts +2 -2
  80. package/dist/providers/google-vertex.js +1 -1
  81. package/dist/providers/google.d.ts +2 -2
  82. package/dist/providers/google.js +1 -1
  83. package/dist/providers/groq.d.ts +77 -11
  84. package/dist/providers/groq.js +1 -1
  85. package/dist/providers/index.d.ts +0 -4
  86. package/dist/providers/index.js +0 -4
  87. package/dist/providers/meta/images.d.ts +2 -0
  88. package/dist/providers/meta/images.js +1 -0
  89. package/dist/providers/meta.d.ts +61 -12
  90. package/dist/providers/meta.js +2 -1
  91. package/dist/providers/minimax/chat.d.ts +1 -1
  92. package/dist/providers/minimax/chat.js +1 -1
  93. package/dist/providers/minimax/images.d.ts +3 -0
  94. package/dist/providers/minimax/images.js +1 -0
  95. package/dist/providers/minimax/responses.d.ts +1 -1
  96. package/dist/providers/minimax/responses.js +1 -1
  97. package/dist/providers/minimax.d.ts +63 -9
  98. package/dist/providers/minimax.js +22 -9
  99. package/dist/providers/mistral.d.ts +3 -3
  100. package/dist/providers/mistral.js +1 -1
  101. package/dist/providers/moonshot/messages.d.ts +1 -1
  102. package/dist/providers/moonshot/messages.js +1 -1
  103. package/dist/providers/moonshot/responses.d.ts +1 -1
  104. package/dist/providers/moonshot/responses.js +1 -1
  105. package/dist/providers/moonshot.d.ts +56 -8
  106. package/dist/providers/moonshot.js +1 -1
  107. package/dist/providers/openai-compatible-responses.d.ts +21 -4
  108. package/dist/providers/openai-compatible.d.ts +38 -7
  109. package/dist/providers/openai-compatible.js +9 -2
  110. package/dist/providers/openai.d.ts +59 -11
  111. package/dist/providers/openai.js +4 -2
  112. package/dist/providers/opencode.d.ts +3 -3
  113. package/dist/providers/opencode.js +1 -1
  114. package/dist/providers/openrouter/responses.d.ts +4 -0
  115. package/dist/providers/openrouter/responses.js +1 -0
  116. package/dist/providers/openrouter.d.ts +356 -26
  117. package/dist/providers/openrouter.js +42 -13
  118. package/dist/providers/togetherai.d.ts +73 -11
  119. package/dist/providers/togetherai.js +1 -1
  120. package/dist/providers/typesafe-ai.d.ts +3 -3
  121. package/dist/providers/typesafe-ai.js +1 -1
  122. package/dist/providers/venice/responses.d.ts +4 -0
  123. package/dist/providers/venice/responses.js +1 -0
  124. package/dist/providers/venice.d.ts +242 -9
  125. package/dist/providers/venice.js +33 -17
  126. package/dist/providers/vercel-ai-gateway.d.ts +8 -8
  127. package/dist/providers/vercel-ai-gateway.js +12 -2
  128. package/dist/providers/xai.d.ts +39 -8
  129. package/dist/providers/xai.js +1 -1
  130. package/dist/providers/zai-coding-plan/messages.d.ts +1 -1
  131. package/dist/providers/zai-coding-plan/messages.js +1 -1
  132. package/dist/providers/zai-coding-plan/responses.d.ts +1 -1
  133. package/dist/providers/zai-coding-plan/responses.js +1 -1
  134. package/dist/providers/zai-coding-plan.d.ts +56 -8
  135. package/dist/providers/zai-coding-plan.js +1 -1
  136. package/dist/providers/zai.d.ts +37 -6
  137. package/dist/providers/zai.js +1 -1
  138. package/dist/route/auth.d.ts +1 -1
  139. package/dist/route/media-protocol.d.ts +2 -4
  140. package/dist/route/media.d.ts +1 -1
  141. package/dist/route/media.js +2 -4
  142. package/dist/schema/events.d.ts +2 -0
  143. package/dist/schema/messages.d.ts +35 -1
  144. package/dist/schema/messages.js +20 -0
  145. package/dist/speech-client.d.ts +48 -0
  146. package/dist/speech.d.ts +1 -0
  147. package/dist/testing/decision.d.ts +16 -0
  148. package/dist/testing/decision.js +20 -0
  149. package/dist/testing/image.d.ts +14 -0
  150. package/dist/testing/image.js +12 -0
  151. package/dist/testing/media.d.ts +18 -0
  152. package/dist/testing/media.js +36 -0
  153. package/dist/testing/script.d.ts +28 -0
  154. package/dist/testing/script.js +60 -0
  155. package/dist/testing/speech.d.ts +14 -0
  156. package/dist/testing/speech.js +12 -0
  157. package/dist/testing/transcription.d.ts +14 -0
  158. package/dist/testing/transcription.js +12 -0
  159. package/dist/testing/video.d.ts +14 -0
  160. package/dist/testing/video.js +12 -0
  161. package/dist/testing.d.ts +10 -21
  162. package/dist/testing.js +11 -54
  163. package/dist/tool.d.ts +12 -1
  164. package/dist/tool.js +10 -2
  165. package/dist/transcription-client.d.ts +64 -0
  166. package/dist/transcription.d.ts +1 -0
  167. package/dist/video-client.d.ts +41 -0
  168. package/dist/video.d.ts +1 -0
  169. package/package.json +24 -40
  170. package/dist/protocols/bfl-images.d.ts +0 -47
  171. package/dist/protocols/bfl-images.js +0 -155
  172. package/dist/protocols/fal-images.d.ts +0 -34
  173. package/dist/protocols/fal-images.js +0 -95
  174. package/dist/protocols/fal-video.d.ts +0 -29
  175. package/dist/protocols/fal-video.js +0 -73
  176. package/dist/protocols/replicate-images.d.ts +0 -28
  177. package/dist/protocols/replicate-images.js +0 -127
  178. package/dist/protocols/stability-images.d.ts +0 -44
  179. package/dist/protocols/stability-images.js +0 -131
  180. package/dist/protocols/utils/fal-queue.d.ts +0 -26
  181. package/dist/protocols/utils/fal-queue.js +0 -67
  182. package/dist/providers/black-forest-labs.d.ts +0 -21
  183. package/dist/providers/black-forest-labs.js +0 -23
  184. package/dist/providers/fal.d.ts +0 -24
  185. package/dist/providers/fal.js +0 -26
  186. package/dist/providers/replicate.d.ts +0 -21
  187. package/dist/providers/replicate.js +0 -17
  188. package/dist/providers/stability.d.ts +0 -23
  189. package/dist/providers/stability.js +0 -18
@@ -6,7 +6,6 @@ export * as AmazonBedrockMantle from "./amazon-bedrock-mantle.js";
6
6
  export * as AssemblyAI from "./assemblyai.js";
7
7
  export * as Azure from "./azure.js";
8
8
  export * as Baseten from "./baseten.js";
9
- export * as BlackForestLabs from "./black-forest-labs.js";
10
9
  export * as Cartesia from "./cartesia.js";
11
10
  export * as Cerebras from "./cerebras.js";
12
11
  export * as Cohere from "./cohere.js";
@@ -17,7 +16,6 @@ export * as Deepgram from "./deepgram.js";
17
16
  export * as DeepSeek from "./deepseek.js";
18
17
  export * as DigitalOcean from "./digitalocean.js";
19
18
  export * as ElevenLabs from "./elevenlabs.js";
20
- export * as Fal from "./fal.js";
21
19
  export * as Fireworks from "./fireworks.js";
22
20
  export * as Google from "./google.js";
23
21
  export * as GoogleVertex from "./google-vertex.js";
@@ -36,9 +34,7 @@ export * as OpenAICompatible from "./openai-compatible.js";
36
34
  export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
37
35
  export * as OpenCode from "./opencode.js";
38
36
  export * as OpenRouter from "./openrouter.js";
39
- export * as Replicate from "./replicate.js";
40
37
  export * as Runway from "./runway.js";
41
- export * as Stability from "./stability.js";
42
38
  export * as TogetherAI from "./togetherai.js";
43
39
  export * as TypeSafeAI from "./typesafe-ai.js";
44
40
  export * as VercelAIGateway from "./vercel-ai-gateway.js";
@@ -0,0 +1,2 @@
1
+ export { imageModel as model } from "../meta.js";
2
+ export type { Settings } from "../meta.js";
@@ -0,0 +1 @@
1
+ export { imageModel as model } from "../meta.js";
@@ -30,7 +30,7 @@ export interface ImageGenerationOptions {
30
30
  readonly enableShell?: boolean;
31
31
  }
32
32
  export declare const imageGeneration: (options?: ImageGenerationOptions) => ToolDefinition;
33
- export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
33
+ export type Config = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
34
34
  readonly baseURL?: string;
35
35
  readonly providerOptions?: ProviderOptionsInput;
36
36
  };
@@ -54,7 +54,7 @@ export declare const routes: (Route<{
54
54
  readonly role: "developer";
55
55
  readonly content: string;
56
56
  } | {
57
- readonly type: "function_call_output";
57
+ readonly type: "custom_tool_call_output" | "function_call_output";
58
58
  readonly call_id: string;
59
59
  readonly output: string | readonly ({
60
60
  readonly type: "input_text";
@@ -124,6 +124,12 @@ export declare const routes: (Route<{
124
124
  readonly name: string;
125
125
  readonly namespace?: string | undefined;
126
126
  readonly arguments: string;
127
+ } | {
128
+ readonly type: "custom_tool_call";
129
+ readonly id?: string | undefined;
130
+ readonly call_id: string;
131
+ readonly name: string;
132
+ readonly input: string;
127
133
  } | {
128
134
  readonly [x: string]: unknown;
129
135
  readonly type: "web_search_call";
@@ -168,6 +174,17 @@ export declare const routes: (Route<{
168
174
  })[];
169
175
  readonly instructions?: string | undefined;
170
176
  readonly tools?: readonly ({
177
+ readonly type: "custom";
178
+ readonly name: string;
179
+ readonly description: string;
180
+ readonly format: {
181
+ readonly type: "text";
182
+ } | {
183
+ readonly type: "grammar";
184
+ readonly syntax: "lark" | "regex";
185
+ readonly definition: string;
186
+ };
187
+ } | {
171
188
  readonly type: "function";
172
189
  readonly name: string;
173
190
  readonly description: string;
@@ -180,13 +197,13 @@ export declare const routes: (Route<{
180
197
  readonly type: string;
181
198
  })[] | undefined;
182
199
  readonly tool_choice?: "auto" | "none" | "required" | {
183
- readonly type: "function";
200
+ readonly type: "custom" | "function";
184
201
  readonly name: string;
185
202
  } | {
186
203
  readonly type: "allowed_tools";
187
204
  readonly mode: "auto" | "none" | "required";
188
205
  readonly tools: readonly {
189
- readonly type: "function";
206
+ readonly type: "custom" | "function";
190
207
  readonly name: string;
191
208
  }[];
192
209
  } | undefined;
@@ -294,7 +311,14 @@ export declare const routes: (Route<{
294
311
  readonly ttl?: string | undefined;
295
312
  } | undefined;
296
313
  }[] | null;
297
- readonly tool_calls?: readonly {
314
+ readonly tool_calls?: readonly ({
315
+ readonly id: string;
316
+ readonly type: "custom";
317
+ readonly custom: {
318
+ readonly name: string;
319
+ readonly input: string;
320
+ };
321
+ } | {
298
322
  readonly id: string;
299
323
  readonly type: "function";
300
324
  readonly function: {
@@ -306,13 +330,13 @@ export declare const routes: (Route<{
306
330
  readonly thought_signature: string;
307
331
  };
308
332
  } | undefined;
309
- }[] | undefined;
333
+ })[] | undefined;
310
334
  readonly reasoning_content?: string | undefined;
311
335
  readonly reasoning?: string | undefined;
312
336
  readonly reasoning_text?: string | undefined;
313
337
  readonly reasoning_details?: unknown;
314
338
  })[];
315
- readonly tools?: readonly {
339
+ readonly tools?: readonly ({
316
340
  readonly type: "function";
317
341
  readonly function: {
318
342
  readonly name: string;
@@ -326,12 +350,36 @@ export declare const routes: (Route<{
326
350
  readonly type: "ephemeral";
327
351
  readonly ttl?: string | undefined;
328
352
  } | undefined;
329
- }[] | undefined;
353
+ } | {
354
+ readonly type: "custom";
355
+ readonly custom: {
356
+ readonly name: string;
357
+ readonly description: string;
358
+ readonly format: {
359
+ readonly type: "text";
360
+ } | {
361
+ readonly type: "grammar";
362
+ readonly grammar: {
363
+ readonly syntax: "lark" | "regex";
364
+ readonly definition: string;
365
+ };
366
+ };
367
+ };
368
+ readonly cache_control?: {
369
+ readonly type: "ephemeral";
370
+ readonly ttl?: string | undefined;
371
+ } | undefined;
372
+ })[] | undefined;
330
373
  readonly tool_choice?: "auto" | "none" | "required" | {
331
374
  readonly type: "function";
332
375
  readonly function: {
333
376
  readonly name: string;
334
377
  };
378
+ } | {
379
+ readonly type: "custom";
380
+ readonly custom: {
381
+ readonly name: string;
382
+ };
335
383
  } | undefined;
336
384
  readonly stream: true;
337
385
  readonly stream_options?: {
@@ -678,7 +726,7 @@ export declare const routes: (Route<{
678
726
  } | undefined;
679
727
  })[] | undefined;
680
728
  }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>)[];
681
- export declare const configure: (input?: LanguageModelOptions) => {
729
+ export declare const configure: (input?: Config) => {
682
730
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
683
731
  model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
684
732
  responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
@@ -700,7 +748,8 @@ export declare const responses: (modelID: string | ModelID) => import("../schema
700
748
  export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
701
749
  export declare const messages: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MessagesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
702
750
  export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<MetaImages.ImageOptions>;
703
- export declare const model: ProviderPackage.Definition<Settings, OpenResponsesProviderOptionsInput>["model"];
704
- export declare const chatModel: ProviderPackage.Definition<Settings, OpenResponsesProviderOptionsInput>["model"];
705
- export declare const messagesModel: ProviderPackage.Definition<Settings, MessagesOptionsInput>["model"];
751
+ export declare const model: ProviderPackage.Model<Settings, OpenResponsesProviderOptionsInput>;
752
+ export declare const chatModel: ProviderPackage.Model<Settings, OpenResponsesProviderOptionsInput>;
753
+ export declare const messagesModel: ProviderPackage.Model<Settings, MessagesOptionsInput>;
754
+ export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<MetaImages.ImageOptions>;
706
755
  export * as Meta from "./meta.js";
@@ -97,7 +97,8 @@ export const image = provider.image;
97
97
  export const model = (modelID, settings) => fromSettings(settings).responses(modelID);
98
98
  export const chatModel = (modelID, settings) => fromSettings(settings).chat(modelID);
99
99
  export const messagesModel = (modelID, settings) => fromSettings(settings).messages(modelID);
100
- function fromSettings({ apiKey, baseURL, body, headers, ...providerOptions }) {
100
+ export const imageModel = (modelID, settings) => fromSettings(settings).image(modelID);
101
+ function fromSettings({ apiKey, baseURL, body, headers, ...providerOptions } = {}) {
101
102
  return configure({
102
103
  apiKey,
103
104
  baseURL,
@@ -1,4 +1,4 @@
1
1
  import type { ProviderPackage } from "../../provider-package.js";
2
2
  import { MiniMax } from "../minimax.js";
3
3
  export type Settings = MiniMax.Settings<MiniMax.ChatOptionsInput>;
4
- export declare const model: ProviderPackage.Definition<Settings, MiniMax.ChatOptionsInput>["model"];
4
+ export declare const model: ProviderPackage.Model<Settings, MiniMax.ChatOptionsInput>;
@@ -1,5 +1,5 @@
1
1
  import { MiniMax } from "../minimax.js";
2
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => MiniMax.configure({
2
+ export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions } = {}) => MiniMax.configure({
3
3
  apiKey,
4
4
  baseURL,
5
5
  headers,
@@ -0,0 +1,3 @@
1
+ import type { MiniMax } from "../minimax.js";
2
+ export { imageModel as model } from "../minimax.js";
3
+ export type Settings = MiniMax.Settings<MiniMax.MiniMaxImageOptions>;
@@ -0,0 +1 @@
1
+ export { imageModel as model } from "../minimax.js";
@@ -1,4 +1,4 @@
1
1
  import type { ProviderPackage } from "../../provider-package.js";
2
2
  import { MiniMax } from "../minimax.js";
3
3
  export type Settings = MiniMax.Settings<MiniMax.ResponsesOptionsInput>;
4
- export declare const model: ProviderPackage.Definition<Settings, MiniMax.ResponsesOptionsInput>["model"];
4
+ export declare const model: ProviderPackage.Model<Settings, MiniMax.ResponsesOptionsInput>;
@@ -1,5 +1,5 @@
1
1
  import { MiniMax } from "../minimax.js";
2
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => MiniMax.configure({
2
+ export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions } = {}) => MiniMax.configure({
3
3
  apiKey,
4
4
  baseURL,
5
5
  headers,
@@ -1,8 +1,9 @@
1
1
  import type { ProviderPackage } from "../provider-package.js";
2
2
  import { AnthropicMessages } from "../protocols/anthropic-messages.js";
3
+ import { type MiniMaxImageOptions } from "../protocols/minimax-images.js";
3
4
  import { type ProviderAuthOption } from "../route/auth-options.js";
4
5
  import { Route, type RouteDefaultsInput } from "../route/client.js";
5
- import { type ModelID } from "../schema/index.js";
6
+ import { type ModelID, type ProviderOptions } from "../schema/index.js";
6
7
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
7
8
  export type MessagesOptionsInput = {
8
9
  /** M3 defaults to disabled; M2.x always thinks. */
@@ -33,6 +34,7 @@ export type Settings<Options = MessagesOptionsInput> = ProviderPackage.Settings
33
34
  readonly apiKey?: string;
34
35
  readonly baseURL?: string;
35
36
  };
37
+ export type { MiniMaxImageOptions };
36
38
  export declare const routes: (Route<{
37
39
  readonly context_management?: {
38
40
  readonly edits: readonly {
@@ -356,7 +358,7 @@ export declare const routes: (Route<{
356
358
  readonly role: "developer";
357
359
  readonly content: string;
358
360
  } | {
359
- readonly type: "function_call_output";
361
+ readonly type: "custom_tool_call_output" | "function_call_output";
360
362
  readonly call_id: string;
361
363
  readonly output: string | readonly ({
362
364
  readonly type: "input_text";
@@ -426,6 +428,12 @@ export declare const routes: (Route<{
426
428
  readonly name: string;
427
429
  readonly namespace?: string | undefined;
428
430
  readonly arguments: string;
431
+ } | {
432
+ readonly type: "custom_tool_call";
433
+ readonly id?: string | undefined;
434
+ readonly call_id: string;
435
+ readonly name: string;
436
+ readonly input: string;
429
437
  } | {
430
438
  readonly [x: string]: unknown;
431
439
  readonly type: "web_search_call";
@@ -470,6 +478,17 @@ export declare const routes: (Route<{
470
478
  })[];
471
479
  readonly instructions?: string | undefined;
472
480
  readonly tools?: readonly ({
481
+ readonly type: "custom";
482
+ readonly name: string;
483
+ readonly description: string;
484
+ readonly format: {
485
+ readonly type: "text";
486
+ } | {
487
+ readonly type: "grammar";
488
+ readonly syntax: "lark" | "regex";
489
+ readonly definition: string;
490
+ };
491
+ } | {
473
492
  readonly type: "function";
474
493
  readonly name: string;
475
494
  readonly description: string;
@@ -482,13 +501,13 @@ export declare const routes: (Route<{
482
501
  readonly type: string;
483
502
  })[] | undefined;
484
503
  readonly tool_choice?: "auto" | "none" | "required" | {
485
- readonly type: "function";
504
+ readonly type: "custom" | "function";
486
505
  readonly name: string;
487
506
  } | {
488
507
  readonly type: "allowed_tools";
489
508
  readonly mode: "auto" | "none" | "required";
490
509
  readonly tools: readonly {
491
- readonly type: "function";
510
+ readonly type: "custom" | "function";
492
511
  readonly name: string;
493
512
  }[];
494
513
  } | undefined;
@@ -596,7 +615,14 @@ export declare const routes: (Route<{
596
615
  readonly ttl?: string | undefined;
597
616
  } | undefined;
598
617
  }[] | null;
599
- readonly tool_calls?: readonly {
618
+ readonly tool_calls?: readonly ({
619
+ readonly id: string;
620
+ readonly type: "custom";
621
+ readonly custom: {
622
+ readonly name: string;
623
+ readonly input: string;
624
+ };
625
+ } | {
600
626
  readonly id: string;
601
627
  readonly type: "function";
602
628
  readonly function: {
@@ -608,13 +634,13 @@ export declare const routes: (Route<{
608
634
  readonly thought_signature: string;
609
635
  };
610
636
  } | undefined;
611
- }[] | undefined;
637
+ })[] | undefined;
612
638
  readonly reasoning_content?: string | undefined;
613
639
  readonly reasoning?: string | undefined;
614
640
  readonly reasoning_text?: string | undefined;
615
641
  readonly reasoning_details?: unknown;
616
642
  })[];
617
- readonly tools?: readonly {
643
+ readonly tools?: readonly ({
618
644
  readonly type: "function";
619
645
  readonly function: {
620
646
  readonly name: string;
@@ -628,12 +654,36 @@ export declare const routes: (Route<{
628
654
  readonly type: "ephemeral";
629
655
  readonly ttl?: string | undefined;
630
656
  } | undefined;
631
- }[] | undefined;
657
+ } | {
658
+ readonly type: "custom";
659
+ readonly custom: {
660
+ readonly name: string;
661
+ readonly description: string;
662
+ readonly format: {
663
+ readonly type: "text";
664
+ } | {
665
+ readonly type: "grammar";
666
+ readonly grammar: {
667
+ readonly syntax: "lark" | "regex";
668
+ readonly definition: string;
669
+ };
670
+ };
671
+ };
672
+ readonly cache_control?: {
673
+ readonly type: "ephemeral";
674
+ readonly ttl?: string | undefined;
675
+ } | undefined;
676
+ })[] | undefined;
632
677
  readonly tool_choice?: "auto" | "none" | "required" | {
633
678
  readonly type: "function";
634
679
  readonly function: {
635
680
  readonly name: string;
636
681
  };
682
+ } | {
683
+ readonly type: "custom";
684
+ readonly custom: {
685
+ readonly name: string;
686
+ };
637
687
  } | undefined;
638
688
  readonly stream: true;
639
689
  readonly stream_options?: {
@@ -673,6 +723,7 @@ export declare const configure: (input?: Config) => {
673
723
  messages: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MessagesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
674
724
  chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ChatOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
675
725
  responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
726
+ image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<MiniMaxImageOptions>;
676
727
  configure: typeof configure;
677
728
  };
678
729
  export declare const provider: {
@@ -681,10 +732,13 @@ export declare const provider: {
681
732
  messages: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MessagesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
682
733
  chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ChatOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
683
734
  responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
735
+ image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<MiniMaxImageOptions>;
684
736
  configure: typeof configure;
685
737
  };
686
- export declare const model: ProviderPackage.Definition<Settings<MessagesOptionsInput>, MessagesOptionsInput>["model"];
738
+ export declare const model: ProviderPackage.Model<Settings<MessagesOptionsInput>, MessagesOptionsInput>;
739
+ export declare const imageModel: (modelID: string, settings?: Settings<MiniMaxImageOptions>) => import("../image.js").ImageModel<MiniMaxImageOptions>;
687
740
  export declare const messages: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MessagesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
688
741
  export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ChatOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
689
742
  export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
743
+ export declare const image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<MiniMaxImageOptions>;
690
744
  export * as MiniMax from "./minimax.js";
@@ -1,5 +1,6 @@
1
1
  import { Effect, Schema } from "effect";
2
2
  import { AnthropicMessages } from "../protocols/anthropic-messages.js";
3
+ import { MiniMaxImages } from "../protocols/minimax-images.js";
3
4
  import { OpenAIChat } from "../protocols/openai-chat.js";
4
5
  import { OpenResponses } from "../protocols/open-responses.js";
5
6
  import { ProviderShared } from "../protocols/shared.js";
@@ -7,6 +8,7 @@ import { AuthOptions } from "../route/auth-options.js";
7
8
  import { Route } from "../route/client.js";
8
9
  import { Endpoint } from "../route/endpoint.js";
9
10
  import { Framing } from "../route/framing.js";
11
+ import { MediaRoute } from "../route/media.js";
10
12
  import { Protocol } from "../route/protocol.js";
11
13
  import { ProviderID } from "../schema/index.js";
12
14
  export const id = ProviderID.make("minimax");
@@ -62,10 +64,11 @@ const responsesRoute = Route.make({
62
64
  export const routes = [messagesRoute, chatRoute, responsesRoute];
63
65
  export const configure = (input = {}) => {
64
66
  const { apiKey: _apiKey, auth: _auth, baseURL, ...rest } = input;
67
+ const auth = AuthOptions.bearer(input, "MINIMAX_API_KEY");
65
68
  const defaults = {
66
69
  ...rest,
67
70
  endpoint: baseURL === undefined ? undefined : { baseURL },
68
- auth: AuthOptions.bearer(input, "MINIMAX_API_KEY"),
71
+ auth,
69
72
  };
70
73
  const messages = (modelID) => messagesRoute.with(defaults).model({ id: modelID });
71
74
  const chat = (modelID) => chatRoute.with(defaults).model({
@@ -73,17 +76,27 @@ export const configure = (input = {}) => {
73
76
  compatibility: { supportsStrictMode: false },
74
77
  });
75
78
  const responses = (modelID) => responsesRoute.with(defaults).model({ id: modelID });
76
- return { id, model: messages, messages, chat, responses, configure };
79
+ const media = MediaRoute.deployment(input, auth);
80
+ const image = (modelID, providerOptions) => MiniMaxImages.model({ ...media, id: modelID, providerOptions });
81
+ return { id, model: messages, messages, chat, responses, image, configure };
77
82
  };
78
83
  export const provider = configure();
79
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
80
- apiKey,
81
- baseURL,
82
- headers,
83
- http: body === undefined ? undefined : { body },
84
- providerOptions,
85
- }).model(modelID);
84
+ export const model = (modelID, settings) => configure(config(settings)).model(modelID);
85
+ export const imageModel = (modelID, settings) => {
86
+ const input = config(settings);
87
+ return configure(input).image(modelID, input.providerOptions);
88
+ };
86
89
  export const messages = provider.messages;
87
90
  export const chat = provider.chat;
88
91
  export const responses = provider.responses;
92
+ export const image = provider.image;
93
+ function config({ apiKey, baseURL, body, headers, ...providerOptions } = {}) {
94
+ return {
95
+ apiKey,
96
+ baseURL,
97
+ headers,
98
+ http: body === undefined ? undefined : { body },
99
+ providerOptions,
100
+ };
101
+ }
89
102
  export * as MiniMax from "./minimax.js";
@@ -5,7 +5,7 @@ import type { RouteDefaultsInput } from "../route/client.js";
5
5
  import { type ModelID } from "../schema/index.js";
6
6
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
7
7
  export type ProviderOptions = MistralChat.ProviderOptionsInput;
8
- export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
8
+ export type Config = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
9
9
  readonly baseURL?: string;
10
10
  readonly providerOptions?: ProviderOptions;
11
11
  };
@@ -195,7 +195,7 @@ export declare const routes: import("../route/client.js").Route<{
195
195
  readonly reasoning_effort?: string | undefined;
196
196
  readonly prompt_mode?: "reasoning" | undefined;
197
197
  }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
198
- export declare const configure: (input?: LanguageModelOptions) => {
198
+ export declare const configure: (input?: Config) => {
199
199
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
200
200
  model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
201
201
  configure: typeof configure;
@@ -205,5 +205,5 @@ export declare const provider: {
205
205
  model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
206
206
  configure: typeof configure;
207
207
  };
208
- export declare const model: ProviderPackage.Definition<Settings, ProviderOptions>["model"];
208
+ export declare const model: ProviderPackage.Model<Settings, ProviderOptions>;
209
209
  export * as Mistral from "./mistral.js";
@@ -18,7 +18,7 @@ export const configure = (input = {}) => {
18
18
  };
19
19
  };
20
20
  export const provider = configure();
21
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
21
+ export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions } = {}) => configure({
22
22
  apiKey,
23
23
  baseURL,
24
24
  headers,
@@ -1,4 +1,4 @@
1
1
  import type { ProviderPackage } from "../../provider-package.js";
2
2
  import { Moonshot } from "../moonshot.js";
3
3
  export type Settings = Moonshot.Settings<Moonshot.MessagesOptionsInput>;
4
- export declare const model: ProviderPackage.Definition<Settings, Moonshot.MessagesOptionsInput>["model"];
4
+ export declare const model: ProviderPackage.Model<Settings, Moonshot.MessagesOptionsInput>;
@@ -1,5 +1,5 @@
1
1
  import { Moonshot } from "../moonshot.js";
2
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => Moonshot.configure({
2
+ export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions } = {}) => Moonshot.configure({
3
3
  apiKey,
4
4
  baseURL,
5
5
  headers,
@@ -1,4 +1,4 @@
1
1
  import type { ProviderPackage } from "../../provider-package.js";
2
2
  import { Moonshot } from "../moonshot.js";
3
3
  export type Settings = Moonshot.Settings<Moonshot.ResponsesOptionsInput>;
4
- export declare const model: ProviderPackage.Definition<Settings, Moonshot.ResponsesOptionsInput>["model"];
4
+ export declare const model: ProviderPackage.Model<Settings, Moonshot.ResponsesOptionsInput>;
@@ -1,5 +1,5 @@
1
1
  import { Moonshot } from "../moonshot.js";
2
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => Moonshot.configure({
2
+ export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions } = {}) => Moonshot.configure({
3
3
  apiKey,
4
4
  baseURL,
5
5
  headers,