@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,301 @@
1
+ import type { ProviderPackage } from "../provider-package.js";
2
+ import { AnthropicMessages } from "../protocols/anthropic-messages.js";
3
+ import { Route, type RouteDefaultsInput } from "../route/client.js";
4
+ import { type ModelID } from "../schema/index.js";
5
+ import { GoogleVertexShared } from "./google-vertex-shared.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 type Config = RouteDefaultsInput & GoogleVertexShared.OAuthOptions & {
11
+ readonly baseURL?: string;
12
+ readonly location?: string;
13
+ readonly project?: string;
14
+ readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
15
+ };
16
+ export interface Settings extends ProviderPackage.Settings {
17
+ readonly accessToken?: string;
18
+ readonly apiKey?: never;
19
+ readonly baseURL?: string;
20
+ readonly location?: string;
21
+ readonly project?: string;
22
+ readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
23
+ }
24
+ export declare const routes: Route<{
25
+ anthropic_version: "vertex-2023-10-16";
26
+ metadata?: {
27
+ readonly user_id?: string | null | undefined;
28
+ } | undefined;
29
+ max_tokens: number;
30
+ tools?: readonly {
31
+ readonly description: string;
32
+ readonly name: string;
33
+ readonly input_schema: {
34
+ readonly [x: string]: unknown;
35
+ };
36
+ readonly cache_control?: {
37
+ readonly type: "ephemeral";
38
+ readonly ttl?: "1h" | "5m" | undefined;
39
+ } | undefined;
40
+ }[] | undefined;
41
+ system?: readonly {
42
+ readonly type: "text";
43
+ readonly text: string;
44
+ readonly cache_control?: {
45
+ readonly type: "ephemeral";
46
+ readonly ttl?: "1h" | "5m" | undefined;
47
+ } | undefined;
48
+ }[] | undefined;
49
+ messages: readonly ({
50
+ readonly role: "user";
51
+ readonly content: readonly ({
52
+ readonly type: "text";
53
+ readonly text: string;
54
+ readonly cache_control?: {
55
+ readonly type: "ephemeral";
56
+ readonly ttl?: "1h" | "5m" | undefined;
57
+ } | undefined;
58
+ } | {
59
+ readonly type: "image";
60
+ readonly source: {
61
+ readonly type: "base64";
62
+ readonly media_type: string;
63
+ readonly data: string;
64
+ } | {
65
+ readonly type: "url";
66
+ readonly url: string;
67
+ } | {
68
+ readonly type: "file";
69
+ readonly file_id: string;
70
+ };
71
+ readonly cache_control?: {
72
+ readonly type: "ephemeral";
73
+ readonly ttl?: "1h" | "5m" | undefined;
74
+ } | undefined;
75
+ readonly transformations?: {
76
+ readonly oversized_image?: "error" | "downsize" | undefined;
77
+ } | undefined;
78
+ } | {
79
+ readonly type: "document";
80
+ readonly source: {
81
+ readonly type: "base64";
82
+ readonly media_type: "application/pdf";
83
+ readonly data: string;
84
+ } | {
85
+ readonly type: "text";
86
+ readonly media_type: "text/plain";
87
+ readonly data: string;
88
+ } | {
89
+ readonly type: "url";
90
+ readonly url: string;
91
+ } | {
92
+ readonly type: "file";
93
+ readonly file_id: string;
94
+ };
95
+ readonly title?: string | undefined;
96
+ readonly context?: string | undefined;
97
+ readonly cache_control?: {
98
+ readonly type: "ephemeral";
99
+ readonly ttl?: "1h" | "5m" | undefined;
100
+ } | undefined;
101
+ readonly citations?: {
102
+ readonly enabled: boolean;
103
+ } | undefined;
104
+ } | {
105
+ readonly type: "tool_result";
106
+ readonly content: string | readonly ({
107
+ readonly type: "text";
108
+ readonly text: string;
109
+ readonly cache_control?: {
110
+ readonly type: "ephemeral";
111
+ readonly ttl?: "1h" | "5m" | undefined;
112
+ } | undefined;
113
+ } | {
114
+ readonly type: "image";
115
+ readonly source: {
116
+ readonly type: "base64";
117
+ readonly media_type: string;
118
+ readonly data: string;
119
+ } | {
120
+ readonly type: "url";
121
+ readonly url: string;
122
+ } | {
123
+ readonly type: "file";
124
+ readonly file_id: string;
125
+ };
126
+ readonly cache_control?: {
127
+ readonly type: "ephemeral";
128
+ readonly ttl?: "1h" | "5m" | undefined;
129
+ } | undefined;
130
+ readonly transformations?: {
131
+ readonly oversized_image?: "error" | "downsize" | undefined;
132
+ } | undefined;
133
+ } | {
134
+ readonly type: "document";
135
+ readonly source: {
136
+ readonly type: "base64";
137
+ readonly media_type: "application/pdf";
138
+ readonly data: string;
139
+ } | {
140
+ readonly type: "text";
141
+ readonly media_type: "text/plain";
142
+ readonly data: string;
143
+ } | {
144
+ readonly type: "url";
145
+ readonly url: string;
146
+ } | {
147
+ readonly type: "file";
148
+ readonly file_id: string;
149
+ };
150
+ readonly title?: string | undefined;
151
+ readonly context?: string | undefined;
152
+ readonly cache_control?: {
153
+ readonly type: "ephemeral";
154
+ readonly ttl?: "1h" | "5m" | undefined;
155
+ } | undefined;
156
+ readonly citations?: {
157
+ readonly enabled: boolean;
158
+ } | undefined;
159
+ })[];
160
+ readonly tool_use_id: string;
161
+ readonly cache_control?: {
162
+ readonly type: "ephemeral";
163
+ readonly ttl?: "1h" | "5m" | undefined;
164
+ } | undefined;
165
+ readonly is_error?: boolean | undefined;
166
+ })[];
167
+ } | {
168
+ readonly role: "assistant";
169
+ readonly content: readonly ({
170
+ readonly type: "text";
171
+ readonly text: string;
172
+ readonly cache_control?: {
173
+ readonly type: "ephemeral";
174
+ readonly ttl?: "1h" | "5m" | undefined;
175
+ } | undefined;
176
+ } | {
177
+ readonly id: string;
178
+ readonly type: "tool_use";
179
+ readonly name: string;
180
+ readonly input: unknown;
181
+ readonly cache_control?: {
182
+ readonly type: "ephemeral";
183
+ readonly ttl?: "1h" | "5m" | undefined;
184
+ } | undefined;
185
+ } | {
186
+ readonly id: string;
187
+ readonly type: "server_tool_use";
188
+ readonly name: string;
189
+ readonly input: unknown;
190
+ readonly cache_control?: {
191
+ readonly type: "ephemeral";
192
+ readonly ttl?: "1h" | "5m" | undefined;
193
+ } | undefined;
194
+ } | {
195
+ readonly type: "web_search_tool_result" | "code_execution_tool_result" | "web_fetch_tool_result";
196
+ readonly content: unknown;
197
+ readonly tool_use_id: string;
198
+ readonly cache_control?: {
199
+ readonly type: "ephemeral";
200
+ readonly ttl?: "1h" | "5m" | undefined;
201
+ } | undefined;
202
+ } | {
203
+ readonly type: "thinking";
204
+ readonly thinking: string;
205
+ readonly signature: string;
206
+ readonly cache_control?: {
207
+ readonly type: "ephemeral";
208
+ readonly ttl?: "1h" | "5m" | undefined;
209
+ } | undefined;
210
+ } | {
211
+ readonly data: string;
212
+ readonly type: "redacted_thinking";
213
+ readonly cache_control?: {
214
+ readonly type: "ephemeral";
215
+ readonly ttl?: "1h" | "5m" | undefined;
216
+ } | undefined;
217
+ } | {
218
+ readonly type: "compaction";
219
+ readonly content: string | null;
220
+ })[];
221
+ } | {
222
+ readonly role: "system";
223
+ readonly content: readonly {
224
+ readonly type: "text";
225
+ readonly text: string;
226
+ readonly cache_control?: {
227
+ readonly type: "ephemeral";
228
+ readonly ttl?: "1h" | "5m" | undefined;
229
+ } | undefined;
230
+ }[];
231
+ })[];
232
+ temperature?: number | undefined;
233
+ stream: true;
234
+ thinking?: {
235
+ readonly type: "enabled";
236
+ readonly budget_tokens: number;
237
+ readonly display?: "summarized" | "omitted" | undefined;
238
+ } | {
239
+ readonly type: "adaptive";
240
+ readonly display?: "summarized" | "omitted" | undefined;
241
+ } | {
242
+ readonly type: "disabled";
243
+ } | undefined;
244
+ service_tier?: "auto" | "standard_only" | undefined;
245
+ container?: string | {
246
+ readonly id?: string | null | undefined;
247
+ readonly skills?: readonly {
248
+ readonly [x: string]: unknown;
249
+ }[] | null | undefined;
250
+ } | null | undefined;
251
+ inference_geo?: string | null | undefined;
252
+ cache_control?: {
253
+ readonly type: "ephemeral";
254
+ readonly ttl?: "1h" | "5m" | undefined;
255
+ } | undefined;
256
+ output_config?: {
257
+ readonly format?: {
258
+ readonly type: "json_schema";
259
+ readonly schema: {
260
+ readonly [x: string]: unknown;
261
+ };
262
+ } | null | undefined;
263
+ readonly effort?: string | undefined;
264
+ } | undefined;
265
+ context_management?: {
266
+ readonly edits: readonly {
267
+ readonly type: "compact_20260112";
268
+ readonly instructions?: string | undefined;
269
+ readonly trigger?: {
270
+ readonly type: "input_tokens";
271
+ readonly value: number;
272
+ } | undefined;
273
+ readonly pause_after_compaction?: boolean | undefined;
274
+ }[];
275
+ } | undefined;
276
+ tool_choice?: {
277
+ readonly type: "auto" | "none" | "any";
278
+ readonly disable_parallel_tool_use?: boolean | undefined;
279
+ } | {
280
+ readonly type: "tool";
281
+ readonly name: string;
282
+ readonly disable_parallel_tool_use?: boolean | undefined;
283
+ } | undefined;
284
+ top_p?: number | undefined;
285
+ top_k?: number | undefined;
286
+ stop_sequences?: readonly string[] | undefined;
287
+ }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
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
+ configure: (input?: Config) => {
296
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
297
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
298
+ configure: /*elided*/ any;
299
+ };
300
+ };
301
+ export declare const model: ProviderPackage.Definition<Settings, AnthropicMessages.ProviderOptionsInput>["model"];
@@ -0,0 +1,75 @@
1
+ import { Effect, Schema, Struct } from "effect";
2
+ import { AnthropicMessages } from "../protocols/anthropic-messages.js";
3
+ import { Auth } from "../route/auth.js";
4
+ import { Route } from "../route/client.js";
5
+ import { Endpoint } from "../route/endpoint.js";
6
+ import { Protocol } from "../route/protocol.js";
7
+ import { ProviderID } from "../schema/index.js";
8
+ import { GoogleVertexShared } from "./google-vertex-shared.js";
9
+ const VERSION = "vertex-2023-10-16";
10
+ const HEADER_VERSION = "2023-06-01";
11
+ export const id = ProviderID.make("google-vertex");
12
+ const route = Route.make({
13
+ id: "google-vertex-messages",
14
+ provider: id,
15
+ providerMetadataKey: "anthropic",
16
+ protocol: Protocol.make({
17
+ id: AnthropicMessages.protocol.id,
18
+ body: {
19
+ schema: Schema.Struct({
20
+ ...Struct.omit(AnthropicMessages.AnthropicMessagesBody.fields, ["model"]),
21
+ anthropic_version: Schema.Literal(VERSION),
22
+ }),
23
+ from: (request) => AnthropicMessages.protocol.body.from(request).pipe(Effect.map((body) => ({
24
+ ...Struct.omit(body, ["model"]),
25
+ anthropic_version: VERSION,
26
+ }))),
27
+ },
28
+ stream: AnthropicMessages.protocol.stream,
29
+ }),
30
+ endpoint: Endpoint.path(({ request }) => `/${request.model.id}:streamRawPredict`),
31
+ auth: Auth.none,
32
+ transport: AnthropicMessages.transport(),
33
+ headers: () => ({ "anthropic-version": HEADER_VERSION }),
34
+ });
35
+ export const routes = [route];
36
+ const configuredRoute = (input) => {
37
+ if ("apiKey" in input && input.apiKey !== undefined)
38
+ throw new Error("Google Vertex Messages does not support API keys");
39
+ const { accessToken: _accessToken, auth: _auth, baseURL, location: inputLocation, project: inputProject, ...rest } = input;
40
+ const location = GoogleVertexShared.location(inputLocation, "global");
41
+ const project = GoogleVertexShared.project(inputProject);
42
+ return route.with({
43
+ ...rest,
44
+ endpoint: {
45
+ baseURL: baseURL ??
46
+ `https://${GoogleVertexShared.host(location)}/v1/projects/${GoogleVertexShared.requireProject(project)}/locations/${location}/publishers/anthropic/models`,
47
+ },
48
+ auth: GoogleVertexShared.oauth(input, project),
49
+ });
50
+ };
51
+ export const configure = (input = {}) => {
52
+ const route = configuredRoute(input);
53
+ return {
54
+ id,
55
+ model: (modelID) => route.model({ id: modelID }),
56
+ configure,
57
+ };
58
+ };
59
+ export const provider = {
60
+ id,
61
+ configure,
62
+ };
63
+ export const model = (modelID, settings) => {
64
+ if (settings.apiKey !== undefined)
65
+ throw new Error("Google Vertex Messages does not support API keys");
66
+ return configure({
67
+ accessToken: settings.accessToken,
68
+ baseURL: settings.baseURL,
69
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
70
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
71
+ location: settings.location,
72
+ project: settings.project,
73
+ providerOptions: settings.providerOptions,
74
+ }).model(modelID);
75
+ };
@@ -0,0 +1,198 @@
1
+ import type { ProviderPackage } from "../provider-package.js";
2
+ import { Route, type RouteDefaultsInput } from "../route/client.js";
3
+ import { type ModelID } from "../schema/index.js";
4
+ import { GoogleVertexShared } from "./google-vertex-shared.js";
5
+ import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js";
6
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
7
+ export type Config = RouteDefaultsInput & GoogleVertexShared.OAuthOptions & {
8
+ readonly baseURL?: string;
9
+ readonly location?: string;
10
+ readonly project?: string;
11
+ readonly providerOptions?: OpenResponsesProviderOptionsInput;
12
+ };
13
+ export interface Settings extends ProviderPackage.Settings {
14
+ readonly accessToken?: string;
15
+ readonly apiKey?: never;
16
+ readonly baseURL?: string;
17
+ readonly location?: string;
18
+ readonly project?: string;
19
+ readonly providerOptions?: OpenResponsesProviderOptionsInput;
20
+ }
21
+ export declare const routes: Route<{
22
+ readonly input: readonly ({
23
+ readonly [x: string]: unknown;
24
+ readonly id: string;
25
+ readonly type: "web_search_call";
26
+ readonly status?: string | undefined;
27
+ readonly action?: {
28
+ readonly [x: string]: unknown;
29
+ } | null | undefined;
30
+ } | {
31
+ readonly [x: string]: unknown;
32
+ readonly id: string;
33
+ readonly type: "file_search_call";
34
+ readonly status?: string | undefined;
35
+ readonly queries?: readonly string[] | undefined;
36
+ readonly results?: readonly {
37
+ readonly [x: string]: unknown;
38
+ }[] | null | undefined;
39
+ } | {
40
+ readonly [x: string]: unknown;
41
+ readonly id: string;
42
+ readonly type: "code_interpreter_call";
43
+ readonly status?: string | undefined;
44
+ readonly code?: string | null | undefined;
45
+ readonly container_id?: string | null | undefined;
46
+ readonly outputs?: readonly {
47
+ readonly [x: string]: unknown;
48
+ }[] | null | undefined;
49
+ } | {
50
+ readonly [x: string]: unknown;
51
+ readonly id: string;
52
+ readonly type: "mcp_call";
53
+ readonly status?: string | undefined;
54
+ readonly name?: string | undefined;
55
+ readonly output?: string | null | undefined;
56
+ readonly error?: unknown;
57
+ readonly arguments?: string | undefined;
58
+ readonly server_label?: string | undefined;
59
+ } | {
60
+ readonly type: "reasoning";
61
+ readonly summary: readonly {
62
+ readonly type: "summary_text";
63
+ readonly text: string;
64
+ }[];
65
+ readonly id?: string | undefined;
66
+ readonly encrypted_content?: string | null | undefined;
67
+ } | {
68
+ readonly type: "compaction";
69
+ readonly encrypted_content: string;
70
+ readonly id?: string | null | undefined;
71
+ } | {
72
+ readonly role: "system";
73
+ readonly content: string;
74
+ } | {
75
+ readonly role: "developer";
76
+ readonly content: string;
77
+ } | {
78
+ readonly content: readonly ({
79
+ readonly type: "input_image";
80
+ readonly image_url: string;
81
+ readonly detail?: string | undefined;
82
+ } | {
83
+ readonly type: "input_file";
84
+ readonly filename: string;
85
+ readonly detail?: string | undefined;
86
+ readonly file_data?: string | undefined;
87
+ readonly file_url?: string | undefined;
88
+ } | {
89
+ readonly type: "input_text";
90
+ readonly text: string;
91
+ })[];
92
+ readonly role: "user";
93
+ readonly id?: string | undefined;
94
+ readonly type?: "message" | undefined;
95
+ readonly status?: string | undefined;
96
+ } | {
97
+ readonly type: "message";
98
+ readonly content: readonly {
99
+ readonly type: "output_text";
100
+ readonly text: string;
101
+ }[];
102
+ readonly role: "assistant";
103
+ readonly id?: string | undefined;
104
+ readonly status?: string | undefined;
105
+ readonly phase?: "commentary" | "final_answer" | null | undefined;
106
+ } | {
107
+ readonly type: "function_call";
108
+ readonly name: string;
109
+ readonly arguments: string;
110
+ readonly call_id: string;
111
+ readonly id?: string | undefined;
112
+ readonly namespace?: string | undefined;
113
+ } | {
114
+ readonly type: "function_call_output";
115
+ readonly call_id: string;
116
+ readonly output: string | readonly ({
117
+ readonly type: "input_image";
118
+ readonly image_url: string;
119
+ readonly detail?: string | undefined;
120
+ } | {
121
+ readonly type: "input_file";
122
+ readonly filename: string;
123
+ readonly detail?: string | undefined;
124
+ readonly file_data?: string | undefined;
125
+ readonly file_url?: string | undefined;
126
+ } | {
127
+ readonly type: "input_text";
128
+ readonly text: string;
129
+ } | {
130
+ readonly type: "input_video";
131
+ readonly video_url: string;
132
+ })[];
133
+ })[];
134
+ readonly model: string;
135
+ readonly stream: true;
136
+ readonly metadata?: {
137
+ readonly [x: string]: string;
138
+ } | undefined;
139
+ readonly instructions?: string | undefined;
140
+ readonly reasoning?: {
141
+ readonly summary?: "auto" | "concise" | "detailed" | undefined;
142
+ readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
143
+ } | undefined;
144
+ readonly tools?: readonly {
145
+ readonly type: "function";
146
+ readonly description: string;
147
+ readonly name: string;
148
+ readonly parameters: {
149
+ readonly [x: string]: unknown;
150
+ };
151
+ readonly strict?: boolean | undefined;
152
+ }[] | undefined;
153
+ readonly text?: {
154
+ readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
155
+ } | undefined;
156
+ readonly temperature?: number | undefined;
157
+ readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
158
+ readonly tool_choice?: "required" | "auto" | "none" | {
159
+ readonly type: "function";
160
+ readonly name: string;
161
+ } | {
162
+ readonly type: "allowed_tools";
163
+ readonly mode: "required" | "auto" | "none";
164
+ readonly tools: readonly {
165
+ readonly type: "function";
166
+ readonly name: string;
167
+ }[];
168
+ } | undefined;
169
+ readonly top_p?: number | undefined;
170
+ readonly frequency_penalty?: number | undefined;
171
+ readonly presence_penalty?: number | undefined;
172
+ readonly prompt_cache_key?: string | undefined;
173
+ readonly parallel_tool_calls?: boolean | undefined;
174
+ readonly store?: boolean | undefined;
175
+ readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
176
+ readonly truncation?: "auto" | "disabled" | undefined;
177
+ readonly stream_options?: {
178
+ readonly include_obfuscation?: boolean | undefined;
179
+ } | undefined;
180
+ readonly safety_identifier?: string | undefined;
181
+ readonly top_logprobs?: number | undefined;
182
+ readonly max_output_tokens?: number | undefined;
183
+ readonly max_tool_calls?: number | undefined;
184
+ }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
185
+ export declare const configure: (input?: Config) => {
186
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
187
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
188
+ configure: (input?: Config) => /*elided*/ any;
189
+ };
190
+ export declare const provider: {
191
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
192
+ configure: (input?: Config) => {
193
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
194
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
195
+ configure: /*elided*/ any;
196
+ };
197
+ };
198
+ export declare const model: ProviderPackage.Definition<Settings, OpenResponsesProviderOptionsInput>["model"];
@@ -0,0 +1,56 @@
1
+ import { OpenResponses } from "../protocols/open-responses.js";
2
+ import { Route } from "../route/client.js";
3
+ import { Endpoint } from "../route/endpoint.js";
4
+ import { ProviderID } from "../schema/index.js";
5
+ import { GoogleVertexShared } from "./google-vertex-shared.js";
6
+ export const id = ProviderID.make("google-vertex");
7
+ const route = Route.make({
8
+ id: "google-vertex-responses",
9
+ provider: id,
10
+ providerMetadataKey: "vertex",
11
+ protocol: OpenResponses.protocol,
12
+ endpoint: Endpoint.path(OpenResponses.PATH),
13
+ transport: OpenResponses.httpTransport,
14
+ defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
15
+ });
16
+ export const routes = [route];
17
+ const configuredRoute = (input) => {
18
+ if ("apiKey" in input && input.apiKey !== undefined)
19
+ throw new Error("Google Vertex Responses does not support API keys");
20
+ const { accessToken: _accessToken, auth: _auth, baseURL, location: inputLocation, project: inputProject, ...rest } = input;
21
+ const location = GoogleVertexShared.location(inputLocation, "global");
22
+ const project = GoogleVertexShared.project(inputProject);
23
+ return route.with({
24
+ ...rest,
25
+ endpoint: {
26
+ baseURL: baseURL ??
27
+ `https://aiplatform.googleapis.com/v1/projects/${GoogleVertexShared.requireProject(project)}/locations/${location}/endpoints/openapi`,
28
+ },
29
+ auth: GoogleVertexShared.oauth(input, project),
30
+ });
31
+ };
32
+ export const configure = (input = {}) => {
33
+ const route = configuredRoute(input);
34
+ return {
35
+ id,
36
+ model: (modelID) => route.model({ id: modelID }),
37
+ configure,
38
+ };
39
+ };
40
+ export const provider = {
41
+ id,
42
+ configure,
43
+ };
44
+ export const model = (modelID, settings) => {
45
+ if (settings.apiKey !== undefined)
46
+ throw new Error("Google Vertex Responses does not support API keys");
47
+ return configure({
48
+ accessToken: settings.accessToken,
49
+ baseURL: settings.baseURL,
50
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
51
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
52
+ location: settings.location,
53
+ project: settings.project,
54
+ providerOptions: settings.providerOptions,
55
+ }).model(modelID);
56
+ };
@@ -0,0 +1,22 @@
1
+ import { Auth } from "../route/auth.js";
2
+ export type OAuthOptions = {
3
+ readonly accessToken?: string;
4
+ readonly auth?: never;
5
+ } | {
6
+ readonly accessToken?: never;
7
+ readonly auth?: Auth.Definition;
8
+ };
9
+ export type ApiKeyOptions = (OAuthOptions & {
10
+ readonly apiKey?: never;
11
+ }) | {
12
+ readonly accessToken?: never;
13
+ readonly apiKey?: string;
14
+ readonly auth?: never;
15
+ };
16
+ export declare const project: (value?: string) => string | undefined;
17
+ export declare const location: (value: string | undefined, fallback: string) => string;
18
+ export declare const host: (location: string) => string;
19
+ export declare const requireProject: (value: string | undefined) => string;
20
+ export declare const apiKey: (input: ApiKeyOptions) => string | undefined;
21
+ export declare const oauth: (input: OAuthOptions, project?: string) => Auth.Definition;
22
+ export * as GoogleVertexShared from "./google-vertex-shared.js";