@opencode/ai 2.2.4 → 2.2.6

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 (264) hide show
  1. package/README.md +133 -69
  2. package/dist/cache-policy.d.ts +1 -1
  3. package/dist/cache-policy.js +16 -4
  4. package/dist/decision-client.d.ts +3 -3
  5. package/dist/decision.d.ts +20 -125
  6. package/dist/decision.js +25 -15
  7. package/dist/effect.d.ts +4 -15
  8. package/dist/effect.js +2 -6
  9. package/dist/effort-updates.d.ts +3 -3
  10. package/dist/effort-updates.js +2 -2
  11. package/dist/experimental/cloudflare-run-extraction.d.ts +7 -3
  12. package/dist/experimental/cloudflare-run-extraction.js +4 -1
  13. package/dist/experimental/extraction.d.ts +10 -40
  14. package/dist/experimental/extraction.js +14 -13
  15. package/dist/experimental.d.ts +8 -8
  16. package/dist/experimental.js +4 -4
  17. package/dist/generation.d.ts +0 -2
  18. package/dist/generation.js +2 -2
  19. package/dist/image-client.d.ts +13 -7
  20. package/dist/image-client.js +1 -1
  21. package/dist/image.d.ts +357 -464
  22. package/dist/image.js +17 -15
  23. package/dist/index.d.ts +28 -465
  24. package/dist/index.js +18 -17
  25. package/dist/llm.d.ts +65 -266
  26. package/dist/llm.js +101 -92
  27. package/dist/loop.d.ts +38 -0
  28. package/dist/loop.js +136 -0
  29. package/dist/media-model.d.ts +1 -1
  30. package/dist/media-model.js +8 -6
  31. package/dist/media.d.ts +9 -0
  32. package/dist/media.js +37 -2
  33. package/dist/protocols/alibaba-chat.d.ts +5 -1
  34. package/dist/protocols/alibaba-chat.js +3 -3
  35. package/dist/protocols/alibaba-images.d.ts +2 -2
  36. package/dist/protocols/alibaba-messages.js +3 -3
  37. package/dist/protocols/alibaba-responses.js +8 -20
  38. package/dist/protocols/anthropic-messages.d.ts +1 -1
  39. package/dist/protocols/anthropic-messages.js +57 -185
  40. package/dist/protocols/assemblyai-transcription.d.ts +2 -2
  41. package/dist/protocols/bedrock-converse.js +11 -22
  42. package/dist/protocols/cartesia-speech.d.ts +2 -2
  43. package/dist/protocols/cloudflare-workers-ai-images.d.ts +2 -2
  44. package/dist/protocols/cohere-chat.js +9 -12
  45. package/dist/protocols/deepgram-speech.d.ts +2 -2
  46. package/dist/protocols/deepgram-transcription.d.ts +2 -2
  47. package/dist/protocols/elevenlabs-speech.d.ts +2 -2
  48. package/dist/protocols/elevenlabs-transcription.d.ts +2 -2
  49. package/dist/protocols/gemini.d.ts +3 -0
  50. package/dist/protocols/gemini.js +56 -89
  51. package/dist/protocols/google-images.d.ts +2 -2
  52. package/dist/protocols/google-interactions.d.ts +3 -4
  53. package/dist/protocols/google-interactions.js +54 -32
  54. package/dist/protocols/google-speech.d.ts +2 -2
  55. package/dist/protocols/google-transcription.d.ts +2 -2
  56. package/dist/protocols/google-video.d.ts +2 -2
  57. package/dist/protocols/meta-images.d.ts +2 -2
  58. package/dist/protocols/meta-responses.js +26 -23
  59. package/dist/protocols/minimax-images.d.ts +2 -2
  60. package/dist/protocols/mistral-chat.js +14 -20
  61. package/dist/protocols/open-responses-channel.js +6 -19
  62. package/dist/protocols/open-responses-continuation.d.ts +1 -5
  63. package/dist/protocols/open-responses-continuation.js +1 -3
  64. package/dist/protocols/open-responses.d.ts +1 -21
  65. package/dist/protocols/open-responses.js +10 -15
  66. package/dist/protocols/openai-chat.d.ts +3 -23
  67. package/dist/protocols/openai-chat.js +26 -47
  68. package/dist/protocols/openai-compatible-chat.d.ts +1 -1
  69. package/dist/protocols/openai-compatible-responses.d.ts +2 -2
  70. package/dist/protocols/openai-compatible-responses.js +1 -1
  71. package/dist/protocols/openai-decisions.js +1 -1
  72. package/dist/protocols/openai-images.d.ts +2 -2
  73. package/dist/protocols/openai-responses.js +10 -29
  74. package/dist/protocols/openai-speech.d.ts +2 -2
  75. package/dist/protocols/openai-transcription.d.ts +2 -2
  76. package/dist/protocols/runway-video.d.ts +2 -2
  77. package/dist/protocols/shared.d.ts +1 -4
  78. package/dist/protocols/shared.js +13 -11
  79. package/dist/protocols/system-one.d.ts +4 -4
  80. package/dist/protocols/utils/bedrock-cache.js +2 -5
  81. package/dist/protocols/utils/bedrock-media.d.ts +0 -3
  82. package/dist/protocols/utils/cache.d.ts +3 -0
  83. package/dist/protocols/utils/cache.js +15 -2
  84. package/dist/protocols/utils/image-sizing.d.ts +1 -1
  85. package/dist/protocols/utils/responses-checkpoint.js +1 -1
  86. package/dist/protocols/utils/responses-compaction.d.ts +1 -1
  87. package/dist/protocols/utils/responses-compaction.js +6 -5
  88. package/dist/protocols/utils/responses-hosted-tools.d.ts +97 -1
  89. package/dist/protocols/utils/responses-hosted-tools.js +31 -0
  90. package/dist/protocols/utils/tool-stream.d.ts +5 -271
  91. package/dist/protocols/utils/tool-stream.js +3 -13
  92. package/dist/protocols/venice-chat.d.ts +3 -1
  93. package/dist/protocols/venice-chat.js +4 -4
  94. package/dist/protocols/xai-images.d.ts +2 -2
  95. package/dist/protocols/xai-responses.js +5 -25
  96. package/dist/protocols/xai-video.d.ts +2 -2
  97. package/dist/protocols/zai-chat.d.ts +5 -1
  98. package/dist/protocols/zai-chat.js +1 -1
  99. package/dist/protocols/zai-images.d.ts +2 -2
  100. package/dist/protocols/zai-messages.js +3 -3
  101. package/dist/provider-error.d.ts +0 -1
  102. package/dist/provider-error.js +9 -80
  103. package/dist/providers/alibaba.d.ts +67 -4
  104. package/dist/providers/alibaba.js +6 -1
  105. package/dist/providers/amazon-bedrock-mantle.d.ts +6 -3
  106. package/dist/providers/amazon-bedrock-mantle.js +6 -3
  107. package/dist/providers/amazon-bedrock.d.ts +6 -7
  108. package/dist/providers/amazon-bedrock.js +1 -1
  109. package/dist/providers/anthropic-compatible.d.ts +7 -8
  110. package/dist/providers/anthropic-compatible.js +2 -5
  111. package/dist/providers/anthropic.d.ts +8 -9
  112. package/dist/providers/anthropic.js +2 -7
  113. package/dist/providers/assemblyai.d.ts +2 -2
  114. package/dist/providers/assemblyai.js +2 -7
  115. package/dist/providers/azure/messages.d.ts +2 -0
  116. package/dist/providers/azure/messages.js +1 -0
  117. package/dist/providers/azure.d.ts +322 -7
  118. package/dist/providers/azure.js +25 -9
  119. package/dist/providers/baseten.d.ts +5 -5
  120. package/dist/providers/baseten.js +7 -21
  121. package/dist/providers/cartesia.d.ts +1 -1
  122. package/dist/providers/cerebras.d.ts +5 -5
  123. package/dist/providers/cerebras.js +4 -15
  124. package/dist/providers/cloudflare-ai-gateway.d.ts +21 -13
  125. package/dist/providers/cloudflare-ai-gateway.js +28 -40
  126. package/dist/providers/cloudflare-shared.d.ts +9 -0
  127. package/dist/providers/cloudflare-shared.js +25 -0
  128. package/dist/providers/cloudflare-workers-ai.d.ts +4 -4
  129. package/dist/providers/cloudflare-workers-ai.js +4 -20
  130. package/dist/providers/cohere/chat.js +2 -7
  131. package/dist/providers/cohere.d.ts +6 -5
  132. package/dist/providers/cohere.js +7 -13
  133. package/dist/providers/deepgram.d.ts +2 -2
  134. package/dist/providers/deepgram.js +2 -7
  135. package/dist/providers/deepinfra.d.ts +5 -5
  136. package/dist/providers/deepinfra.js +5 -13
  137. package/dist/providers/deepseek.d.ts +5 -5
  138. package/dist/providers/deepseek.js +3 -14
  139. package/dist/providers/digitalocean.d.ts +8 -5
  140. package/dist/providers/digitalocean.js +13 -14
  141. package/dist/providers/elevenlabs.d.ts +2 -2
  142. package/dist/providers/elevenlabs.js +2 -7
  143. package/dist/providers/fireworks.d.ts +5 -5
  144. package/dist/providers/fireworks.js +4 -15
  145. package/dist/providers/google/interactions.d.ts +1 -1
  146. package/dist/providers/google/interactions.js +2 -7
  147. package/dist/providers/google-vertex-chat.d.ts +3 -3
  148. package/dist/providers/google-vertex-chat.js +3 -29
  149. package/dist/providers/google-vertex-interactions.d.ts +3 -3
  150. package/dist/providers/google-vertex-messages.d.ts +3 -3
  151. package/dist/providers/google-vertex-messages.js +3 -29
  152. package/dist/providers/google-vertex-mistral.d.ts +3 -3
  153. package/dist/providers/google-vertex-mistral.js +3 -29
  154. package/dist/providers/google-vertex-responses.d.ts +3 -3
  155. package/dist/providers/google-vertex-responses.js +4 -30
  156. package/dist/providers/google-vertex-shared.d.ts +31 -0
  157. package/dist/providers/google-vertex-shared.js +25 -0
  158. package/dist/providers/google-vertex.d.ts +3 -3
  159. package/dist/providers/google.d.ts +15 -13
  160. package/dist/providers/google.js +9 -19
  161. package/dist/providers/groq.d.ts +5 -5
  162. package/dist/providers/groq.js +4 -15
  163. package/dist/providers/meta.d.ts +5 -5
  164. package/dist/providers/meta.js +10 -24
  165. package/dist/providers/minimax/chat.js +2 -7
  166. package/dist/providers/minimax/responses.js +2 -7
  167. package/dist/providers/minimax.d.ts +5 -5
  168. package/dist/providers/minimax.js +11 -23
  169. package/dist/providers/mistral.d.ts +10 -11
  170. package/dist/providers/mistral.js +3 -14
  171. package/dist/providers/moonshot/messages.js +2 -7
  172. package/dist/providers/moonshot/responses.js +2 -7
  173. package/dist/providers/moonshot.d.ts +5 -5
  174. package/dist/providers/moonshot.js +4 -16
  175. package/dist/providers/openai-compatible-responses.d.ts +6 -7
  176. package/dist/providers/openai-compatible-responses.js +2 -8
  177. package/dist/providers/openai-compatible.d.ts +6 -7
  178. package/dist/providers/openai-compatible.js +4 -10
  179. package/dist/providers/openai.d.ts +4 -4
  180. package/dist/providers/openai.js +3 -3
  181. package/dist/providers/opencode.d.ts +4 -4
  182. package/dist/providers/opencode.js +6 -2
  183. package/dist/providers/openrouter.d.ts +8 -5
  184. package/dist/providers/openrouter.js +16 -24
  185. package/dist/providers/runway.d.ts +1 -1
  186. package/dist/providers/settings.d.ts +40 -0
  187. package/dist/providers/settings.js +19 -0
  188. package/dist/providers/togetherai.d.ts +5 -5
  189. package/dist/providers/togetherai.js +5 -15
  190. package/dist/providers/typesafe-ai.d.ts +4 -4
  191. package/dist/providers/typesafe-ai.js +6 -2
  192. package/dist/providers/venice.d.ts +4 -4
  193. package/dist/providers/venice.js +6 -2
  194. package/dist/providers/vercel-ai-gateway.d.ts +5 -5
  195. package/dist/providers/vercel-ai-gateway.js +15 -28
  196. package/dist/providers/xai.d.ts +4 -4
  197. package/dist/providers/xai.js +4 -12
  198. package/dist/providers/zai-coding-plan/messages.js +2 -7
  199. package/dist/providers/zai-coding-plan/responses.js +2 -7
  200. package/dist/providers/zai-coding-plan.d.ts +5 -5
  201. package/dist/providers/zai-coding-plan.js +8 -15
  202. package/dist/providers/zai.d.ts +5 -5
  203. package/dist/providers/zai.js +10 -22
  204. package/dist/public.d.ts +12 -0
  205. package/dist/public.js +5 -0
  206. package/dist/route/auth-options.d.ts +9 -5
  207. package/dist/route/auth-options.js +10 -7
  208. package/dist/route/client.d.ts +50 -37
  209. package/dist/route/client.js +42 -53
  210. package/dist/route/decision.d.ts +8 -8
  211. package/dist/route/decision.js +3 -3
  212. package/dist/route/executor.d.ts +5 -0
  213. package/dist/route/executor.js +10 -0
  214. package/dist/route/index.d.ts +5 -7
  215. package/dist/route/index.js +1 -1
  216. package/dist/route/media.d.ts +7 -11
  217. package/dist/route/media.js +22 -26
  218. package/dist/route/transport/http.js +6 -5
  219. package/dist/route/transport/websocket.js +7 -1
  220. package/dist/schema/errors.d.ts +16 -17
  221. package/dist/schema/errors.js +63 -12
  222. package/dist/schema/events.d.ts +2563 -2954
  223. package/dist/schema/events.js +54 -109
  224. package/dist/schema/messages.d.ts +194 -137
  225. package/dist/schema/messages.js +66 -83
  226. package/dist/schema/options.d.ts +112 -65
  227. package/dist/schema/options.js +52 -101
  228. package/dist/speech-client.d.ts +7 -7
  229. package/dist/speech.d.ts +306 -316
  230. package/dist/speech.js +16 -14
  231. package/dist/testing.d.ts +31 -175
  232. package/dist/testing.js +60 -5
  233. package/dist/tool-history.d.ts +1 -1
  234. package/dist/tool-history.js +3 -10
  235. package/dist/tool-runtime.d.ts +9 -2
  236. package/dist/tool-runtime.js +17 -31
  237. package/dist/tool.d.ts +39 -43
  238. package/dist/tool.js +16 -26
  239. package/dist/transcription-client.d.ts +7 -7
  240. package/dist/transcription.d.ts +314 -265
  241. package/dist/transcription.js +16 -14
  242. package/dist/utils/provider-codes.d.ts +3 -0
  243. package/dist/utils/provider-codes.js +41 -0
  244. package/dist/video-client.d.ts +7 -7
  245. package/dist/video-client.js +1 -1
  246. package/dist/video.d.ts +269 -287
  247. package/dist/video.js +16 -14
  248. package/package.json +9 -9
  249. package/dist/experimental/testing.d.ts +0 -3
  250. package/dist/experimental/testing.js +0 -3
  251. package/dist/testing/decision.d.ts +0 -16
  252. package/dist/testing/decision.js +0 -20
  253. package/dist/testing/image.d.ts +0 -14
  254. package/dist/testing/image.js +0 -12
  255. package/dist/testing/media.d.ts +0 -18
  256. package/dist/testing/media.js +0 -36
  257. package/dist/testing/script.d.ts +0 -28
  258. package/dist/testing/script.js +0 -60
  259. package/dist/testing/speech.d.ts +0 -14
  260. package/dist/testing/speech.js +0 -12
  261. package/dist/testing/transcription.d.ts +0 -14
  262. package/dist/testing/transcription.js +0 -12
  263. package/dist/testing/video.d.ts +0 -14
  264. package/dist/testing/video.js +0 -12
