@dexto/core 1.5.6 → 1.5.8

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 (217) hide show
  1. package/dist/agent/DextoAgent.cjs +189 -30
  2. package/dist/agent/DextoAgent.d.ts +44 -9
  3. package/dist/agent/DextoAgent.d.ts.map +1 -1
  4. package/dist/agent/DextoAgent.js +190 -31
  5. package/dist/agent/schemas.cjs +5 -0
  6. package/dist/agent/schemas.d.ts +456 -66
  7. package/dist/agent/schemas.d.ts.map +1 -1
  8. package/dist/agent/schemas.js +5 -0
  9. package/dist/context/manager.cjs +1 -1
  10. package/dist/context/manager.js +1 -1
  11. package/dist/context/utils.cjs +90 -17
  12. package/dist/context/utils.d.ts.map +1 -1
  13. package/dist/context/utils.js +90 -17
  14. package/dist/errors/types.cjs +2 -1
  15. package/dist/errors/types.d.ts +2 -1
  16. package/dist/errors/types.d.ts.map +1 -1
  17. package/dist/errors/types.js +2 -1
  18. package/dist/events/index.cjs +4 -1
  19. package/dist/events/index.d.ts +37 -2
  20. package/dist/events/index.d.ts.map +1 -1
  21. package/dist/events/index.js +4 -1
  22. package/dist/image/types.d.ts +15 -0
  23. package/dist/image/types.d.ts.map +1 -1
  24. package/dist/index.browser.d.ts +1 -1
  25. package/dist/index.browser.d.ts.map +1 -1
  26. package/dist/llm/curation-config.cjs +82 -0
  27. package/dist/llm/curation-config.d.ts +13 -0
  28. package/dist/llm/curation-config.d.ts.map +1 -0
  29. package/dist/llm/curation-config.js +59 -0
  30. package/dist/llm/curation.cjs +57 -0
  31. package/dist/llm/curation.d.ts +16 -0
  32. package/dist/llm/curation.d.ts.map +1 -0
  33. package/dist/llm/curation.js +34 -0
  34. package/dist/llm/error-codes.cjs +1 -0
  35. package/dist/llm/error-codes.d.ts +1 -0
  36. package/dist/llm/error-codes.d.ts.map +1 -1
  37. package/dist/llm/error-codes.js +1 -0
  38. package/dist/llm/errors.cjs +16 -1
  39. package/dist/llm/errors.d.ts +15 -8
  40. package/dist/llm/errors.d.ts.map +1 -1
  41. package/dist/llm/errors.js +16 -1
  42. package/dist/llm/executor/provider-options.cjs +1 -1
  43. package/dist/llm/executor/provider-options.js +1 -1
  44. package/dist/llm/executor/turn-executor.cjs +35 -2
  45. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  46. package/dist/llm/executor/turn-executor.js +35 -2
  47. package/dist/llm/index.cjs +14 -3
  48. package/dist/llm/index.d.ts +3 -1
  49. package/dist/llm/index.d.ts.map +1 -1
  50. package/dist/llm/index.js +13 -2
  51. package/dist/llm/registry/auto-update.cjs +263 -0
  52. package/dist/llm/registry/auto-update.d.ts +27 -0
  53. package/dist/llm/registry/auto-update.d.ts.map +1 -0
  54. package/dist/llm/registry/auto-update.js +227 -0
  55. package/dist/llm/registry/index.cjs +806 -0
  56. package/dist/llm/{registry.d.ts → registry/index.d.ts} +67 -13
  57. package/dist/llm/registry/index.d.ts.map +1 -0
  58. package/dist/llm/registry/index.js +756 -0
  59. package/dist/llm/registry/models.generated.cjs +4861 -0
  60. package/dist/llm/registry/models.generated.d.ts +431 -0
  61. package/dist/llm/registry/models.generated.d.ts.map +1 -0
  62. package/dist/llm/registry/models.generated.js +4838 -0
  63. package/dist/llm/registry/models.manual.cjs +44 -0
  64. package/dist/llm/registry/models.manual.d.ts +22 -0
  65. package/dist/llm/registry/models.manual.d.ts.map +1 -0
  66. package/dist/llm/registry/models.manual.js +21 -0
  67. package/dist/llm/registry/sync.cjs +354 -0
  68. package/dist/llm/registry/sync.d.ts +41 -0
  69. package/dist/llm/registry/sync.d.ts.map +1 -0
  70. package/dist/llm/registry/sync.js +328 -0
  71. package/dist/llm/resolver.cjs +29 -7
  72. package/dist/llm/resolver.d.ts +1 -1
  73. package/dist/llm/resolver.d.ts.map +1 -1
  74. package/dist/llm/resolver.js +31 -8
  75. package/dist/llm/schemas.cjs +13 -1
  76. package/dist/llm/schemas.d.ts +59 -59
  77. package/dist/llm/schemas.d.ts.map +1 -1
  78. package/dist/llm/schemas.js +14 -1
  79. package/dist/llm/services/factory.cjs +43 -27
  80. package/dist/llm/services/factory.d.ts +20 -1
  81. package/dist/llm/services/factory.d.ts.map +1 -1
  82. package/dist/llm/services/factory.js +44 -28
  83. package/dist/llm/services/test-utils.integration.cjs +5 -1
  84. package/dist/llm/services/test-utils.integration.d.ts.map +1 -1
  85. package/dist/llm/services/test-utils.integration.js +5 -1
  86. package/dist/llm/services/vercel.cjs +4 -1
  87. package/dist/llm/services/vercel.d.ts +1 -0
  88. package/dist/llm/services/vercel.d.ts.map +1 -1
  89. package/dist/llm/services/vercel.js +4 -1
  90. package/dist/llm/types.cjs +5 -2
  91. package/dist/llm/types.d.ts +1 -1
  92. package/dist/llm/types.d.ts.map +1 -1
  93. package/dist/llm/types.js +5 -2
  94. package/dist/llm/validation.cjs +1 -1
  95. package/dist/llm/validation.js +1 -1
  96. package/dist/logger/v2/dexto-logger.cjs +4 -0
  97. package/dist/logger/v2/dexto-logger.d.ts +3 -0
  98. package/dist/logger/v2/dexto-logger.d.ts.map +1 -1
  99. package/dist/logger/v2/dexto-logger.js +4 -0
  100. package/dist/logger/v2/types.d.ts +2 -0
  101. package/dist/logger/v2/types.d.ts.map +1 -1
  102. package/dist/mcp/error-codes.cjs +1 -0
  103. package/dist/mcp/error-codes.d.ts +1 -0
  104. package/dist/mcp/error-codes.d.ts.map +1 -1
  105. package/dist/mcp/error-codes.js +1 -0
  106. package/dist/mcp/errors.cjs +13 -0
  107. package/dist/mcp/errors.d.ts +7 -0
  108. package/dist/mcp/errors.d.ts.map +1 -1
  109. package/dist/mcp/errors.js +13 -0
  110. package/dist/mcp/manager.cjs +46 -4
  111. package/dist/mcp/manager.d.ts +10 -2
  112. package/dist/mcp/manager.d.ts.map +1 -1
  113. package/dist/mcp/manager.js +46 -4
  114. package/dist/mcp/mcp-client.cjs +89 -5
  115. package/dist/mcp/mcp-client.d.ts +5 -1
  116. package/dist/mcp/mcp-client.d.ts.map +1 -1
  117. package/dist/mcp/mcp-client.js +89 -5
  118. package/dist/mcp/schemas.cjs +6 -1
  119. package/dist/mcp/schemas.d.ts +1 -1
  120. package/dist/mcp/schemas.d.ts.map +1 -1
  121. package/dist/mcp/schemas.js +6 -1
  122. package/dist/mcp/types.d.ts +5 -0
  123. package/dist/mcp/types.d.ts.map +1 -1
  124. package/dist/prompts/index.d.ts +1 -1
  125. package/dist/prompts/index.d.ts.map +1 -1
  126. package/dist/prompts/prompt-manager.cjs +90 -4
  127. package/dist/prompts/prompt-manager.d.ts +16 -6
  128. package/dist/prompts/prompt-manager.d.ts.map +1 -1
  129. package/dist/prompts/prompt-manager.js +90 -4
  130. package/dist/prompts/providers/config-prompt-provider.cjs +104 -10
  131. package/dist/prompts/providers/config-prompt-provider.d.ts.map +1 -1
  132. package/dist/prompts/providers/config-prompt-provider.js +105 -11
  133. package/dist/prompts/providers/custom-prompt-provider.cjs +1 -0
  134. package/dist/prompts/providers/custom-prompt-provider.d.ts.map +1 -1
  135. package/dist/prompts/providers/custom-prompt-provider.js +1 -0
  136. package/dist/prompts/providers/mcp-prompt-provider.cjs +1 -0
  137. package/dist/prompts/providers/mcp-prompt-provider.d.ts.map +1 -1
  138. package/dist/prompts/providers/mcp-prompt-provider.js +1 -0
  139. package/dist/prompts/schemas.cjs +28 -2
  140. package/dist/prompts/schemas.d.ts +130 -0
  141. package/dist/prompts/schemas.d.ts.map +1 -1
  142. package/dist/prompts/schemas.js +28 -2
  143. package/dist/prompts/types.d.ts +55 -3
  144. package/dist/prompts/types.d.ts.map +1 -1
  145. package/dist/resources/handlers/filesystem-handler.cjs +25 -0
  146. package/dist/resources/handlers/filesystem-handler.d.ts +1 -0
  147. package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
  148. package/dist/resources/handlers/filesystem-handler.js +25 -0
  149. package/dist/session/chat-session.cjs +1 -1
  150. package/dist/session/chat-session.d.ts +1 -1
  151. package/dist/session/chat-session.d.ts.map +1 -1
  152. package/dist/session/chat-session.js +1 -1
  153. package/dist/session/index.d.ts +1 -1
  154. package/dist/session/index.d.ts.map +1 -1
  155. package/dist/session/message-queue.cjs +29 -5
  156. package/dist/session/message-queue.d.ts +3 -1
  157. package/dist/session/message-queue.d.ts.map +1 -1
  158. package/dist/session/message-queue.js +29 -5
  159. package/dist/session/session-manager.cjs +84 -3
  160. package/dist/session/session-manager.d.ts +12 -0
  161. package/dist/session/session-manager.d.ts.map +1 -1
  162. package/dist/session/session-manager.js +74 -3
  163. package/dist/session/types.d.ts +1 -0
  164. package/dist/session/types.d.ts.map +1 -1
  165. package/dist/systemPrompt/contributors.cjs +42 -0
  166. package/dist/systemPrompt/contributors.d.ts +13 -0
  167. package/dist/systemPrompt/contributors.d.ts.map +1 -1
  168. package/dist/systemPrompt/contributors.js +41 -0
  169. package/dist/tools/errors.cjs +7 -3
  170. package/dist/tools/errors.d.ts +5 -1
  171. package/dist/tools/errors.d.ts.map +1 -1
  172. package/dist/tools/errors.js +7 -3
  173. package/dist/tools/internal-tools/constants.cjs +2 -1
  174. package/dist/tools/internal-tools/constants.d.ts +1 -1
  175. package/dist/tools/internal-tools/constants.d.ts.map +1 -1
  176. package/dist/tools/internal-tools/constants.js +2 -1
  177. package/dist/tools/internal-tools/implementations/invoke-skill-tool.cjs +140 -0
  178. package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts +24 -0
  179. package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts.map +1 -0
  180. package/dist/tools/internal-tools/implementations/invoke-skill-tool.js +117 -0
  181. package/dist/tools/internal-tools/provider.cjs +15 -0
  182. package/dist/tools/internal-tools/provider.d.ts +15 -1
  183. package/dist/tools/internal-tools/provider.d.ts.map +1 -1
  184. package/dist/tools/internal-tools/provider.js +15 -0
  185. package/dist/tools/internal-tools/registry.cjs +6 -0
  186. package/dist/tools/internal-tools/registry.d.ts +35 -1
  187. package/dist/tools/internal-tools/registry.d.ts.map +1 -1
  188. package/dist/tools/internal-tools/registry.js +6 -0
  189. package/dist/tools/schemas.d.ts +1 -1
  190. package/dist/tools/schemas.d.ts.map +1 -1
  191. package/dist/tools/tool-call-metadata.cjs +75 -0
  192. package/dist/tools/tool-call-metadata.d.ts +16 -0
  193. package/dist/tools/tool-call-metadata.d.ts.map +1 -0
  194. package/dist/tools/tool-call-metadata.js +51 -0
  195. package/dist/tools/tool-manager.cjs +481 -103
  196. package/dist/tools/tool-manager.d.ts +131 -9
  197. package/dist/tools/tool-manager.d.ts.map +1 -1
  198. package/dist/tools/tool-manager.js +482 -104
  199. package/dist/utils/api-key-resolver.cjs +5 -2
  200. package/dist/utils/api-key-resolver.d.ts.map +1 -1
  201. package/dist/utils/api-key-resolver.js +5 -2
  202. package/dist/utils/env.cjs +49 -0
  203. package/dist/utils/env.d.ts +4 -0
  204. package/dist/utils/env.d.ts.map +1 -0
  205. package/dist/utils/env.js +24 -0
  206. package/dist/utils/index.cjs +3 -1
  207. package/dist/utils/index.d.ts +1 -0
  208. package/dist/utils/index.d.ts.map +1 -1
  209. package/dist/utils/index.js +1 -0
  210. package/dist/utils/service-initializer.cjs +25 -7
  211. package/dist/utils/service-initializer.d.ts +24 -1
  212. package/dist/utils/service-initializer.d.ts.map +1 -1
  213. package/dist/utils/service-initializer.js +25 -7
  214. package/package.json +6 -2
  215. package/dist/llm/registry.cjs +0 -1631
  216. package/dist/llm/registry.d.ts.map +0 -1
  217. package/dist/llm/registry.js +0 -1586
