@opencode/ai 0.0.0-beta-19275

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 (252) hide show
  1. package/README.md +682 -0
  2. package/dist/cache-policy.d.ts +2 -0
  3. package/dist/cache-policy.js +129 -0
  4. package/dist/image-client.d.ts +19 -0
  5. package/dist/image-client.js +28 -0
  6. package/dist/image.d.ts +110 -0
  7. package/dist/image.js +103 -0
  8. package/dist/index.d.ts +18 -0
  9. package/dist/index.js +12 -0
  10. package/dist/llm.d.ts +252 -0
  11. package/dist/llm.js +74 -0
  12. package/dist/protocols/anthropic-messages.d.ts +957 -0
  13. package/dist/protocols/anthropic-messages.js +1414 -0
  14. package/dist/protocols/bedrock-converse.d.ts +499 -0
  15. package/dist/protocols/bedrock-converse.js +643 -0
  16. package/dist/protocols/bedrock-event-stream.d.ts +9 -0
  17. package/dist/protocols/bedrock-event-stream.js +97 -0
  18. package/dist/protocols/gemini.d.ts +285 -0
  19. package/dist/protocols/gemini.js +671 -0
  20. package/dist/protocols/google-images.d.ts +30 -0
  21. package/dist/protocols/google-images.js +181 -0
  22. package/dist/protocols/index.d.ts +12 -0
  23. package/dist/protocols/index.js +12 -0
  24. package/dist/protocols/meta-images.d.ts +26 -0
  25. package/dist/protocols/meta-images.js +89 -0
  26. package/dist/protocols/meta-messages.d.ts +350 -0
  27. package/dist/protocols/meta-messages.js +41 -0
  28. package/dist/protocols/meta-responses.d.ts +473 -0
  29. package/dist/protocols/meta-responses.js +173 -0
  30. package/dist/protocols/mistral-chat.d.ts +540 -0
  31. package/dist/protocols/mistral-chat.js +624 -0
  32. package/dist/protocols/open-responses-channel.d.ts +23 -0
  33. package/dist/protocols/open-responses-channel.js +141 -0
  34. package/dist/protocols/open-responses-continuation.d.ts +12 -0
  35. package/dist/protocols/open-responses-continuation.js +161 -0
  36. package/dist/protocols/open-responses.d.ts +1583 -0
  37. package/dist/protocols/open-responses.js +1206 -0
  38. package/dist/protocols/openai-chat.d.ts +860 -0
  39. package/dist/protocols/openai-chat.js +966 -0
  40. package/dist/protocols/openai-compatible-chat.d.ts +109 -0
  41. package/dist/protocols/openai-compatible-chat.js +19 -0
  42. package/dist/protocols/openai-compatible-responses.d.ts +172 -0
  43. package/dist/protocols/openai-compatible-responses.js +18 -0
  44. package/dist/protocols/openai-images.d.ts +32 -0
  45. package/dist/protocols/openai-images.js +183 -0
  46. package/dist/protocols/openai-responses.d.ts +1389 -0
  47. package/dist/protocols/openai-responses.js +260 -0
  48. package/dist/protocols/shared.d.ts +193 -0
  49. package/dist/protocols/shared.js +290 -0
  50. package/dist/protocols/utils/bedrock-auth.d.ts +60 -0
  51. package/dist/protocols/utils/bedrock-auth.js +85 -0
  52. package/dist/protocols/utils/bedrock-cache.d.ts +19 -0
  53. package/dist/protocols/utils/bedrock-cache.js +49 -0
  54. package/dist/protocols/utils/bedrock-media.d.ts +55 -0
  55. package/dist/protocols/utils/bedrock-media.js +73 -0
  56. package/dist/protocols/utils/cache.d.ts +6 -0
  57. package/dist/protocols/utils/cache.js +5 -0
  58. package/dist/protocols/utils/gemini-tool-schema.d.ts +2 -0
  59. package/dist/protocols/utils/gemini-tool-schema.js +103 -0
  60. package/dist/protocols/utils/image-input.d.ts +21 -0
  61. package/dist/protocols/utils/image-input.js +20 -0
  62. package/dist/protocols/utils/lifecycle.d.ts +24 -0
  63. package/dist/protocols/utils/lifecycle.js +72 -0
  64. package/dist/protocols/utils/meta-image.d.ts +2 -0
  65. package/dist/protocols/utils/meta-image.js +13 -0
  66. package/dist/protocols/utils/open-responses-options.d.ts +56 -0
  67. package/dist/protocols/utils/open-responses-options.js +61 -0
  68. package/dist/protocols/utils/openai-image.d.ts +5 -0
  69. package/dist/protocols/utils/openai-image.js +18 -0
  70. package/dist/protocols/utils/openai-options.d.ts +16 -0
  71. package/dist/protocols/utils/openai-options.js +14 -0
  72. package/dist/protocols/utils/partial-json-options.d.ts +62 -0
  73. package/dist/protocols/utils/partial-json-options.js +52 -0
  74. package/dist/protocols/utils/partial-json.d.ts +8 -0
  75. package/dist/protocols/utils/partial-json.js +279 -0
  76. package/dist/protocols/utils/responses-checkpoint.d.ts +4 -0
  77. package/dist/protocols/utils/responses-checkpoint.js +107 -0
  78. package/dist/protocols/utils/responses-compaction.d.ts +4 -0
  79. package/dist/protocols/utils/responses-compaction.js +129 -0
  80. package/dist/protocols/utils/responses-hosted-tools.d.ts +26 -0
  81. package/dist/protocols/utils/responses-hosted-tools.js +32 -0
  82. package/dist/protocols/utils/tool-schema.d.ts +8 -0
  83. package/dist/protocols/utils/tool-schema.js +54 -0
  84. package/dist/protocols/utils/tool-stream.d.ts +710 -0
  85. package/dist/protocols/utils/tool-stream.js +155 -0
  86. package/dist/protocols/xai-images.d.ts +26 -0
  87. package/dist/protocols/xai-images.js +106 -0
  88. package/dist/protocols/xai-responses.d.ts +250 -0
  89. package/dist/protocols/xai-responses.js +81 -0
  90. package/dist/protocols/zai-images.d.ts +22 -0
  91. package/dist/protocols/zai-images.js +79 -0
  92. package/dist/protocols.d.ts +1 -0
  93. package/dist/protocols.js +1 -0
  94. package/dist/provider-error.d.ts +15 -0
  95. package/dist/provider-error.js +125 -0
  96. package/dist/provider-package.d.ts +11 -0
  97. package/dist/provider-package.js +1 -0
  98. package/dist/provider.d.ts +23 -0
  99. package/dist/provider.js +2 -0
  100. package/dist/providers/amazon-bedrock/mantle/chat.d.ts +2 -0
  101. package/dist/providers/amazon-bedrock/mantle/chat.js +1 -0
  102. package/dist/providers/amazon-bedrock/mantle/responses.d.ts +2 -0
  103. package/dist/providers/amazon-bedrock/mantle/responses.js +1 -0
  104. package/dist/providers/amazon-bedrock/mantle.d.ts +2 -0
  105. package/dist/providers/amazon-bedrock/mantle.js +1 -0
  106. package/dist/providers/amazon-bedrock-mantle.d.ts +371 -0
  107. package/dist/providers/amazon-bedrock-mantle.js +76 -0
  108. package/dist/providers/amazon-bedrock.d.ts +173 -0
  109. package/dist/providers/amazon-bedrock.js +41 -0
  110. package/dist/providers/anthropic-compatible.d.ts +304 -0
  111. package/dist/providers/anthropic-compatible.js +44 -0
  112. package/dist/providers/anthropic.d.ts +302 -0
  113. package/dist/providers/anthropic.js +39 -0
  114. package/dist/providers/azure/chat.d.ts +2 -0
  115. package/dist/providers/azure/chat.js +1 -0
  116. package/dist/providers/azure/responses.d.ts +2 -0
  117. package/dist/providers/azure/responses.js +1 -0
  118. package/dist/providers/azure.d.ts +599 -0
  119. package/dist/providers/azure.js +115 -0
  120. package/dist/providers/baseten.d.ts +229 -0
  121. package/dist/providers/baseten.js +38 -0
  122. package/dist/providers/cerebras.d.ts +228 -0
  123. package/dist/providers/cerebras.js +40 -0
  124. package/dist/providers/cloudflare-ai-gateway.d.ts +238 -0
  125. package/dist/providers/cloudflare-ai-gateway.js +59 -0
  126. package/dist/providers/cloudflare-workers-ai.d.ts +232 -0
  127. package/dist/providers/cloudflare-workers-ai.js +45 -0
  128. package/dist/providers/deepinfra.d.ts +228 -0
  129. package/dist/providers/deepinfra.js +43 -0
  130. package/dist/providers/deepseek.d.ts +229 -0
  131. package/dist/providers/deepseek.js +41 -0
  132. package/dist/providers/fireworks.d.ts +229 -0
  133. package/dist/providers/fireworks.js +38 -0
  134. package/dist/providers/google-vertex/chat.d.ts +2 -0
  135. package/dist/providers/google-vertex/chat.js +1 -0
  136. package/dist/providers/google-vertex/gemini.d.ts +2 -0
  137. package/dist/providers/google-vertex/gemini.js +1 -0
  138. package/dist/providers/google-vertex/messages.d.ts +2 -0
  139. package/dist/providers/google-vertex/messages.js +1 -0
  140. package/dist/providers/google-vertex/responses.d.ts +2 -0
  141. package/dist/providers/google-vertex/responses.js +1 -0
  142. package/dist/providers/google-vertex-chat.d.ts +133 -0
  143. package/dist/providers/google-vertex-chat.js +55 -0
  144. package/dist/providers/google-vertex-messages.d.ts +301 -0
  145. package/dist/providers/google-vertex-messages.js +75 -0
  146. package/dist/providers/google-vertex-responses.d.ts +198 -0
  147. package/dist/providers/google-vertex-responses.js +56 -0
  148. package/dist/providers/google-vertex-shared.d.ts +22 -0
  149. package/dist/providers/google-vertex-shared.js +61 -0
  150. package/dist/providers/google-vertex.d.ts +120 -0
  151. package/dist/providers/google-vertex.js +92 -0
  152. package/dist/providers/google.d.ts +115 -0
  153. package/dist/providers/google.js +42 -0
  154. package/dist/providers/groq.d.ts +315 -0
  155. package/dist/providers/groq.js +81 -0
  156. package/dist/providers/index.d.ts +28 -0
  157. package/dist/providers/index.js +28 -0
  158. package/dist/providers/meta/chat.d.ts +2 -0
  159. package/dist/providers/meta/chat.js +1 -0
  160. package/dist/providers/meta/messages.d.ts +2 -0
  161. package/dist/providers/meta/messages.js +1 -0
  162. package/dist/providers/meta/responses.d.ts +2 -0
  163. package/dist/providers/meta/responses.js +1 -0
  164. package/dist/providers/meta.d.ts +631 -0
  165. package/dist/providers/meta.js +113 -0
  166. package/dist/providers/minimax/chat.d.ts +4 -0
  167. package/dist/providers/minimax/chat.js +8 -0
  168. package/dist/providers/minimax/messages.d.ts +1 -0
  169. package/dist/providers/minimax/messages.js +1 -0
  170. package/dist/providers/minimax/responses.d.ts +4 -0
  171. package/dist/providers/minimax/responses.js +8 -0
  172. package/dist/providers/minimax.d.ts +593 -0
  173. package/dist/providers/minimax.js +89 -0
  174. package/dist/providers/mistral.d.ts +208 -0
  175. package/dist/providers/mistral.js +28 -0
  176. package/dist/providers/open-responses-options.d.ts +6 -0
  177. package/dist/providers/open-responses-options.js +1 -0
  178. package/dist/providers/openai/chat.d.ts +2 -0
  179. package/dist/providers/openai/chat.js +1 -0
  180. package/dist/providers/openai/responses.d.ts +2 -0
  181. package/dist/providers/openai/responses.js +1 -0
  182. package/dist/providers/openai-compatible/responses.d.ts +1 -0
  183. package/dist/providers/openai-compatible/responses.js +1 -0
  184. package/dist/providers/openai-compatible-responses.d.ts +196 -0
  185. package/dist/providers/openai-compatible-responses.js +32 -0
  186. package/dist/providers/openai-compatible.d.ts +131 -0
  187. package/dist/providers/openai-compatible.js +33 -0
  188. package/dist/providers/openai-options.d.ts +26 -0
  189. package/dist/providers/openai-options.js +41 -0
  190. package/dist/providers/openai.d.ts +405 -0
  191. package/dist/providers/openai.js +82 -0
  192. package/dist/providers/openrouter.d.ts +564 -0
  193. package/dist/providers/openrouter.js +114 -0
  194. package/dist/providers/togetherai.d.ts +228 -0
  195. package/dist/providers/togetherai.js +40 -0
  196. package/dist/providers/xai.d.ts +164 -0
  197. package/dist/providers/xai.js +84 -0
  198. package/dist/providers/zai.d.ts +24 -0
  199. package/dist/providers/zai.js +21 -0
  200. package/dist/providers.d.ts +1 -0
  201. package/dist/providers.js +1 -0
  202. package/dist/route/auth-options.d.ts +34 -0
  203. package/dist/route/auth-options.js +14 -0
  204. package/dist/route/auth.d.ts +51 -0
  205. package/dist/route/auth.js +87 -0
  206. package/dist/route/client.d.ts +430 -0
  207. package/dist/route/client.js +304 -0
  208. package/dist/route/endpoint.d.ts +28 -0
  209. package/dist/route/endpoint.js +21 -0
  210. package/dist/route/executor.d.ts +27 -0
  211. package/dist/route/executor.js +183 -0
  212. package/dist/route/framing.d.ts +29 -0
  213. package/dist/route/framing.js +14 -0
  214. package/dist/route/index.d.ts +16 -0
  215. package/dist/route/index.js +9 -0
  216. package/dist/route/protocol.d.ts +76 -0
  217. package/dist/route/protocol.js +16 -0
  218. package/dist/route/transport/http.d.ts +34 -0
  219. package/dist/route/transport/http.js +68 -0
  220. package/dist/route/transport/index.d.ts +41 -0
  221. package/dist/route/transport/index.js +4 -0
  222. package/dist/route/transport/websocket-channel.d.ts +57 -0
  223. package/dist/route/transport/websocket-channel.js +1 -0
  224. package/dist/route/transport/websocket.d.ts +56 -0
  225. package/dist/route/transport/websocket.js +366 -0
  226. package/dist/route.d.ts +1 -0
  227. package/dist/route.js +1 -0
  228. package/dist/schema/errors.d.ts +158 -0
  229. package/dist/schema/errors.js +120 -0
  230. package/dist/schema/events.d.ts +8123 -0
  231. package/dist/schema/events.js +550 -0
  232. package/dist/schema/ids.d.ts +17 -0
  233. package/dist/schema/ids.js +10 -0
  234. package/dist/schema/index.d.ts +5 -0
  235. package/dist/schema/index.js +5 -0
  236. package/dist/schema/messages.d.ts +646 -0
  237. package/dist/schema/messages.js +301 -0
  238. package/dist/schema/options.d.ts +157 -0
  239. package/dist/schema/options.js +187 -0
  240. package/dist/testing.d.ts +1693 -0
  241. package/dist/testing.js +129 -0
  242. package/dist/tool-history.d.ts +2 -0
  243. package/dist/tool-history.js +84 -0
  244. package/dist/tool-runtime.d.ts +15 -0
  245. package/dist/tool-runtime.js +62 -0
  246. package/dist/tool.d.ts +136 -0
  247. package/dist/tool.js +66 -0
  248. package/dist/utils/record.d.ts +2 -0
  249. package/dist/utils/record.js +2 -0
  250. package/dist/utils/sanitize.d.ts +1 -0
  251. package/dist/utils/sanitize.js +12 -0
  252. package/package.json +48 -0