@@ -3,8 +3,8 @@ import { AlibabaChat } from "../protocols/alibaba-chat.js";
3
3
  import { AlibabaMessages } from "../protocols/alibaba-messages.js";
4
4
  import { AlibabaResponses } from "../protocols/alibaba-responses.js";
5
5
  import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js";
6
- import { Route, type RouteDefaultsInput } from "../route/client.js";
7
- import { ToolDefinition, type ModelID, type ProviderOptions } from "../schema/index.js";
6
+ import { Route } from "../route/client.js";
7
+ import { ToolDefinition, type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
8
8
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
9
9
  export type Region = "ap-southeast-1" | "cn-beijing" | "cn-hongkong" | "us-east-1" | "eu-central-1" | "ap-northeast-1" | (string & {});
10
10
  export type ChatOptionsInput = AlibabaChat.OptionsInput;
@@ -18,11 +18,11 @@ type Location = AtLeastOne<{
18
18
  }> & {
19
19
  readonly workspaceID?: string;
20
20
  };
21
- export type Config = Location & Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
21
+ export type Config = Location & Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
22
22
  readonly providerOptions?: ChatOptionsInput | MessagesOptionsInput | ResponsesOptionsInput;
23
23
  };
24
24
  export type Settings<Options = ChatOptionsInput> = Location & ProviderPackage.Settings & Options & {
25
- readonly apiKey?: string;
25
+ readonly apiKey?: string | false;
26
26
  };