@@ -1,1586 +0,0 @@
1
- import "../chunk-PTJYTZNU.js";
2
- import { LLMError } from "./errors.js";
3
- import { LLMErrorCode } from "./error-codes.js";
4
- import { DextoRuntimeError } from "../errors/DextoRuntimeError.js";
5
- import {
6
- LLM_PROVIDERS
7
- } from "./types.js";
8
- import { getOpenRouterModelContextLength } from "./providers/openrouter-model-registry.js";
9
- const MIME_TYPE_TO_FILE_TYPE = {
10
- "application/pdf": "pdf",
11
- "audio/mp3": "audio",
12
- "audio/mpeg": "audio",
13
- "audio/wav": "audio",
14
- "audio/x-wav": "audio",
15
- "audio/wave": "audio",
16
- "audio/webm": "audio",
17
- "audio/ogg": "audio",
18
- "audio/m4a": "audio",
19
- "audio/aac": "audio",
20
- // Common image MIME types
21
- "image/jpeg": "image",
22
- "image/jpg": "image",
23
- "image/png": "image",
24
- "image/webp": "image",
25
- "image/gif": "image"
26
- };
27
- function getAllowedMimeTypes() {
28
- return Object.keys(MIME_TYPE_TO_FILE_TYPE);
29
- }
30
- const DEFAULT_MAX_INPUT_TOKENS = 128e3;
31
- const LLM_REGISTRY = {
32
- openai: {
33
- models: [
34
- // GPT-5.2 series (latest, released Dec 2025)
35
- {
36
- name: "gpt-5.2-chat-latest",
37
- displayName: "GPT-5.2 Instant",
38
- maxInputTokens: 4e5,
39
- supportedFileTypes: ["pdf", "image"],
40
- pricing: {
41
- inputPerM: 1.75,
42
- outputPerM: 14,
43
- cacheReadPerM: 0.175,
44
- currency: "USD",
45
- unit: "per_million_tokens"
46
- }
47
- },
48
- {
49
- name: "gpt-5.2",
50
- displayName: "GPT-5.2 Thinking",
51
- maxInputTokens: 4e5,
52
- supportedFileTypes: ["pdf", "image"],
53
- pricing: {
54
- inputPerM: 1.75,
55
- outputPerM: 14,
56
- cacheReadPerM: 0.175,
57
- currency: "USD",
58
- unit: "per_million_tokens"
59
- }
60
- },
61
- {
62
- name: "gpt-5.2-pro",
63
- displayName: "GPT-5.2 Pro",
64
- maxInputTokens: 4e5,
65
- supportedFileTypes: ["pdf", "image"],
66
- pricing: {
67
- inputPerM: 21,
68
- outputPerM: 168,
69
- cacheReadPerM: 2.1,
70
- currency: "USD",
71
- unit: "per_million_tokens"
72
- }
73
- },
74
- {
75
- name: "gpt-5.2-codex",
76
- displayName: "GPT-5.2 Codex",
77
- maxInputTokens: 4e5,
78
- supportedFileTypes: ["pdf", "image"],
79
- pricing: {
80
- inputPerM: 1.75,
81
- outputPerM: 14,
82
- cacheReadPerM: 0.175,
83
- currency: "USD",
84
- unit: "per_million_tokens"
85
- }
86
- },
87
- // GPT-5.1 series
88
- {
89
- name: "gpt-5.1-chat-latest",
90
- displayName: "GPT-5.1 Instant",
91
- maxInputTokens: 4e5,
92
- supportedFileTypes: ["pdf", "image"],
93
- pricing: {
94
- inputPerM: 1.25,
95
- outputPerM: 10,
96
- cacheReadPerM: 0.125,
97
- currency: "USD",
98
- unit: "per_million_tokens"
99
- }
100
- },
101
- {
102
- name: "gpt-5.1",
103
- displayName: "GPT-5.1 Thinking",
104
- maxInputTokens: 4e5,
105
- supportedFileTypes: ["pdf", "image"],
106
- pricing: {
107
- inputPerM: 1.25,
108
- outputPerM: 10,
109
- cacheReadPerM: 0.125,
110
- currency: "USD",
111
- unit: "per_million_tokens"
112
- }
113
- },
114
- {
115
- name: "gpt-5.1-codex",
116
- displayName: "GPT-5.1 Codex",
117
- maxInputTokens: 4e5,
118
- supportedFileTypes: ["pdf", "image"],
119
- pricing: {
120
- inputPerM: 1.25,
121
- outputPerM: 10,
122
- cacheReadPerM: 0.125,
123
- currency: "USD",
124
- unit: "per_million_tokens"
125
- }
126
- },
127
- {
128
- name: "gpt-5.1-codex-mini",
129
- displayName: "GPT-5.1 Codex Mini",
130
- maxInputTokens: 4e5,
131
- supportedFileTypes: ["pdf", "image"],
132
- pricing: {
133
- inputPerM: 0.25,
134
- outputPerM: 2,
135
- cacheReadPerM: 0.025,
136
- currency: "USD",
137
- unit: "per_million_tokens"
138
- }
139
- },
140
- // {
141
- // name: 'gpt-5.1-codex-max',
142
- // displayName: 'GPT-5.1 Codex Max',
143
- // maxInputTokens: 400000,
144
- // supportedFileTypes: ['pdf', 'image'],
145
- // pricing: {
146
- // inputPerM: 1.25,
147
- // outputPerM: 10.0,
148
- // cacheReadPerM: 0.125,
149
- // currency: 'USD',
150
- // unit: 'per_million_tokens',
151
- // },
152
- // },
153
- {
154
- name: "gpt-5-pro",
155
- displayName: "GPT-5 Pro",
156
- maxInputTokens: 4e5,
157
- supportedFileTypes: ["pdf", "image"],
158
- pricing: {
159
- inputPerM: 15,
160
- outputPerM: 120,
161
- cacheReadPerM: 1.5,
162
- currency: "USD",
163
- unit: "per_million_tokens"
164
- }
165
- },
166
- {
167
- name: "gpt-5",
168
- displayName: "GPT-5",
169
- maxInputTokens: 4e5,
170
- supportedFileTypes: ["pdf", "image"],
171
- pricing: {
172
- inputPerM: 1.25,
173
- outputPerM: 10,
174
- cacheReadPerM: 0.125,
175
- currency: "USD",
176
- unit: "per_million_tokens"
177
- }
178
- },
179
- {
180
- name: "gpt-5-mini",
181
- displayName: "GPT-5 Mini",
182
- maxInputTokens: 4e5,
183
- default: true,
184
- supportedFileTypes: ["pdf", "image"],
185
- pricing: {
186
- inputPerM: 0.25,
187
- outputPerM: 2,
188
- cacheReadPerM: 0.025,
189
- currency: "USD",
190
- unit: "per_million_tokens"
191
- }
192
- },
193
- {
194
- name: "gpt-5-nano",
195
- displayName: "GPT-5 Nano",
196
- maxInputTokens: 4e5,
197
- supportedFileTypes: ["pdf", "image"],
198
- pricing: {
199
- inputPerM: 0.05,
200
- outputPerM: 0.4,
201
- cacheReadPerM: 5e-3,
202
- currency: "USD",
203
- unit: "per_million_tokens"
204
- }
205
- },
206
- {
207
- name: "gpt-5-codex",
208
- displayName: "GPT-5 Codex",
209
- maxInputTokens: 4e5,
210
- supportedFileTypes: ["pdf", "image"],
211
- pricing: {
212
- inputPerM: 1.25,
213
- outputPerM: 10,
214
- cacheReadPerM: 0.125,
215
- currency: "USD",
216
- unit: "per_million_tokens"
217
- }
218
- },
219
- {
220
- name: "gpt-4.1",
221
- displayName: "GPT-4.1",
222
- maxInputTokens: 1048576,
223
- supportedFileTypes: ["pdf", "image"],
224
- pricing: {
225
- inputPerM: 2,
226
- outputPerM: 8,
227
- cacheReadPerM: 0.5,
228
- currency: "USD",
229
- unit: "per_million_tokens"
230
- }
231
- },
232
- {
233
- name: "gpt-4.1-mini",
234
- displayName: "GPT-4.1 Mini",
235
- maxInputTokens: 1048576,
236
- supportedFileTypes: ["pdf", "image"],
237
- pricing: {
238
- inputPerM: 0.4,
239
- outputPerM: 1.6,
240
- cacheReadPerM: 0.1,
241
- currency: "USD",
242
- unit: "per_million_tokens"
243
- }
244
- },
245
- {
246
- name: "gpt-4.1-nano",
247
- displayName: "GPT-4.1 Nano",
248
- maxInputTokens: 1048576,
249
- supportedFileTypes: ["pdf", "image"],
250
- pricing: {
251
- inputPerM: 0.1,
252
- outputPerM: 0.4,
253
- cacheReadPerM: 0.025,
254
- currency: "USD",
255
- unit: "per_million_tokens"
256
- }
257
- },
258
- {
259
- name: "gpt-4o",
260
- displayName: "GPT-4o",
261
- maxInputTokens: 128e3,
262
- supportedFileTypes: ["pdf", "image"],
263
- pricing: {
264
- inputPerM: 2.5,
265
- outputPerM: 10,
266
- cacheReadPerM: 1.25,
267
- currency: "USD",
268
- unit: "per_million_tokens"
269
- }
270
- },
271
- {
272
- name: "gpt-4o-mini",
273
- displayName: "GPT-4o Mini",
274
- maxInputTokens: 128e3,
275
- supportedFileTypes: ["pdf", "image"],
276
- pricing: {
277
- inputPerM: 0.15,
278
- outputPerM: 0.6,
279
- cacheReadPerM: 0.075,
280
- currency: "USD",
281
- unit: "per_million_tokens"
282
- }
283
- },
284
- {
285
- name: "gpt-4o-audio-preview",
286
- displayName: "GPT-4o Audio Preview",
287
- maxInputTokens: 128e3,
288
- supportedFileTypes: ["audio"],
289
- pricing: {
290
- inputPerM: 2.5,
291
- outputPerM: 10,
292
- cacheReadPerM: 1.25,
293
- currency: "USD",
294
- unit: "per_million_tokens"
295
- }
296
- },
297
- {
298
- name: "o4-mini",
299
- displayName: "O4 Mini",
300
- maxInputTokens: 2e5,
301
- supportedFileTypes: ["pdf", "image"],
302
- pricing: {
303
- inputPerM: 1.1,
304
- outputPerM: 4.4,
305
- cacheReadPerM: 0.275,
306
- currency: "USD",
307
- unit: "per_million_tokens"
308
- }
309
- },
310
- {
311
- name: "o3",
312
- displayName: "O3",
313
- maxInputTokens: 2e5,
314
- supportedFileTypes: ["pdf", "image"],
315
- pricing: {
316
- inputPerM: 2,
317
- outputPerM: 8,
318
- cacheReadPerM: 0.5,
319
- currency: "USD",
320
- unit: "per_million_tokens"
321
- }
322
- },
323
- {
324
- name: "o3-mini",
325
- displayName: "O3 Mini",
326
- maxInputTokens: 2e5,
327
- supportedFileTypes: [],
328
- pricing: {
329
- inputPerM: 1.1,
330
- outputPerM: 4.4,
331
- cacheReadPerM: 0.55,
332
- currency: "USD",
333
- unit: "per_million_tokens"
334
- }
335
- },
336
- {
337
- name: "o1",
338
- displayName: "O1",
339
- maxInputTokens: 2e5,
340
- supportedFileTypes: ["pdf", "image"],
341
- pricing: {
342
- inputPerM: 15,
343
- outputPerM: 60,
344
- cacheReadPerM: 7.5,
345
- currency: "USD",
346
- unit: "per_million_tokens"
347
- }
348
- }
349
- ],
350
- baseURLSupport: "none",
351
- supportedFileTypes: []
352
- // No defaults - models must explicitly specify support
353
- },
354
- "openai-compatible": {
355
- models: [],
356
- // Empty - accepts any model name for custom endpoints
357
- baseURLSupport: "required",
358
- supportedFileTypes: ["pdf", "image", "audio"],
359
- // Allow all types for custom endpoints - user assumes responsibility for model capabilities
360
- supportsCustomModels: true
361
- },
362
- anthropic: {
363
- models: [
364
- {
365
- name: "claude-haiku-4-5-20251001",
366
- displayName: "Claude 4.5 Haiku",
367
- maxInputTokens: 2e5,
368
- default: true,
369
- supportedFileTypes: ["pdf", "image"],
370
- pricing: {
371
- inputPerM: 1,
372
- outputPerM: 5,
373
- cacheWritePerM: 1.25,
374
- cacheReadPerM: 0.1,
375
- currency: "USD",
376
- unit: "per_million_tokens"
377
- }
378
- },
379
- {
380
- name: "claude-sonnet-4-5-20250929",
381
- displayName: "Claude 4.5 Sonnet",
382
- maxInputTokens: 2e5,
383
- supportedFileTypes: ["pdf", "image"],
384
- pricing: {
385
- inputPerM: 3,
386
- outputPerM: 15,
387
- cacheWritePerM: 3.75,
388
- cacheReadPerM: 0.3,
389
- currency: "USD",
390
- unit: "per_million_tokens"
391
- }
392
- },
393
- {
394
- name: "claude-opus-4-5-20251101",
395
- displayName: "Claude 4.5 Opus",
396
- maxInputTokens: 2e5,
397
- supportedFileTypes: ["pdf", "image"],
398
- pricing: {
399
- inputPerM: 5,
400
- outputPerM: 25,
401
- cacheWritePerM: 6.25,
402
- cacheReadPerM: 0.5,
403
- currency: "USD",
404
- unit: "per_million_tokens"
405
- }
406
- },
407
- {
408
- name: "claude-opus-4-1-20250805",
409
- displayName: "Claude 4.1 Opus",
410
- maxInputTokens: 2e5,
411
- supportedFileTypes: ["pdf", "image"],
412
- pricing: {
413
- inputPerM: 15,
414
- outputPerM: 75,
415
- cacheWritePerM: 18.75,
416
- cacheReadPerM: 1.5,
417
- currency: "USD",
418
- unit: "per_million_tokens"
419
- }
420
- },
421
- {
422
- name: "claude-4-opus-20250514",
423
- displayName: "Claude 4 Opus",
424
- maxInputTokens: 2e5,
425
- supportedFileTypes: ["pdf", "image"],
426
- pricing: {
427
- inputPerM: 15,
428
- outputPerM: 75,
429
- cacheWritePerM: 18.75,
430
- cacheReadPerM: 1.5,
431
- currency: "USD",
432
- unit: "per_million_tokens"
433
- }
434
- },
435
- {
436
- name: "claude-4-sonnet-20250514",
437
- displayName: "Claude 4 Sonnet",
438
- maxInputTokens: 2e5,
439
- supportedFileTypes: ["pdf", "image"],
440
- pricing: {
441
- inputPerM: 3,
442
- outputPerM: 15,
443
- cacheWritePerM: 3.75,
444
- cacheReadPerM: 0.3,
445
- currency: "USD",
446
- unit: "per_million_tokens"
447
- }
448
- },
449
- {
450
- name: "claude-3-7-sonnet-20250219",
451
- displayName: "Claude 3.7 Sonnet",
452
- maxInputTokens: 2e5,
453
- supportedFileTypes: ["pdf", "image"],
454
- pricing: {
455
- inputPerM: 3,
456
- outputPerM: 15,
457
- cacheWritePerM: 3.75,
458
- cacheReadPerM: 0.3,
459
- currency: "USD",
460
- unit: "per_million_tokens"
461
- }
462
- },
463
- {
464
- name: "claude-3-5-sonnet-20240620",
465
- displayName: "Claude 3.5 Sonnet",
466
- maxInputTokens: 2e5,
467
- supportedFileTypes: ["pdf", "image"],
468
- pricing: {
469
- inputPerM: 3,
470
- outputPerM: 15,
471
- cacheWritePerM: 3.75,
472
- cacheReadPerM: 0.3,
473
- currency: "USD",
474
- unit: "per_million_tokens"
475
- }
476
- },
477
- {
478
- name: "claude-3-5-haiku-20241022",
479
- displayName: "Claude 3.5 Haiku",
480
- maxInputTokens: 2e5,
481
- supportedFileTypes: ["pdf", "image"],
482
- pricing: {
483
- inputPerM: 0.8,
484
- outputPerM: 4,
485
- cacheWritePerM: 1,
486
- cacheReadPerM: 0.08,
487
- currency: "USD",
488
- unit: "per_million_tokens"
489
- }
490
- }
491
- ],
492
- baseURLSupport: "none",
493
- supportedFileTypes: []
494
- // No defaults - models must explicitly specify support
495
- },
496
- google: {
497
- models: [
498
- {
499
- name: "gemini-3-flash-preview",
500
- displayName: "Gemini 3 Flash Preview",
501
- maxInputTokens: 1048576,
502
- default: true,
503
- supportedFileTypes: ["pdf", "image", "audio"],
504
- pricing: {
505
- inputPerM: 0.5,
506
- outputPerM: 3,
507
- cacheReadPerM: 0.05,
508
- currency: "USD",
509
- unit: "per_million_tokens"
510
- }
511
- },
512
- {
513
- name: "gemini-3-pro-preview",
514
- displayName: "Gemini 3 Pro Preview",
515
- maxInputTokens: 1048576,
516
- supportedFileTypes: ["pdf", "image", "audio"],
517
- pricing: {
518
- inputPerM: 2,
519
- outputPerM: 12,
520
- cacheReadPerM: 0.2,
521
- currency: "USD",
522
- unit: "per_million_tokens"
523
- }
524
- },
525
- {
526
- name: "gemini-3-pro-image-preview",
527
- displayName: "Gemini 3 Pro Image Preview",
528
- maxInputTokens: 1048576,
529
- supportedFileTypes: ["image"],
530
- pricing: {
531
- inputPerM: 2,
532
- outputPerM: 120,
533
- cacheReadPerM: 0.2,
534
- currency: "USD",
535
- unit: "per_million_tokens"
536
- }
537
- },
538
- {
539
- name: "gemini-2.5-pro",
540
- displayName: "Gemini 2.5 Pro",
541
- maxInputTokens: 1048576,
542
- supportedFileTypes: ["pdf", "image", "audio"],
543
- pricing: {
544
- inputPerM: 1.25,
545
- outputPerM: 10,
546
- cacheReadPerM: 0.31,
547
- currency: "USD",
548
- unit: "per_million_tokens"
549
- }
550
- },
551
- {
552
- name: "gemini-2.5-flash",
553
- displayName: "Gemini 2.5 Flash",
554
- maxInputTokens: 1048576,
555
- supportedFileTypes: ["pdf", "image", "audio"],
556
- pricing: {
557
- inputPerM: 0.3,
558
- outputPerM: 2.5,
559
- cacheReadPerM: 0.03,
560
- currency: "USD",
561
- unit: "per_million_tokens"
562
- }
563
- },
564
- {
565
- name: "gemini-2.5-flash-lite",
566
- displayName: "Gemini 2.5 Flash Lite",
567
- maxInputTokens: 1048576,
568
- supportedFileTypes: ["pdf", "image", "audio"],
569
- pricing: {
570
- inputPerM: 0.1,
571
- outputPerM: 0.4,
572
- cacheReadPerM: 0.025,
573
- currency: "USD",
574
- unit: "per_million_tokens"
575
- }
576
- },
577
- {
578
- name: "gemini-2.0-flash",
579
- displayName: "Gemini 2.0 Flash",
580
- maxInputTokens: 1048576,
581
- supportedFileTypes: ["pdf", "image", "audio"],
582
- pricing: {
583
- inputPerM: 0.15,
584
- outputPerM: 0.6,
585
- cacheReadPerM: 0.025,
586
- cacheWritePerM: 1,
587
- currency: "USD",
588
- unit: "per_million_tokens"
589
- }
590
- },
591
- {
592
- name: "gemini-2.0-flash-lite",
593
- displayName: "Gemini 2.0 Flash Lite",
594
- maxInputTokens: 1048576,
595
- supportedFileTypes: ["pdf", "image", "audio"],
596
- pricing: {
597
- inputPerM: 0.075,
598
- outputPerM: 0.3,
599
- cacheReadPerM: 0.01875,
600
- currency: "USD",
601
- unit: "per_million_tokens"
602
- }
603
- }
604
- ],
605
- baseURLSupport: "none",
606
- supportedFileTypes: []
607
- // No defaults - models must explicitly specify support
608
- },
609
- // https://console.groq.com/docs/models
610
- groq: {
611
- models: [
612
- {
613
- name: "gemma-2-9b-it",
614
- displayName: "Gemma 2 9B Instruct",
615
- maxInputTokens: 8192,
616
- supportedFileTypes: [],
617
- pricing: {
618
- inputPerM: 0.2,
619
- outputPerM: 0.2,
620
- currency: "USD",
621
- unit: "per_million_tokens"
622
- }
623
- },
624
- {
625
- name: "openai/gpt-oss-20b",
626
- displayName: "GPT OSS 20B 128k",
627
- maxInputTokens: 128e3,
628
- supportedFileTypes: [],
629
- pricing: {
630
- inputPerM: 0.1,
631
- outputPerM: 0.5,
632
- currency: "USD",
633
- unit: "per_million_tokens"
634
- }
635
- },
636
- {
637
- name: "openai/gpt-oss-120b",
638
- displayName: "GPT OSS 120B 128k",
639
- maxInputTokens: 128e3,
640
- supportedFileTypes: [],
641
- pricing: {
642
- inputPerM: 0.15,
643
- outputPerM: 0.75,
644
- currency: "USD",
645
- unit: "per_million_tokens"
646
- }
647
- },
648
- {
649
- name: "moonshotai/kimi-k2-instruct",
650
- displayName: "Kimi K2 1T 128k",
651
- maxInputTokens: 128e3,
652
- supportedFileTypes: [],
653
- pricing: {
654
- inputPerM: 1,
655
- outputPerM: 3,
656
- cacheReadPerM: 0.5,
657
- currency: "USD",
658
- unit: "per_million_tokens"
659
- }
660
- },
661
- {
662
- name: "meta-llama/llama-4-scout-17b-16e-instruct",
663
- displayName: "Llama 4 Scout (17Bx16E) 128k",
664
- maxInputTokens: 128e3,
665
- supportedFileTypes: [],
666
- pricing: {
667
- inputPerM: 0.11,
668
- outputPerM: 0.34,
669
- currency: "USD",
670
- unit: "per_million_tokens"
671
- }
672
- },
673
- {
674
- name: "meta-llama/llama-4-maverick-17b-128e-instruct",
675
- displayName: "Llama 4 Maverick (17Bx128E) 128k",
676
- maxInputTokens: 128e3,
677
- supportedFileTypes: [],
678
- pricing: {
679
- inputPerM: 0.2,
680
- outputPerM: 0.6,
681
- currency: "USD",
682
- unit: "per_million_tokens"
683
- }
684
- },
685
- {
686
- name: "deepseek-r1-distill-llama-70b",
687
- displayName: "DeepSeek R1 Distill Llama 70B 128k",
688
- maxInputTokens: 128e3,
689
- supportedFileTypes: [],
690
- pricing: {
691
- inputPerM: 0.75,
692
- outputPerM: 0.9,
693
- currency: "USD",
694
- unit: "per_million_tokens"
695
- }
696
- },
697
- {
698
- name: "qwen/qwen3-32b",
699
- displayName: "Qwen3 32B 131k",
700
- maxInputTokens: 131e3,
701
- supportedFileTypes: [],
702
- pricing: {
703
- inputPerM: 0.29,
704
- outputPerM: 0.59,
705
- currency: "USD",
706
- unit: "per_million_tokens"
707
- }
708
- },
709
- {
710
- name: "llama-3.3-70b-versatile",
711
- displayName: "Llama 3.3 70B Versatile",
712
- maxInputTokens: 128e3,
713
- default: true,
714
- supportedFileTypes: [],
715
- pricing: {
716
- inputPerM: 0.59,
717
- outputPerM: 0.79,
718
- currency: "USD",
719
- unit: "per_million_tokens"
720
- }
721
- }
722
- ],
723
- baseURLSupport: "none",
724
- supportedFileTypes: []
725
- // Groq currently doesn't support file uploads
726
- },
727
- // https://docs.x.ai/docs/models
728
- // Note: XAI API only supports image uploads (JPG/PNG up to 20MB), not PDFs
729
- xai: {
730
- models: [
731
- {
732
- name: "grok-4",
733
- displayName: "Grok 4",
734
- maxInputTokens: 256e3,
735
- default: true,
736
- supportedFileTypes: ["image"],
737
- pricing: {
738
- inputPerM: 3,
739
- outputPerM: 15,
740
- cacheReadPerM: 0.75,
741
- currency: "USD",
742
- unit: "per_million_tokens"
743
- }
744
- },
745
- {
746
- name: "grok-3",
747
- displayName: "Grok 3",
748
- maxInputTokens: 131072,
749
- supportedFileTypes: ["image"],
750
- pricing: {
751
- inputPerM: 3,
752
- outputPerM: 15,
753
- cacheReadPerM: 0.75,
754
- currency: "USD",
755
- unit: "per_million_tokens"
756
- }
757
- },
758
- {
759
- name: "grok-3-mini",
760
- displayName: "Grok 3 Mini",
761
- maxInputTokens: 131072,
762
- supportedFileTypes: ["image"],
763
- pricing: {
764
- inputPerM: 0.3,
765
- outputPerM: 0.5,
766
- cacheReadPerM: 0.075,
767
- currency: "USD",
768
- unit: "per_million_tokens"
769
- }
770
- },
771
- {
772
- name: "grok-code-fast-1",
773
- displayName: "Grok Code Fast",
774
- maxInputTokens: 131072,
775
- supportedFileTypes: [],
776
- pricing: {
777
- inputPerM: 0.2,
778
- outputPerM: 1.5,
779
- cacheReadPerM: 0.02,
780
- currency: "USD",
781
- unit: "per_million_tokens"
782
- }
783
- }
784
- ],
785
- baseURLSupport: "none",
786
- supportedFileTypes: []
787
- // XAI currently doesn't support file uploads
788
- },
789
- // https://docs.cohere.com/reference/models
790
- cohere: {
791
- models: [
792
- {
793
- name: "command-a-03-2025",
794
- displayName: "Command A (03-2025)",
795
- maxInputTokens: 256e3,
796
- default: true,
797
- supportedFileTypes: [],
798
- pricing: {
799
- inputPerM: 2.5,
800
- outputPerM: 10,
801
- currency: "USD",
802
- unit: "per_million_tokens"
803
- }
804
- },
805
- {
806
- name: "command-r-plus",
807
- displayName: "Command R+",
808
- maxInputTokens: 128e3,
809
- supportedFileTypes: [],
810
- pricing: {
811
- inputPerM: 2.5,
812
- outputPerM: 10,
813
- currency: "USD",
814
- unit: "per_million_tokens"
815
- }
816
- },
817
- {
818
- name: "command-r",
819
- displayName: "Command R",
820
- maxInputTokens: 128e3,
821
- supportedFileTypes: [],
822
- pricing: {
823
- inputPerM: 0.15,
824
- outputPerM: 0.6,
825
- currency: "USD",
826
- unit: "per_million_tokens"
827
- }
828
- },
829
- {
830
- name: "command-r7b",
831
- displayName: "Command R7B",
832
- maxInputTokens: 128e3,
833
- supportedFileTypes: [],
834
- pricing: {
835
- inputPerM: 0.0375,
836
- outputPerM: 0.15,
837
- currency: "USD",
838
- unit: "per_million_tokens"
839
- }
840
- }
841
- ],
842
- baseURLSupport: "none",
843
- supportedFileTypes: []
844
- // Cohere currently doesn't support file uploads
845
- },
846
- // https://openrouter.ai/docs
847
- // OpenRouter is a unified API gateway providing access to 100+ models from various providers.
848
- // Model validation is handled dynamically via openrouter-model-registry.ts
849
- openrouter: {
850
- models: [],
851
- // Empty - accepts any model name (validated against OpenRouter's catalog)
852
- baseURLSupport: "none",
853
- // Fixed endpoint - baseURL auto-injected in resolver, no user override allowed
854
- supportedFileTypes: ["pdf", "image", "audio"],
855
- // Allow all types - user assumes responsibility for model capabilities
856
- supportsCustomModels: true
857
- },
858
- // https://docs.litellm.ai/
859
- // LiteLLM is an OpenAI-compatible proxy that unifies 100+ LLM providers.
860
- // User must host their own LiteLLM proxy and provide the baseURL.
861
- litellm: {
862
- models: [],
863
- // Empty - accepts any model name (user's proxy determines available models)
864
- baseURLSupport: "required",
865
- // User must provide their LiteLLM proxy URL
866
- supportedFileTypes: ["pdf", "image", "audio"],
867
- // Allow all types - user assumes responsibility for model capabilities
868
- supportsCustomModels: true
869
- },
870
- // https://glama.ai/
871
- // Glama is an OpenAI-compatible gateway providing unified access to multiple LLM providers.
872
- // Fixed endpoint: https://glama.ai/api/gateway/openai/v1
873
- glama: {
874
- models: [],
875
- // Empty - accepts any model name (format: provider/model e.g., openai/gpt-4o)
876
- baseURLSupport: "none",
877
- // Fixed endpoint - baseURL auto-injected
878
- supportedFileTypes: ["pdf", "image", "audio"],
879
- // Allow all types - user assumes responsibility for model capabilities
880
- supportsCustomModels: true
881
- },
882
- // https://cloud.google.com/vertex-ai
883
- // Google Vertex AI - GCP-hosted gateway for Gemini and Claude models
884
- // Supports both Google's Gemini models and Anthropic's Claude via partnership
885
- //
886
- // Setup instructions:
887
- // 1. Create a Google Cloud account and project
888
- // 2. Enable the Vertex AI API: gcloud services enable aiplatform.googleapis.com
889
- // 3. Enable desired Claude models (requires Anthropic Model Garden)
890
- // 4. Install Google Cloud CLI: https://cloud.google.com/sdk/docs/install
891
- // 5. Configure ADC: gcloud auth application-default login
892
- // 6. Set env vars: GOOGLE_VERTEX_PROJECT (required), GOOGLE_VERTEX_LOCATION (optional)
893
- //
894
- // TODO: Add dynamic model fetching via publishers.models.list API
895
- // - Requires: projectId, region, ADC auth
896
- // - Endpoints: GET projects/{project}/locations/{location}/publishers/{google,anthropic}/models
897
- // - Note: API doesn't return aliases (e.g., gemini-2.0-flash), only versioned IDs
898
- // - Docs: https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.models/list
899
- // - Models: https://cloud.google.com/vertex-ai/generative-ai/docs/models
900
- vertex: {
901
- models: [
902
- // Gemini 3 models on Vertex AI (Preview)
903
- {
904
- name: "gemini-3-flash-preview",
905
- displayName: "Gemini 3 Flash (Vertex)",
906
- maxInputTokens: 1048576,
907
- default: true,
908
- supportedFileTypes: ["pdf", "image", "audio"],
909
- pricing: {
910
- inputPerM: 0.5,
911
- outputPerM: 3,
912
- cacheReadPerM: 0.05,
913
- currency: "USD",
914
- unit: "per_million_tokens"
915
- }
916
- },
917
- {
918
- name: "gemini-3-pro-preview",
919
- displayName: "Gemini 3 Pro (Vertex)",
920
- maxInputTokens: 1048576,
921
- supportedFileTypes: ["pdf", "image", "audio"],
922
- pricing: {
923
- inputPerM: 2,
924
- outputPerM: 12,
925
- cacheReadPerM: 0.2,
926
- currency: "USD",
927
- unit: "per_million_tokens"
928
- }
929
- },
930
- // Gemini 2.x models on Vertex AI
931
- {
932
- name: "gemini-2.5-pro",
933
- displayName: "Gemini 2.5 Pro (Vertex)",
934
- maxInputTokens: 1048576,
935
- supportedFileTypes: ["pdf", "image", "audio"],
936
- pricing: {
937
- inputPerM: 1.25,
938
- outputPerM: 10,
939
- cacheReadPerM: 0.31,
940
- currency: "USD",
941
- unit: "per_million_tokens"
942
- }
943
- },
944
- {
945
- name: "gemini-2.5-flash",
946
- displayName: "Gemini 2.5 Flash (Vertex)",
947
- maxInputTokens: 1048576,
948
- supportedFileTypes: ["pdf", "image", "audio"],
949
- pricing: {
950
- inputPerM: 0.15,
951
- outputPerM: 0.6,
952
- cacheReadPerM: 0.0375,
953
- currency: "USD",
954
- unit: "per_million_tokens"
955
- }
956
- },
957
- {
958
- name: "gemini-2.0-flash",
959
- displayName: "Gemini 2.0 Flash (Vertex)",
960
- maxInputTokens: 1048576,
961
- supportedFileTypes: ["pdf", "image", "audio"],
962
- pricing: {
963
- inputPerM: 0.1,
964
- outputPerM: 0.4,
965
- cacheReadPerM: 0.025,
966
- currency: "USD",
967
- unit: "per_million_tokens"
968
- }
969
- },
970
- // Claude 4.5 models on Vertex AI (via Anthropic partnership)
971
- // Note: Claude model IDs use @ suffix format on Vertex
972
- {
973
- name: "claude-opus-4-5@20251101",
974
- displayName: "Claude 4.5 Opus (Vertex)",
975
- maxInputTokens: 2e5,
976
- supportedFileTypes: ["pdf", "image"],
977
- pricing: {
978
- inputPerM: 5,
979
- outputPerM: 25,
980
- cacheWritePerM: 6.25,
981
- cacheReadPerM: 0.5,
982
- currency: "USD",
983
- unit: "per_million_tokens"
984
- }
985
- },
986
- {
987
- name: "claude-sonnet-4-5@20250929",
988
- displayName: "Claude 4.5 Sonnet (Vertex)",
989
- maxInputTokens: 2e5,
990
- supportedFileTypes: ["pdf", "image"],
991
- pricing: {
992
- inputPerM: 3,
993
- outputPerM: 15,
994
- cacheWritePerM: 3.75,
995
- cacheReadPerM: 0.3,
996
- currency: "USD",
997
- unit: "per_million_tokens"
998
- }
999
- },
1000
- {
1001
- name: "claude-haiku-4-5@20251001",
1002
- displayName: "Claude 4.5 Haiku (Vertex)",
1003
- maxInputTokens: 2e5,
1004
- supportedFileTypes: ["pdf", "image"],
1005
- pricing: {
1006
- inputPerM: 1,
1007
- outputPerM: 5,
1008
- cacheWritePerM: 1.25,
1009
- cacheReadPerM: 0.1,
1010
- currency: "USD",
1011
- unit: "per_million_tokens"
1012
- }
1013
- },
1014
- // Claude 4.1 and 4.0 models on Vertex AI
1015
- {
1016
- name: "claude-opus-4-1@20250805",
1017
- displayName: "Claude 4.1 Opus (Vertex)",
1018
- maxInputTokens: 2e5,
1019
- supportedFileTypes: ["pdf", "image"],
1020
- pricing: {
1021
- inputPerM: 15,
1022
- outputPerM: 75,
1023
- cacheWritePerM: 18.75,
1024
- cacheReadPerM: 1.5,
1025
- currency: "USD",
1026
- unit: "per_million_tokens"
1027
- }
1028
- },
1029
- {
1030
- name: "claude-opus-4@20250514",
1031
- displayName: "Claude 4 Opus (Vertex)",
1032
- maxInputTokens: 2e5,
1033
- supportedFileTypes: ["pdf", "image"],
1034
- pricing: {
1035
- inputPerM: 15,
1036
- outputPerM: 75,
1037
- cacheWritePerM: 18.75,
1038
- cacheReadPerM: 1.5,
1039
- currency: "USD",
1040
- unit: "per_million_tokens"
1041
- }
1042
- },
1043
- {
1044
- name: "claude-sonnet-4@20250514",
1045
- displayName: "Claude 4 Sonnet (Vertex)",
1046
- maxInputTokens: 2e5,
1047
- supportedFileTypes: ["pdf", "image"],
1048
- pricing: {
1049
- inputPerM: 3,
1050
- outputPerM: 15,
1051
- cacheWritePerM: 3.75,
1052
- cacheReadPerM: 0.3,
1053
- currency: "USD",
1054
- unit: "per_million_tokens"
1055
- }
1056
- },
1057
- // Claude 3.x models on Vertex AI
1058
- {
1059
- name: "claude-3-7-sonnet@20250219",
1060
- displayName: "Claude 3.7 Sonnet (Vertex)",
1061
- maxInputTokens: 2e5,
1062
- supportedFileTypes: ["pdf", "image"],
1063
- pricing: {
1064
- inputPerM: 3,
1065
- outputPerM: 15,
1066
- cacheWritePerM: 3.75,
1067
- cacheReadPerM: 0.3,
1068
- currency: "USD",
1069
- unit: "per_million_tokens"
1070
- }
1071
- },
1072
- {
1073
- name: "claude-3-5-sonnet-v2@20241022",
1074
- displayName: "Claude 3.5 Sonnet v2 (Vertex)",
1075
- maxInputTokens: 2e5,
1076
- supportedFileTypes: ["pdf", "image"],
1077
- pricing: {
1078
- inputPerM: 3,
1079
- outputPerM: 15,
1080
- cacheWritePerM: 3.75,
1081
- cacheReadPerM: 0.3,
1082
- currency: "USD",
1083
- unit: "per_million_tokens"
1084
- }
1085
- },
1086
- {
1087
- name: "claude-3-5-haiku@20241022",
1088
- displayName: "Claude 3.5 Haiku (Vertex)",
1089
- maxInputTokens: 2e5,
1090
- supportedFileTypes: ["pdf", "image"],
1091
- pricing: {
1092
- inputPerM: 0.8,
1093
- outputPerM: 4,
1094
- cacheWritePerM: 1,
1095
- cacheReadPerM: 0.08,
1096
- currency: "USD",
1097
- unit: "per_million_tokens"
1098
- }
1099
- }
1100
- ],
1101
- baseURLSupport: "none",
1102
- // Auto-constructed from projectId and region
1103
- supportedFileTypes: ["pdf", "image", "audio"]
1104
- },
1105
- // Amazon Bedrock - AWS-hosted gateway for Claude, Nova, and more
1106
- // Auth: AWS credentials (env vars) or Bedrock API key (AWS_BEARER_TOKEN_BEDROCK)
1107
- //
1108
- // Cross-region inference: Auto-added for anthropic.* and amazon.* models
1109
- // supportsCustomModels: true allows users to add custom model IDs beyond the fixed list
1110
- bedrock: {
1111
- supportsCustomModels: true,
1112
- models: [
1113
- // Claude 4.5 models (latest)
1114
- {
1115
- name: "anthropic.claude-sonnet-4-5-20250929-v1:0",
1116
- displayName: "Claude 4.5 Sonnet",
1117
- maxInputTokens: 2e5,
1118
- default: true,
1119
- supportedFileTypes: ["pdf", "image"],
1120
- pricing: {
1121
- inputPerM: 3,
1122
- outputPerM: 15,
1123
- cacheWritePerM: 3.75,
1124
- cacheReadPerM: 0.3,
1125
- currency: "USD",
1126
- unit: "per_million_tokens"
1127
- }
1128
- },
1129
- {
1130
- name: "anthropic.claude-haiku-4-5-20251001-v1:0",
1131
- displayName: "Claude 4.5 Haiku",
1132
- maxInputTokens: 2e5,
1133
- supportedFileTypes: ["pdf", "image"],
1134
- pricing: {
1135
- inputPerM: 1,
1136
- outputPerM: 5,
1137
- cacheWritePerM: 1.25,
1138
- cacheReadPerM: 0.1,
1139
- currency: "USD",
1140
- unit: "per_million_tokens"
1141
- }
1142
- },
1143
- {
1144
- name: "anthropic.claude-opus-4-5-20251101-v1:0",
1145
- displayName: "Claude 4.5 Opus",
1146
- maxInputTokens: 2e5,
1147
- supportedFileTypes: ["pdf", "image"],
1148
- pricing: {
1149
- inputPerM: 5,
1150
- outputPerM: 25,
1151
- cacheWritePerM: 6.25,
1152
- cacheReadPerM: 0.5,
1153
- currency: "USD",
1154
- unit: "per_million_tokens"
1155
- }
1156
- },
1157
- // Amazon Nova models
1158
- {
1159
- name: "amazon.nova-premier-v1:0",
1160
- displayName: "Nova Premier",
1161
- maxInputTokens: 1e6,
1162
- supportedFileTypes: ["image"],
1163
- pricing: {
1164
- inputPerM: 2.5,
1165
- outputPerM: 12.5,
1166
- currency: "USD",
1167
- unit: "per_million_tokens"
1168
- }
1169
- },
1170
- {
1171
- name: "amazon.nova-pro-v1:0",
1172
- displayName: "Nova Pro",
1173
- maxInputTokens: 3e5,
1174
- supportedFileTypes: ["pdf", "image"],
1175
- pricing: {
1176
- inputPerM: 0.8,
1177
- outputPerM: 3.2,
1178
- cacheReadPerM: 0.2,
1179
- currency: "USD",
1180
- unit: "per_million_tokens"
1181
- }
1182
- },
1183
- {
1184
- name: "amazon.nova-lite-v1:0",
1185
- displayName: "Nova Lite",
1186
- maxInputTokens: 3e5,
1187
- supportedFileTypes: ["pdf", "image"],
1188
- pricing: {
1189
- inputPerM: 0.06,
1190
- outputPerM: 0.24,
1191
- cacheReadPerM: 0.015,
1192
- currency: "USD",
1193
- unit: "per_million_tokens"
1194
- }
1195
- },
1196
- {
1197
- name: "amazon.nova-micro-v1:0",
1198
- displayName: "Nova Micro",
1199
- maxInputTokens: 128e3,
1200
- supportedFileTypes: [],
1201
- pricing: {
1202
- inputPerM: 0.035,
1203
- outputPerM: 0.14,
1204
- cacheReadPerM: 875e-5,
1205
- currency: "USD",
1206
- unit: "per_million_tokens"
1207
- }
1208
- },
1209
- // OpenAI GPT-OSS
1210
- {
1211
- name: "openai.gpt-oss-120b-1:0",
1212
- displayName: "GPT-OSS 120B",
1213
- maxInputTokens: 128e3,
1214
- supportedFileTypes: [],
1215
- pricing: {
1216
- inputPerM: 0.15,
1217
- outputPerM: 0.6,
1218
- currency: "USD",
1219
- unit: "per_million_tokens"
1220
- }
1221
- },
1222
- {
1223
- name: "openai.gpt-oss-20b-1:0",
1224
- displayName: "GPT-OSS 20B",
1225
- maxInputTokens: 128e3,
1226
- supportedFileTypes: [],
1227
- pricing: {
1228
- inputPerM: 0.07,
1229
- outputPerM: 0.3,
1230
- currency: "USD",
1231
- unit: "per_million_tokens"
1232
- }
1233
- },
1234
- // Qwen
1235
- {
1236
- name: "qwen.qwen3-coder-30b-a3b-v1:0",
1237
- displayName: "Qwen3 Coder 30B",
1238
- maxInputTokens: 262144,
1239
- supportedFileTypes: [],
1240
- pricing: {
1241
- inputPerM: 0.15,
1242
- outputPerM: 0.6,
1243
- currency: "USD",
1244
- unit: "per_million_tokens"
1245
- }
1246
- },
1247
- {
1248
- name: "qwen.qwen3-coder-480b-a35b-v1:0",
1249
- displayName: "Qwen3 Coder 480B",
1250
- maxInputTokens: 262144,
1251
- supportedFileTypes: [],
1252
- pricing: {
1253
- inputPerM: 0.22,
1254
- outputPerM: 1.8,
1255
- currency: "USD",
1256
- unit: "per_million_tokens"
1257
- }
1258
- }
1259
- ],
1260
- baseURLSupport: "none",
1261
- // Auto-constructed from region
1262
- supportedFileTypes: ["pdf", "image"]
1263
- },
1264
- // Native local model execution via node-llama-cpp
1265
- // Runs GGUF models directly on the machine using Metal/CUDA/Vulkan acceleration
1266
- // Models are downloaded from HuggingFace and stored in ~/.dexto/models/
1267
- local: {
1268
- models: [],
1269
- // Populated dynamically from local model registry
1270
- baseURLSupport: "none",
1271
- // No external server needed
1272
- supportedFileTypes: ["image"],
1273
- // Vision support depends on model capabilities
1274
- supportsCustomModels: true
1275
- // Allow any GGUF model path
1276
- },
1277
- // Ollama server integration
1278
- // Uses Ollama's OpenAI-compatible API for local model inference
1279
- // Requires Ollama to be installed and running (default: http://localhost:11434)
1280
- ollama: {
1281
- models: [],
1282
- // Populated dynamically from Ollama API
1283
- baseURLSupport: "optional",
1284
- // Default: http://localhost:11434, can be customized
1285
- supportedFileTypes: ["image"],
1286
- // Vision support depends on model
1287
- supportsCustomModels: true
1288
- // Accept any Ollama model name
1289
- }
1290
- // TODO: Add 'dexto' provider (similar to openrouter, uses https://api.dexto.ai/v1)
1291
- };
1292
- function stripBedrockRegionPrefix(model) {
1293
- if (model.startsWith("eu.") || model.startsWith("us.")) {
1294
- return model.slice(3);
1295
- }
1296
- if (model.startsWith("global.")) {
1297
- return model.slice(7);
1298
- }
1299
- return model;
1300
- }
1301
- function getDefaultModelForProvider(provider) {
1302
- const providerInfo = LLM_REGISTRY[provider];
1303
- return providerInfo.models.find((m) => m.default)?.name || null;
1304
- }
1305
- function getSupportedProviders() {
1306
- return [...LLM_PROVIDERS];
1307
- }
1308
- function getSupportedModels(provider) {
1309
- const providerInfo = LLM_REGISTRY[provider];
1310
- return providerInfo.models.map((m) => m.name);
1311
- }
1312
- function getMaxInputTokensForModel(provider, model, logger) {
1313
- const providerInfo = LLM_REGISTRY[provider];
1314
- const normalizedModel = stripBedrockRegionPrefix(model).toLowerCase();
1315
- const modelInfo = providerInfo.models.find((m) => m.name.toLowerCase() === normalizedModel);
1316
- if (!modelInfo) {
1317
- const supportedModels = getSupportedModels(provider).join(", ");
1318
- logger?.error(
1319
- `Model '${model}' not found for provider '${provider}' in LLM registry. Supported models: ${supportedModels}`
1320
- );
1321
- throw LLMError.unknownModel(provider, model);
1322
- }
1323
- logger?.debug(`Found max tokens for ${provider}/${model}: ${modelInfo.maxInputTokens}`);
1324
- return modelInfo.maxInputTokens;
1325
- }
1326
- function isValidProviderModel(provider, model) {
1327
- const providerInfo = LLM_REGISTRY[provider];
1328
- const normalizedModel = stripBedrockRegionPrefix(model).toLowerCase();
1329
- return providerInfo.models.some((m) => m.name.toLowerCase() === normalizedModel);
1330
- }
1331
- function getProviderFromModel(model) {
1332
- const normalizedModel = stripBedrockRegionPrefix(model).toLowerCase();
1333
- for (const provider of LLM_PROVIDERS) {
1334
- const info = LLM_REGISTRY[provider];
1335
- if (info.models.some((m) => m.name.toLowerCase() === normalizedModel)) {
1336
- return provider;
1337
- }
1338
- }
1339
- throw LLMError.modelProviderUnknown(model);
1340
- }
1341
- function getAllSupportedModels() {
1342
- return Object.values(LLM_REGISTRY).flatMap((info) => info.models.map((m) => m.name));
1343
- }
1344
- function supportsBaseURL(provider) {
1345
- const providerInfo = LLM_REGISTRY[provider];
1346
- return providerInfo.baseURLSupport !== "none";
1347
- }
1348
- function requiresBaseURL(provider) {
1349
- const providerInfo = LLM_REGISTRY[provider];
1350
- return providerInfo.baseURLSupport === "required";
1351
- }
1352
- function acceptsAnyModel(provider) {
1353
- const providerInfo = LLM_REGISTRY[provider];
1354
- return providerInfo.models.length === 0;
1355
- }
1356
- function supportsCustomModels(provider) {
1357
- const providerInfo = LLM_REGISTRY[provider];
1358
- return providerInfo.supportsCustomModels === true;
1359
- }
1360
- const API_KEY_OPTIONAL_PROVIDERS = /* @__PURE__ */ new Set([
1361
- "local",
1362
- // Native node-llama-cpp execution - no auth needed
1363
- "ollama",
1364
- // Ollama server - no auth needed by default
1365
- "openai-compatible",
1366
- // vLLM, LocalAI - often no auth needed
1367
- "litellm",
1368
- // Self-hosted proxy - handles auth internally
1369
- "vertex",
1370
- // Uses Google Cloud ADC (Application Default Credentials)
1371
- "bedrock"
1372
- // Uses AWS credentials (access key + secret or IAM role)
1373
- ]);
1374
- function requiresApiKey(provider) {
1375
- return !API_KEY_OPTIONAL_PROVIDERS.has(provider);
1376
- }
1377
- function getSupportedFileTypesForModel(provider, model) {
1378
- const providerInfo = LLM_REGISTRY[provider];
1379
- if (acceptsAnyModel(provider)) {
1380
- return providerInfo.supportedFileTypes;
1381
- }
1382
- const normalizedModel = stripBedrockRegionPrefix(model).toLowerCase();
1383
- const modelInfo = providerInfo.models.find((m) => m.name.toLowerCase() === normalizedModel);
1384
- if (!modelInfo) {
1385
- throw LLMError.unknownModel(provider, model);
1386
- }
1387
- return modelInfo.supportedFileTypes;
1388
- }
1389
- function modelSupportsFileType(provider, model, fileType) {
1390
- const supportedTypes = getSupportedFileTypesForModel(provider, model);
1391
- return supportedTypes.includes(fileType);
1392
- }
1393
- function validateModelFileSupport(provider, model, mimeType) {
1394
- const baseMimeType = mimeType.toLowerCase().split(";")[0]?.trim() || mimeType.toLowerCase();
1395
- const fileType = MIME_TYPE_TO_FILE_TYPE[baseMimeType];
1396
- if (!fileType) {
1397
- return {
1398
- isSupported: false,
1399
- error: `Unsupported file type: ${mimeType}`
1400
- };
1401
- }
1402
- try {
1403
- if (!modelSupportsFileType(provider, model, fileType)) {
1404
- return {
1405
- isSupported: false,
1406
- fileType,
1407
- error: `Model '${model}' (${provider}) does not support ${fileType} files`
1408
- };
1409
- }
1410
- return {
1411
- isSupported: true,
1412
- fileType
1413
- };
1414
- } catch (error) {
1415
- return {
1416
- isSupported: false,
1417
- fileType,
1418
- error: error instanceof Error ? error.message : "Unknown error validating model file support"
1419
- };
1420
- }
1421
- }
1422
- function getEffectiveMaxInputTokens(config, logger) {
1423
- const configuredMaxInputTokens = config.maxInputTokens;
1424
- if (configuredMaxInputTokens != null) {
1425
- if (config.baseURL) {
1426
- logger.debug(
1427
- `Using maxInputTokens from configuration (with baseURL): ${configuredMaxInputTokens}`
1428
- );
1429
- return configuredMaxInputTokens;
1430
- }
1431
- try {
1432
- const registryMaxInputTokens = getMaxInputTokensForModel(
1433
- config.provider,
1434
- config.model,
1435
- logger
1436
- );
1437
- if (configuredMaxInputTokens > registryMaxInputTokens) {
1438
- logger.warn(
1439
- `Provided maxInputTokens (${configuredMaxInputTokens}) for ${config.provider}/${config.model} exceeds the known limit (${registryMaxInputTokens}) for model ${config.model}. Capping to registry limit.`
1440
- );
1441
- return registryMaxInputTokens;
1442
- } else {
1443
- logger.debug(
1444
- `Using valid maxInputTokens override from configuration: ${configuredMaxInputTokens} (Registry limit: ${registryMaxInputTokens})`
1445
- );
1446
- return configuredMaxInputTokens;
1447
- }
1448
- } catch (error) {
1449
- if (error instanceof DextoRuntimeError && error.code === LLMErrorCode.MODEL_UNKNOWN) {
1450
- logger.warn(
1451
- `Registry lookup failed during maxInputTokens override check for ${config.provider}/${config.model}: ${error.message}. Proceeding with the provided maxInputTokens value (${configuredMaxInputTokens}), but it might be invalid.`
1452
- );
1453
- return configuredMaxInputTokens;
1454
- } else {
1455
- logger.error(
1456
- `Unexpected error during registry lookup for maxInputTokens override check: ${error}`
1457
- );
1458
- throw error;
1459
- }
1460
- }
1461
- }
1462
- if (config.provider === "openrouter") {
1463
- const contextLength = getOpenRouterModelContextLength(config.model);
1464
- if (contextLength !== null) {
1465
- logger.debug(
1466
- `Using maxInputTokens from OpenRouter registry for ${config.model}: ${contextLength}`
1467
- );
1468
- return contextLength;
1469
- }
1470
- logger.warn(
1471
- `OpenRouter model ${config.model} not found in cache, defaulting to ${DEFAULT_MAX_INPUT_TOKENS} tokens`
1472
- );
1473
- return DEFAULT_MAX_INPUT_TOKENS;
1474
- }
1475
- if (config.baseURL) {
1476
- logger.warn(
1477
- `baseURL is set but maxInputTokens is missing. Defaulting to ${DEFAULT_MAX_INPUT_TOKENS}. Provide 'maxInputTokens' in configuration to avoid default fallback.`
1478
- );
1479
- return DEFAULT_MAX_INPUT_TOKENS;
1480
- }
1481
- if (acceptsAnyModel(config.provider)) {
1482
- logger.debug(
1483
- `Provider ${config.provider} accepts any model, defaulting to ${DEFAULT_MAX_INPUT_TOKENS} tokens`
1484
- );
1485
- return DEFAULT_MAX_INPUT_TOKENS;
1486
- }
1487
- try {
1488
- const registryMaxInputTokens = getMaxInputTokensForModel(
1489
- config.provider,
1490
- config.model,
1491
- logger
1492
- );
1493
- logger.debug(
1494
- `Using maxInputTokens from registry for ${config.provider}/${config.model}: ${registryMaxInputTokens}`
1495
- );
1496
- return registryMaxInputTokens;
1497
- } catch (error) {
1498
- if (error instanceof DextoRuntimeError && error.code === LLMErrorCode.MODEL_UNKNOWN) {
1499
- if (supportsCustomModels(config.provider)) {
1500
- logger.debug(
1501
- `Custom model ${config.model} not in ${config.provider} registry, defaulting to ${DEFAULT_MAX_INPUT_TOKENS} tokens`
1502
- );
1503
- return DEFAULT_MAX_INPUT_TOKENS;
1504
- }
1505
- logger.error(
1506
- `Registry lookup failed for ${config.provider}/${config.model}: ${error.message}. Effective maxInputTokens cannot be determined.`
1507
- );
1508
- throw LLMError.unknownModel(config.provider, config.model);
1509
- } else {
1510
- logger.error(`Unexpected error during registry lookup for maxInputTokens: ${error}`);
1511
- throw error;
1512
- }
1513
- }
1514
- }
1515
- function getModelPricing(provider, model) {
1516
- const providerInfo = LLM_REGISTRY[provider];
1517
- if (acceptsAnyModel(provider)) {
1518
- return void 0;
1519
- }
1520
- const normalizedModel = stripBedrockRegionPrefix(model).toLowerCase();
1521
- const modelInfo = providerInfo.models.find((m) => m.name.toLowerCase() === normalizedModel);
1522
- return modelInfo?.pricing;
1523
- }
1524
- function getModelDisplayName(model, provider) {
1525
- let resolvedProvider;
1526
- try {
1527
- resolvedProvider = provider ?? getProviderFromModel(model);
1528
- } catch {
1529
- return model;
1530
- }
1531
- const providerInfo = LLM_REGISTRY[resolvedProvider];
1532
- if (!providerInfo || acceptsAnyModel(resolvedProvider)) {
1533
- return model;
1534
- }
1535
- const normalizedModel = stripBedrockRegionPrefix(model).toLowerCase();
1536
- const modelInfo = providerInfo.models.find((m) => m.name.toLowerCase() === normalizedModel);
1537
- return modelInfo?.displayName ?? model;
1538
- }
1539
- function isReasoningCapableModel(model, _provider) {
1540
- const modelLower = model.toLowerCase();
1541
- if (modelLower.includes("codex")) {
1542
- return true;
1543
- }
1544
- if (modelLower.startsWith("o1") || modelLower.startsWith("o3") || modelLower.startsWith("o4")) {
1545
- return true;
1546
- }
1547
- if (modelLower.includes("gpt-5") || modelLower.includes("gpt-5.1") || modelLower.includes("gpt-5.2")) {
1548
- return true;
1549
- }
1550
- return false;
1551
- }
1552
- function calculateCost(usage, pricing) {
1553
- const inputCost = (usage.inputTokens ?? 0) * pricing.inputPerM / 1e6;
1554
- const outputCost = (usage.outputTokens ?? 0) * pricing.outputPerM / 1e6;
1555
- const cacheReadCost = (usage.cacheReadTokens ?? 0) * (pricing.cacheReadPerM ?? 0) / 1e6;
1556
- const cacheWriteCost = (usage.cacheWriteTokens ?? 0) * (pricing.cacheWritePerM ?? 0) / 1e6;
1557
- const reasoningCost = (usage.reasoningTokens ?? 0) * pricing.outputPerM / 1e6;
1558
- return inputCost + outputCost + cacheReadCost + cacheWriteCost + reasoningCost;
1559
- }
1560
- export {
1561
- DEFAULT_MAX_INPUT_TOKENS,
1562
- LLM_REGISTRY,
1563
- MIME_TYPE_TO_FILE_TYPE,
1564
- acceptsAnyModel,
1565
- calculateCost,
1566
- getAllSupportedModels,
1567
- getAllowedMimeTypes,
1568
- getDefaultModelForProvider,
1569
- getEffectiveMaxInputTokens,
1570
- getMaxInputTokensForModel,
1571
- getModelDisplayName,
1572
- getModelPricing,
1573
- getProviderFromModel,
1574
- getSupportedFileTypesForModel,
1575
- getSupportedModels,
1576
- getSupportedProviders,
1577
- isReasoningCapableModel,
1578
- isValidProviderModel,
1579
- modelSupportsFileType,
1580
- requiresApiKey,
1581
- requiresBaseURL,
1582
- stripBedrockRegionPrefix,
1583
- supportsBaseURL,
1584
- supportsCustomModels,
1585
- validateModelFileSupport
1586
- };