@@ -0,0 +1,302 @@
1
+ import type { RouteDefaultsInput } from "../route/client.js";
2
+ import type { ProviderAuthOption } from "../route/auth-options.js";
3
+ import type { ProviderPackage } from "../provider-package.js";
4
+ import { type ModelID } from "../schema/index.js";
5
+ import { AnthropicMessages } from "../protocols/anthropic-messages.js";
6
+ export type AnthropicOptionsInput = AnthropicMessages.OptionsInput;
7
+ export type AnthropicProviderOptionsInput = AnthropicMessages.ProviderOptionsInput;
8
+ export type AnthropicThinkingInput = AnthropicMessages.ThinkingInput;
9
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
10
+ export declare const routes: import("../route/client.js").Route<{
11
+ readonly max_tokens: number;
12
+ readonly model: string;
13
+ readonly messages: readonly ({
14
+ readonly role: "user";
15
+ readonly content: readonly ({
16
+ readonly type: "text";
17
+ readonly text: string;
18
+ readonly cache_control?: {
19
+ readonly type: "ephemeral";
20
+ readonly ttl?: "1h" | "5m" | undefined;
21
+ } | undefined;
22
+ } | {
23
+ readonly type: "image";
24
+ readonly source: {
25
+ readonly type: "base64";
26
+ readonly media_type: string;
27
+ readonly data: string;
28
+ } | {
29
+ readonly type: "url";
30
+ readonly url: string;
31
+ } | {
32
+ readonly type: "file";
33
+ readonly file_id: string;
34
+ };
35
+ readonly cache_control?: {
36
+ readonly type: "ephemeral";
37
+ readonly ttl?: "1h" | "5m" | undefined;
38
+ } | undefined;
39
+ readonly transformations?: {
40
+ readonly oversized_image?: "error" | "downsize" | undefined;
41
+ } | undefined;
42
+ } | {
43
+ readonly type: "document";
44
+ readonly source: {
45
+ readonly type: "base64";
46
+ readonly media_type: "application/pdf";
47
+ readonly data: string;
48
+ } | {
49
+ readonly type: "text";
50
+ readonly media_type: "text/plain";
51
+ readonly data: string;
52
+ } | {
53
+ readonly type: "url";
54
+ readonly url: string;
55
+ } | {
56
+ readonly type: "file";
57
+ readonly file_id: string;
58
+ };
59
+ readonly title?: string | undefined;
60
+ readonly context?: string | undefined;
61
+ readonly cache_control?: {
62
+ readonly type: "ephemeral";
63
+ readonly ttl?: "1h" | "5m" | undefined;
64
+ } | undefined;
65
+ readonly citations?: {
66
+ readonly enabled: boolean;
67
+ } | undefined;
68
+ } | {
69
+ readonly type: "tool_result";
70
+ readonly content: string | readonly ({
71
+ readonly type: "text";
72
+ readonly text: string;
73
+ readonly cache_control?: {
74
+ readonly type: "ephemeral";
75
+ readonly ttl?: "1h" | "5m" | undefined;
76
+ } | undefined;
77
+ } | {
78
+ readonly type: "image";
79
+ readonly source: {
80
+ readonly type: "base64";
81
+ readonly media_type: string;
82
+ readonly data: string;
83
+ } | {
84
+ readonly type: "url";
85
+ readonly url: string;
86
+ } | {
87
+ readonly type: "file";
88
+ readonly file_id: string;
89
+ };
90
+ readonly cache_control?: {
91
+ readonly type: "ephemeral";
92
+ readonly ttl?: "1h" | "5m" | undefined;
93
+ } | undefined;
94
+ readonly transformations?: {
95
+ readonly oversized_image?: "error" | "downsize" | undefined;
96
+ } | undefined;
97
+ } | {
98
+ readonly type: "document";
99
+ readonly source: {
100
+ readonly type: "base64";
101
+ readonly media_type: "application/pdf";
102
+ readonly data: string;
103
+ } | {
104
+ readonly type: "text";
105
+ readonly media_type: "text/plain";
106
+ readonly data: string;
107
+ } | {
108
+ readonly type: "url";
109
+ readonly url: string;
110
+ } | {
111
+ readonly type: "file";
112
+ readonly file_id: string;
113
+ };
114
+ readonly title?: string | undefined;
115
+ readonly context?: string | undefined;
116
+ readonly cache_control?: {
117
+ readonly type: "ephemeral";
118
+ readonly ttl?: "1h" | "5m" | undefined;
119
+ } | undefined;
120
+ readonly citations?: {
121
+ readonly enabled: boolean;
122
+ } | undefined;
123
+ })[];
124
+ readonly tool_use_id: string;
125
+ readonly cache_control?: {
126
+ readonly type: "ephemeral";
127
+ readonly ttl?: "1h" | "5m" | undefined;
128
+ } | undefined;
129
+ readonly is_error?: boolean | undefined;
130
+ })[];
131
+ } | {
132
+ readonly role: "assistant";
133
+ readonly content: readonly ({
134
+ readonly type: "text";
135
+ readonly text: string;
136
+ readonly cache_control?: {
137
+ readonly type: "ephemeral";
138
+ readonly ttl?: "1h" | "5m" | undefined;
139
+ } | undefined;
140
+ } | {
141
+ readonly id: string;
142
+ readonly type: "tool_use";
143
+ readonly name: string;
144
+ readonly input: unknown;
145
+ readonly cache_control?: {
146
+ readonly type: "ephemeral";
147
+ readonly ttl?: "1h" | "5m" | undefined;
148
+ } | undefined;
149
+ } | {
150
+ readonly id: string;
151
+ readonly type: "server_tool_use";
152
+ readonly name: string;
153
+ readonly input: unknown;
154
+ readonly cache_control?: {
155
+ readonly type: "ephemeral";
156
+ readonly ttl?: "1h" | "5m" | undefined;
157
+ } | undefined;
158
+ } | {
159
+ readonly type: "web_search_tool_result" | "code_execution_tool_result" | "web_fetch_tool_result";
160
+ readonly content: unknown;
161
+ readonly tool_use_id: string;
162
+ readonly cache_control?: {
163
+ readonly type: "ephemeral";
164
+ readonly ttl?: "1h" | "5m" | undefined;
165
+ } | undefined;
166
+ } | {
167
+ readonly type: "thinking";
168
+ readonly thinking: string;
169
+ readonly signature: string;
170
+ readonly cache_control?: {
171
+ readonly type: "ephemeral";
172
+ readonly ttl?: "1h" | "5m" | undefined;
173
+ } | undefined;
174
+ } | {
175
+ readonly data: string;
176
+ readonly type: "redacted_thinking";
177
+ readonly cache_control?: {
178
+ readonly type: "ephemeral";
179
+ readonly ttl?: "1h" | "5m" | undefined;
180
+ } | undefined;
181
+ } | {
182
+ readonly type: "compaction";
183
+ readonly content: string | null;
184
+ })[];
185
+ } | {
186
+ readonly role: "system";
187
+ readonly content: readonly {
188
+ readonly type: "text";
189
+ readonly text: string;
190
+ readonly cache_control?: {
191
+ readonly type: "ephemeral";
192
+ readonly ttl?: "1h" | "5m" | undefined;
193
+ } | undefined;
194
+ }[];
195
+ })[];
196
+ readonly stream: true;
197
+ readonly metadata?: {
198
+ readonly user_id?: string | null | undefined;
199
+ } | undefined;
200
+ readonly tools?: readonly {
201
+ readonly description: string;
202
+ readonly name: string;
203
+ readonly input_schema: {
204
+ readonly [x: string]: unknown;
205
+ };
206
+ readonly cache_control?: {
207
+ readonly type: "ephemeral";
208
+ readonly ttl?: "1h" | "5m" | undefined;
209
+ } | undefined;
210
+ }[] | undefined;
211
+ readonly system?: readonly {
212
+ readonly type: "text";
213
+ readonly text: string;
214
+ readonly cache_control?: {
215
+ readonly type: "ephemeral";
216
+ readonly ttl?: "1h" | "5m" | undefined;
217
+ } | undefined;
218
+ }[] | undefined;
219
+ readonly temperature?: number | undefined;
220
+ readonly thinking?: {
221
+ readonly type: "enabled";
222
+ readonly budget_tokens: number;
223
+ readonly display?: "summarized" | "omitted" | undefined;
224
+ } | {
225
+ readonly type: "adaptive";
226
+ readonly display?: "summarized" | "omitted" | undefined;
227
+ } | {
228
+ readonly type: "disabled";
229
+ } | undefined;
230
+ readonly service_tier?: "auto" | "standard_only" | undefined;
231
+ readonly container?: string | {
232
+ readonly id?: string | null | undefined;
233
+ readonly skills?: readonly {
234
+ readonly [x: string]: unknown;
235
+ }[] | null | undefined;
236
+ } | null | undefined;
237
+ readonly inference_geo?: string | null | undefined;
238
+ readonly cache_control?: {
239
+ readonly type: "ephemeral";
240
+ readonly ttl?: "1h" | "5m" | undefined;
241
+ } | undefined;
242
+ readonly output_config?: {
243
+ readonly format?: {
244
+ readonly type: "json_schema";
245
+ readonly schema: {
246
+ readonly [x: string]: unknown;
247
+ };
248
+ } | null | undefined;
249
+ readonly effort?: string | undefined;
250
+ } | undefined;
251
+ readonly context_management?: {
252
+ readonly edits: readonly {
253
+ readonly type: "compact_20260112";
254
+ readonly instructions?: string | undefined;
255
+ readonly trigger?: {
256
+ readonly type: "input_tokens";
257
+ readonly value: number;
258
+ } | undefined;
259
+ readonly pause_after_compaction?: boolean | undefined;
260
+ }[];
261
+ } | undefined;
262
+ readonly tool_choice?: {
263
+ readonly type: "auto" | "none" | "any";
264
+ readonly disable_parallel_tool_use?: boolean | undefined;
265
+ } | {
266
+ readonly type: "tool";
267
+ readonly name: string;
268
+ readonly disable_parallel_tool_use?: boolean | undefined;
269
+ } | undefined;
270
+ readonly top_p?: number | undefined;
271
+ readonly top_k?: number | undefined;
272
+ readonly stop_sequences?: readonly string[] | undefined;
273
+ }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
274
+ export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
275
+ readonly baseURL?: string;
276
+ readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
277
+ };
278
+ export type Settings = ProviderPackage.Settings & ({
279
+ readonly apiKey?: string;
280
+ readonly authToken?: never;
281
+ } | {
282
+ readonly apiKey?: never;
283
+ readonly authToken?: string;
284
+ }) & {
285
+ readonly baseURL?: string;
286
+ readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
287
+ };
288
+ export declare const configure: (input?: Config) => {
289
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
290
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
291
+ configure: (input?: Config) => /*elided*/ any;
292
+ };
293
+ export declare const provider: {
294
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
295
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
296
+ configure: (input?: Config) => {
297
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
298
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
299
+ configure: /*elided*/ any;
300
+ };
301
+ };
302
+ export declare const model: ProviderPackage.Definition<Settings, AnthropicMessages.ProviderOptionsInput>["model"];
@@ -0,0 +1,39 @@
1
+ import { Auth } from "../route/auth.js";
2
+ import { ProviderID } from "../schema/index.js";
3
+ import { AnthropicMessages } from "../protocols/anthropic-messages.js";
4
+ import { AnthropicCompatible } from "./anthropic-compatible.js";
5
+ export const id = ProviderID.make("anthropic");
6
+ 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
+ };
14
+ export const configure = (input = {}) => {
15
+ const { apiKey: _, auth: _auth, baseURL, ...rest } = input;
16
+ const compatible = AnthropicCompatible.configure({
17
+ ...rest,
18
+ auth: auth(input),
19
+ baseURL: baseURL ?? AnthropicMessages.DEFAULT_BASE_URL,
20
+ provider: id,
21
+ });
22
+ return {
23
+ id,
24
+ model: (modelID) => compatible.model(modelID),
25
+ configure,
26
+ };
27
+ };
28
+ export const provider = configure();
29
+ export const model = (modelID, settings) => {
30
+ if (settings.apiKey !== undefined && settings.authToken !== undefined)
31
+ throw new Error("Anthropic apiKey cannot be combined with authToken");
32
+ return configure({
33
+ ...(settings.authToken === undefined ? { apiKey: settings.apiKey } : { auth: Auth.bearer(settings.authToken) }),
34
+ baseURL: settings.baseURL,
35
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
36
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
37
+ providerOptions: settings.providerOptions,
38
+ }).model(modelID);
39
+ };
@@ -0,0 +1,2 @@
1
+ export { chatModel as model } from "../azure.js";
2
+ export type { Settings } from "../azure.js";
@@ -0,0 +1 @@
1
+ export { chatModel as model } from "../azure.js";
@@ -0,0 +1,2 @@
1
+ export { responsesModel as model } from "../azure.js";
2
+ export type { Settings } from "../azure.js";
@@ -0,0 +1 @@
1
+ export { responsesModel as model } from "../azure.js";