27
27
  export declare const routes: (Route<{
28
28
  readonly model: string;
@@ -784,6 +784,69 @@ export declare const provider: {
784
784
  export declare const model: ProviderPackage.Model<Settings, ChatOptionsInput>;
785
785
  export declare const messagesModel: ProviderPackage.Model<Settings<MessagesOptionsInput>, MessagesOptionsInput>;
786
786
  export declare const responsesModel: ProviderPackage.Model<Settings<ResponsesOptionsInput>, ResponsesOptionsInput>;
787
+ export declare const chat: ProviderPackage.Model<Settings<{
788
+ readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
789
+ readonly enableThinking?: boolean | undefined;
790
+ readonly thinkingBudget?: number | undefined;
791
+ readonly preserveThinking?: boolean | undefined;
792
+ readonly clearThinking?: boolean | undefined;
793
+ readonly thinking?: {
794
+ readonly type: import("../schema/options.js").OpenString<"adaptive" | "disabled">;
795
+ } | undefined;
796
+ readonly toolStream?: boolean | undefined;
797
+ readonly parallelToolCalls?: boolean | undefined;
798
+ readonly repetitionPenalty?: number | undefined;
799
+ readonly responseFormat?: {
800
+ readonly type: import("../schema/options.js").OpenString<"json_object" | "json_schema" | "text">;
801
+ readonly json_schema?: {
802
+ readonly [x: string]: unknown;
803
+ } | undefined;
804
+ } | undefined;
805
+ readonly enableSearch?: boolean | undefined;
806
+ readonly searchOptions?: {
807
+ readonly forced_search?: boolean | undefined;
808
+ readonly search_strategy?: import("../schema/options.js").OpenString<"agent" | "agent_max" | "max" | "turbo"> | undefined;
809
+ readonly enable_search_extension?: boolean | undefined;
810
+ } | undefined;
811
+ }>, {
812
+ readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
813
+ readonly enableThinking?: boolean | undefined;
814
+ readonly thinkingBudget?: number | undefined;
815
+ readonly preserveThinking?: boolean | undefined;
816
+ readonly clearThinking?: boolean | undefined;
817
+ readonly thinking?: {
818
+ readonly type: import("../schema/options.js").OpenString<"adaptive" | "disabled">;
819
+ } | undefined;
820
+ readonly toolStream?: boolean | undefined;
821
+ readonly parallelToolCalls?: boolean | undefined;
822
+ readonly repetitionPenalty?: number | undefined;
823
+ readonly responseFormat?: {
824
+ readonly type: import("../schema/options.js").OpenString<"json_object" | "json_schema" | "text">;
825
+ readonly json_schema?: {
826
+ readonly [x: string]: unknown;
827
+ } | undefined;
828
+ } | undefined;
829
+ readonly enableSearch?: boolean | undefined;
830
+ readonly searchOptions?: {
831
+ readonly forced_search?: boolean | undefined;
832
+ readonly search_strategy?: import("../schema/options.js").OpenString<"agent" | "agent_max" | "max" | "turbo"> | undefined;
833
+ readonly enable_search_extension?: boolean | undefined;
834
+ } | undefined;
835
+ }, import("../route/client.js").CompactionOperations | undefined>;
836
+ export declare const messages: ProviderPackage.Model<Settings<AlibabaMessages.OptionsInput>, AlibabaMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
837
+ export declare const responses: ProviderPackage.Model<Settings<{
838
+ readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
839
+ readonly enableThinking?: boolean | undefined;
840
+ readonly store?: boolean | undefined;
841
+ readonly previousResponseId?: string | undefined;
842
+ readonly conversation?: string | undefined;
843
+ }>, {
844
+ readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
845
+ readonly enableThinking?: boolean | undefined;
846
+ readonly store?: boolean | undefined;
847
+ readonly previousResponseId?: string | undefined;
848
+ readonly conversation?: string | undefined;
849
+ }, import("../route/client.js").CompactionOperations | undefined>;
787
850
  export declare const imageModel: (id: string, settings: Settings) => import("../image.js").ImageModel<import("./alibaba.js").AlibabaImageOptions>;
788
851
  export declare const webSearch: () => ToolDefinition;
789
852
  export declare const webExtractor: () => ToolDefinition;
@@ -60,7 +60,9 @@ export const configure = (input) => {
60
60
  }
61
61
  const opts = { ...rest, auth: AuthOptions.bearer(input, ["DASHSCOPE_API_KEY", "ALIBABA_API_KEY"]) };
62
62
  const common = { ...opts, endpoint: { baseURL: baseURL ?? `https://${host}/compatible-mode/v1` } };
63
- const chat = (id) => chatRoute.with(common).model({ id, compatibility: AlibabaChat.compatibility });
63
+ const chat = (id) => chatRoute
64
+ .with(common)
65
+ .model({ id, compatibility: AlibabaChat.compatibility, capabilities: AlibabaChat.capabilities });
64
66
  const messages = (id) => messagesRoute
65
67
  .with({
66
68
  ...opts,
@@ -76,6 +78,9 @@ export const provider = { id, configure };
76
78
  export const model = (id, input) => configure(config(input)).chat(id);
77
79
  export const messagesModel = (id, input) => configure(config(input)).messages(id);
78
80
  export const responsesModel = (id, input) => configure(config(input)).responses(id);
81
+ export const chat = model;
82
+ export const messages = messagesModel;
83
+ export const responses = responsesModel;
79
84
  export const imageModel = (id, settings) => {
80
85
  const input = config(settings);
81
86
  return configure(input).image(id, input.providerOptions);
@@ -1,13 +1,13 @@
1
- import { Route, type RouteDefaultsInput } from "../route/client.js";
1
+ import { Route } from "../route/client.js";
2
2
  import type { ProviderPackage } from "../provider-package.js";
3
3
  import { AnthropicMessages } from "../protocols/anthropic-messages.js";
4
4
  import { type Credentials } from "../protocols/utils/bedrock-auth.js";
5
- import { type ModelID } from "../schema/index.js";
5
+ import { type ModelID, type RequestOptions } from "../schema/index.js";
6
6
  import { type OpenAIProviderOptionsInput } from "./openai-options.js";
7
7
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
8
8
  export type OpenAIOptionsInput = OpenAIProviderOptionsInput;
9
9
  export type MessagesOptionsInput = AnthropicMessages.ProviderOptionsInput;
10
- export type Config = Omit<RouteDefaultsInput, "providerOptions"> & {
10
+ export type Config = Omit<RequestOptions, "providerOptions"> & {
11
11
  /** Bedrock API key. Falls back to `AWS_BEARER_TOKEN_BEDROCK`; bearer auth takes precedence over SigV4. */
12
12
  readonly apiKey?: string;
13
13
  /** `sigv4` ignores `apiKey` fallbacks from the environment; `bearer` requires a token. */
@@ -731,6 +731,9 @@ export declare const provider: {
731
731
  responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
732
732
  configure: typeof configure;
733
733
  };
734
+ export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
735
+ export declare const messages: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
736
+ export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
734
737
  export declare const chatModel: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
735
738
  export declare const messagesModel: ProviderPackage.Model<MessagesSettings, AnthropicMessages.ProviderOptionsInput>;
736
739
  export declare const responsesModel: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
@@ -15,7 +15,7 @@ const responsesRoute = Route.make({
15
15
  protocol: OpenResponses.protocol,
16
16
  endpoint: Endpoint.path(OpenResponses.PATH),
17
17
  transport: OpenResponses.httpTransport,
18
- defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
18
+ options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
19
19
  });
20
20
  const chatRoute = OpenAIChat.route.with({
21
21
  id: "bedrock-mantle-chat",
@@ -32,7 +32,7 @@ const messagesRoute = Route.make({
32
32
  supportsEffortUpdates: (request) => {
33
33
  if (!(AnthropicMessages.protocol.supportsEffortUpdates?.(request) ?? false))
34
34
  return false;
35
- if (request.model.compatibility?.supportsEffortUpdates !== undefined)
35
+ if (request.model.capabilities?.reasoning?.updates !== undefined)
36
36
  return true;
37
37
  const version = claudeVersion(request.model.id);
38
38
  return version !== undefined && (version.major > 5 || (version.major === 5 && version.minor >= 1));
@@ -87,12 +87,15 @@ export const configure = (input = {}) => {
87
87
  };
88
88
  };
89
89
  export const provider = configure();
90
+ export const chat = provider.chat;
91
+ export const messages = provider.messages;
92
+ export const responses = provider.responses;
90
93
  const fromSettings = ({ apiKey, auth, baseURL, body, credentials, headers, profile, region, topP, ...providerOptions } = {}) => configure({
91
94
  apiKey,
92
95
  auth,
93
96
  baseURL,
94
97
  credentials,
95
- generation: topP === undefined ? undefined : { topP },
98
+ topP,
96
99
  headers,
97
100
  http: body === undefined ? undefined : { body },
98
101
  profile,
@@ -1,10 +1,9 @@
1
- import type { RouteDefaultsInput } from "../route/client.js";
2
1
  import type { ProviderPackage } from "../provider-package.js";
3
- import { type ModelID } from "../schema/index.js";
2
+ import { type ModelID, type RequestOptions } from "../schema/index.js";
4
3
  import * as BedrockConverse from "../protocols/bedrock-converse.js";
5
4
  import type { BedrockCredentials } from "../protocols/bedrock-converse.js";
6
5
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
7
- export type Config = RouteDefaultsInput & {
6
+ export type Config = RequestOptions & {
8
7
  /** Bedrock API key. Falls back to `AWS_BEARER_TOKEN_BEDROCK`; bearer auth takes precedence over SigV4. */
9
8
  readonly apiKey?: string;
10
9
  /** `sigv4` ignores `apiKey` fallbacks from the environment; `bearer` requires a token. */
@@ -29,7 +28,7 @@ export type Settings = ProviderPackage.Settings & BedrockConverse.OptionsInput &
29
28
  readonly region?: string;
30
29
  readonly topP?: number;
31
30
  };
32
- export declare const routes: import("../route/client.js").Route<{
31
+ export declare const routes: import("../route.js").Route<{
33
32
  readonly modelId: string;
34
33
  readonly messages: readonly ({
35
34
  readonly role: "user";
@@ -178,15 +177,15 @@ export declare const routes: import("../route/client.js").Route<{
178
177
  }, import("../route/transport/http.js").HttpPrepared<{
179
178
  readonly [x: string]: unknown;
180
179
  readonly rawBody: string;
181
- }>, import("../route/client.js").CompactionOperations | undefined>[];
180
+ }>, import("../route.js").CompactionOperations | undefined>[];
182
181
  export declare const configure: (input?: Config) => {
183
182
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
184
- model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
183
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route.js").CompactionOperations | undefined>;
185
184
  configure: typeof configure;
186
185
  };
187
186
  export declare const provider: {
188
187
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
189
- model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
188
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route.js").CompactionOperations | undefined>;
190
189
  configure: typeof configure;
191
190
  };
192
191
  export declare const model: ProviderPackage.Model<Settings, BedrockConverse.OptionsInput>;
@@ -33,7 +33,7 @@ export const model = (modelID, { apiKey, auth, baseURL, credentials, profile, re
33
33
  auth,
34
34
  baseURL,
35
35
  credentials,
36
- generation: topP === undefined ? undefined : { topP },
36
+ topP,
37
37
  headers: headers === undefined ? undefined : { ...headers },
38
38
  http: body === undefined ? undefined : { body: { ...body } },
39
39
  providerOptions,
@@ -1,19 +1,18 @@
1
1
  import type { ProviderPackage } from "../provider-package.js";
2
2
  import { AnthropicMessages } from "../protocols/anthropic-messages.js";
3
- import type { ProviderAuthOption } from "../route/auth-options.js";
4
- import type { RouteDefaultsInput } from "../route/client.js";
5
- import { type ModelID } from "../schema/index.js";
3
+ import { type ProviderAuthOption } from "../route/auth-options.js";
4
+ import { type ModelID, type RequestOptions } from "../schema/index.js";
6
5
  export type AnthropicOptionsInput = AnthropicMessages.OptionsInput;
7
6
  export type AnthropicProviderOptionsInput = AnthropicMessages.ProviderOptionsInput;
8
7
  export type AnthropicThinkingInput = AnthropicMessages.ThinkingInput;
9
8
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
10
- export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
9
+ export type Config = RequestOptions & ProviderAuthOption<"optional"> & {
11
10
  readonly provider?: string;
12
11
  readonly baseURL: string;
13
12
  readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
14
13
  };
15
14
  export type Settings = ProviderPackage.Settings & AnthropicMessages.ProviderOptionsInput & ({
16
- readonly apiKey?: string;
15
+ readonly apiKey?: string | false;
17
16
  readonly authToken?: never;
18
17
  } | {
19
18
  readonly apiKey?: never;
@@ -22,7 +21,7 @@ export type Settings = ProviderPackage.Settings & AnthropicMessages.ProviderOpti
22
21
  readonly baseURL: string;
23
22
  readonly provider?: string;
24
23
  };
25
- export declare const routes: import("../route/client.js").Route<{
24
+ export declare const routes: import("../route.js").Route<{
26
25
  readonly context_management?: {
27
26
  readonly edits: readonly {
28
27
  readonly type: "compact_20260112";
@@ -329,10 +328,10 @@ export declare const routes: import("../route/client.js").Route<{
329
328
  } | undefined;
330
329
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
331
330
  readonly speed?: import("../schema/options.js").OpenString<"fast" | "standard"> | undefined;
332
- }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
331
+ }, import("../route/transport/http.js").HttpPrepared<string>, import("../route.js").CompactionOperations | undefined>[];
333
332
  export declare const configure: (input: Config) => {
334
333
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
335
- model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
334
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route.js").CompactionOperations | undefined>;
336
335
  configure: typeof configure;
337
336
  };
338
337
  export declare const provider: {
@@ -1,14 +1,11 @@
1
1
  import { AnthropicMessages } from "../protocols/anthropic-messages.js";
2
2
  import { Auth } from "../route/auth.js";
3
+ import { AuthOptions } from "../route/auth-options.js";
3
4
  import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
4
5
  export const id = ProviderID.make("anthropic-compatible");
5
6
  const compatibleRoute = AnthropicMessages.route.with({ id: "anthropic-compatible-messages", provider: id });
6
7
  export const routes = [compatibleRoute];
7
- const auth = (input) => {
8
- if ("auth" in input && input.auth)
9
- return input.auth;
10
- return Auth.optional("apiKey" in input ? input.apiKey : undefined, "apiKey").pipe(Auth.header("x-api-key"));
11
- };
8
+ const auth = (input) => AuthOptions.apiKey(input, [], Auth.header("x-api-key"));
12
9
  export const configure = (input) => {
13
10
  const provider = input.provider ?? "anthropic-compatible";
14
11
  if (!input.baseURL)
@@ -1,13 +1,12 @@
1
- import type { RouteDefaultsInput } from "../route/client.js";
2
- import type { ProviderAuthOption } from "../route/auth-options.js";
1
+ import { type ProviderAuthOption } from "../route/auth-options.js";
3
2
  import type { ProviderPackage } from "../provider-package.js";
4
- import { type ModelID } from "../schema/index.js";
3
+ import { type ModelID, type RequestOptions } from "../schema/index.js";
5
4
  import { AnthropicMessages } from "../protocols/anthropic-messages.js";
6
5
  export type AnthropicOptionsInput = AnthropicMessages.OptionsInput;
7
6
  export type AnthropicProviderOptionsInput = AnthropicMessages.ProviderOptionsInput;
8
7
  export type AnthropicThinkingInput = AnthropicMessages.ThinkingInput;
9
8
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
10
- export declare const routes: import("../route/client.js").Route<{
9
+ export declare const routes: import("../route.js").Route<{
11
10
  readonly context_management?: {
12
11
  readonly edits: readonly {
13
12
  readonly type: "compact_20260112";
@@ -314,13 +313,13 @@ export declare const routes: import("../route/client.js").Route<{
314
313
  } | undefined;
315
314
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
316
315
  readonly speed?: import("../schema/options.js").OpenString<"fast" | "standard"> | undefined;
317
- }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
318
- export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
316
+ }, import("../route/transport/http.js").HttpPrepared<string>, import("../route.js").CompactionOperations | undefined>[];
317
+ export type Config = RequestOptions & ProviderAuthOption<"optional"> & {
319
318
  readonly baseURL?: string;
320
319
  readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
321
320
  };
322
321
  export type Settings = ProviderPackage.Settings & AnthropicMessages.ProviderOptionsInput & ({
323
- readonly apiKey?: string;
322
+ readonly apiKey?: string | false;
324
323
  readonly authToken?: never;
325
324
  } | {
326
325
  readonly apiKey?: never;
@@ -330,12 +329,12 @@ export type Settings = ProviderPackage.Settings & AnthropicMessages.ProviderOpti
330
329
  };
331
330
  export declare const configure: (input?: Config) => {
332
331
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
333
- model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
332
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route.js").CompactionOperations | undefined>;
334
333
  configure: typeof configure;
335
334
  };
336
335
  export declare const provider: {
337
336
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
338
- model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
337
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route.js").CompactionOperations | undefined>;
339
338
  configure: typeof configure;
340
339
  };
341
340
  export declare const model: ProviderPackage.Model<Settings, AnthropicMessages.ProviderOptionsInput>;
@@ -1,16 +1,11 @@
1
1
  import { Auth } from "../route/auth.js";
2
+ import { AuthOptions } from "../route/auth-options.js";
2
3
  import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
3
4
  import { AnthropicMessages } from "../protocols/anthropic-messages.js";
4
5
  import { AnthropicCompatible } from "./anthropic-compatible.js";
5
6
  export const id = ProviderID.make("anthropic");
6
7
  export const routes = [AnthropicMessages.route];
7
- const auth = (options) => {
8
- if ("auth" in options && options.auth)
9
- return options.auth;
10
- return Auth.optional("apiKey" in options ? options.apiKey : undefined, "apiKey")
11
- .orElse(Auth.config("ANTHROPIC_API_KEY"))
12
- .pipe(Auth.header("x-api-key"));
13
- };
8
+ const auth = (options) => AuthOptions.apiKey(options, "ANTHROPIC_API_KEY", Auth.header("x-api-key"));
14
9
  export const configure = (input = {}) => {
15
10
  const { apiKey: _, auth: _auth, baseURL, ...rest } = input;
16
11
  const compatible = AnthropicCompatible.configure({
@@ -1,4 +1,4 @@
1
- import type { ProviderAuthOption } from "../route/auth-options.js";
1
+ import { type ProviderAuthOption } from "../route/auth-options.js";
2
2
  import { type HttpOptions, type ModelID } from "../schema/index.js";
3
3
  export type { AssemblyAITranscriptionOptions } from "../protocols/assemblyai-transcription.js";
4
4
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -6,7 +6,7 @@ export type Config = ProviderAuthOption<"optional"> & {
6
6
  /** `https://api.eu.assemblyai.com` for the EU region. */
7
7
  readonly baseURL?: string;
8
8
  readonly headers?: Record<string, string>;
9
- readonly http?: HttpOptions.Input;
9
+ readonly http?: HttpOptions;
10
10
  };
11
11
  export declare const configure: (input?: Config) => {
12
12
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -1,16 +1,11 @@
1
1
  import { Auth } from "../route/auth.js";
2
+ import { AuthOptions } from "../route/auth-options.js";
2
3
  import { MediaRoute } from "../route/media.js";
3
4
  import { ProviderID } from "../schema/index.js";
4
5
  import { AssemblyAITranscription } from "../protocols/assemblyai-transcription.js";
5
6
  export const id = ProviderID.make("assemblyai");
6
7
  // The key is the whole `authorization` value, without a scheme.
7
- const auth = (options) => {
8
- if ("auth" in options && options.auth)
9
- return options.auth;
10
- return Auth.optional("apiKey" in options ? options.apiKey : undefined, "apiKey")
11
- .orElse(Auth.config("ASSEMBLYAI_API_KEY"))
12
- .pipe(Auth.header("authorization"));
13
- };
8
+ const auth = (options) => AuthOptions.apiKey(options, "ASSEMBLYAI_API_KEY", Auth.header("authorization"));
14
9
  export const configure = (input = {}) => {
15
10
  const media = MediaRoute.deployment(input, auth(input));
16
11
  const transcription = (modelID) => AssemblyAITranscription.model({ ...media, id: modelID });
@@ -0,0 +1,2 @@
1
+ export { messagesModel as model } from "../azure.js";
2
+ export type { MessagesSettings as Settings } from "../azure.js";
@@ -0,0 +1 @@
1
+ export { messagesModel as model } from "../azure.js";