api.ts 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. import * as vscode from "vscode"
  2. export type ApiProvider =
  3. | "anthropic"
  4. | "glama"
  5. | "openrouter"
  6. | "bedrock"
  7. | "vertex"
  8. | "openai"
  9. | "ollama"
  10. | "lmstudio"
  11. | "gemini"
  12. | "openai-native"
  13. | "deepseek"
  14. | "vscode-lm"
  15. | "mistral"
  16. | "unbound"
  17. export interface ApiHandlerOptions {
  18. apiModelId?: string
  19. apiKey?: string // anthropic
  20. anthropicBaseUrl?: string
  21. vsCodeLmModelSelector?: vscode.LanguageModelChatSelector
  22. glamaModelId?: string
  23. glamaModelInfo?: ModelInfo
  24. glamaApiKey?: string
  25. openRouterApiKey?: string
  26. openRouterModelId?: string
  27. openRouterModelInfo?: ModelInfo
  28. openRouterBaseUrl?: string
  29. awsAccessKey?: string
  30. awsSecretKey?: string
  31. awsSessionToken?: string
  32. awsRegion?: string
  33. awsUseCrossRegionInference?: boolean
  34. awsUsePromptCache?: boolean
  35. awspromptCacheId?: string
  36. awsProfile?: string
  37. awsUseProfile?: boolean
  38. vertexProjectId?: string
  39. vertexRegion?: string
  40. openAiBaseUrl?: string
  41. openAiApiKey?: string
  42. openAiModelId?: string
  43. openAiCustomModelInfo?: ModelInfo
  44. openAiUseAzure?: boolean
  45. ollamaModelId?: string
  46. ollamaBaseUrl?: string
  47. lmStudioModelId?: string
  48. lmStudioBaseUrl?: string
  49. geminiApiKey?: string
  50. openAiNativeApiKey?: string
  51. mistralApiKey?: string
  52. azureApiVersion?: string
  53. openRouterUseMiddleOutTransform?: boolean
  54. openAiStreamingEnabled?: boolean
  55. setAzureApiVersion?: boolean
  56. deepSeekBaseUrl?: string
  57. deepSeekApiKey?: string
  58. includeMaxTokens?: boolean
  59. unboundApiKey?: string
  60. unboundModelId?: string
  61. }
  62. export type ApiConfiguration = ApiHandlerOptions & {
  63. apiProvider?: ApiProvider
  64. id?: string // stable unique identifier
  65. }
  66. // Models
  67. export interface ModelInfo {
  68. maxTokens?: number
  69. contextWindow: number
  70. supportsImages?: boolean
  71. supportsComputerUse?: boolean
  72. supportsPromptCache: boolean // this value is hardcoded for now
  73. inputPrice?: number
  74. outputPrice?: number
  75. cacheWritesPrice?: number
  76. cacheReadsPrice?: number
  77. description?: string
  78. }
  79. // Anthropic
  80. // https://docs.anthropic.com/en/docs/about-claude/models
  81. export type AnthropicModelId = keyof typeof anthropicModels
  82. export const anthropicDefaultModelId: AnthropicModelId = "claude-3-5-sonnet-20241022"
  83. export const anthropicModels = {
  84. "claude-3-5-sonnet-20241022": {
  85. maxTokens: 8192,
  86. contextWindow: 200_000,
  87. supportsImages: true,
  88. supportsComputerUse: true,
  89. supportsPromptCache: true,
  90. inputPrice: 3.0, // $3 per million input tokens
  91. outputPrice: 15.0, // $15 per million output tokens
  92. cacheWritesPrice: 3.75, // $3.75 per million tokens
  93. cacheReadsPrice: 0.3, // $0.30 per million tokens
  94. },
  95. "claude-3-5-haiku-20241022": {
  96. maxTokens: 8192,
  97. contextWindow: 200_000,
  98. supportsImages: false,
  99. supportsPromptCache: true,
  100. inputPrice: 1.0,
  101. outputPrice: 5.0,
  102. cacheWritesPrice: 1.25,
  103. cacheReadsPrice: 0.1,
  104. },
  105. "claude-3-opus-20240229": {
  106. maxTokens: 4096,
  107. contextWindow: 200_000,
  108. supportsImages: true,
  109. supportsPromptCache: true,
  110. inputPrice: 15.0,
  111. outputPrice: 75.0,
  112. cacheWritesPrice: 18.75,
  113. cacheReadsPrice: 1.5,
  114. },
  115. "claude-3-haiku-20240307": {
  116. maxTokens: 4096,
  117. contextWindow: 200_000,
  118. supportsImages: true,
  119. supportsPromptCache: true,
  120. inputPrice: 0.25,
  121. outputPrice: 1.25,
  122. cacheWritesPrice: 0.3,
  123. cacheReadsPrice: 0.03,
  124. },
  125. } as const satisfies Record<string, ModelInfo> // as const assertion makes the object deeply readonly
  126. // AWS Bedrock
  127. // https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html
  128. export interface MessageContent {
  129. type: "text" | "image" | "video" | "tool_use" | "tool_result"
  130. text?: string
  131. source?: {
  132. type: "base64"
  133. data: string | Uint8Array // string for Anthropic, Uint8Array for Bedrock
  134. media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"
  135. }
  136. // Video specific fields
  137. format?: string
  138. s3Location?: {
  139. uri: string
  140. bucketOwner?: string
  141. }
  142. // Tool use and result fields
  143. toolUseId?: string
  144. name?: string
  145. input?: any
  146. output?: any // Used for tool_result type
  147. }
  148. export type BedrockModelId = keyof typeof bedrockModels
  149. export const bedrockDefaultModelId: BedrockModelId = "anthropic.claude-3-5-sonnet-20241022-v2:0"
  150. export const bedrockModels = {
  151. "amazon.nova-pro-v1:0": {
  152. maxTokens: 5000,
  153. contextWindow: 300_000,
  154. supportsImages: true,
  155. supportsComputerUse: false,
  156. supportsPromptCache: false,
  157. inputPrice: 0.8,
  158. outputPrice: 3.2,
  159. cacheWritesPrice: 0.8, // per million tokens
  160. cacheReadsPrice: 0.2, // per million tokens
  161. },
  162. "amazon.nova-lite-v1:0": {
  163. maxTokens: 5000,
  164. contextWindow: 300_000,
  165. supportsImages: true,
  166. supportsComputerUse: false,
  167. supportsPromptCache: false,
  168. inputPrice: 0.06,
  169. outputPrice: 0.024,
  170. cacheWritesPrice: 0.06, // per million tokens
  171. cacheReadsPrice: 0.015, // per million tokens
  172. },
  173. "amazon.nova-micro-v1:0": {
  174. maxTokens: 5000,
  175. contextWindow: 128_000,
  176. supportsImages: false,
  177. supportsComputerUse: false,
  178. supportsPromptCache: false,
  179. inputPrice: 0.035,
  180. outputPrice: 0.14,
  181. cacheWritesPrice: 0.035, // per million tokens
  182. cacheReadsPrice: 0.00875, // per million tokens
  183. },
  184. "anthropic.claude-3-5-sonnet-20241022-v2:0": {
  185. maxTokens: 8192,
  186. contextWindow: 200_000,
  187. supportsImages: true,
  188. supportsComputerUse: true,
  189. supportsPromptCache: false,
  190. inputPrice: 3.0,
  191. outputPrice: 15.0,
  192. cacheWritesPrice: 3.75, // per million tokens
  193. cacheReadsPrice: 0.3, // per million tokens
  194. },
  195. "anthropic.claude-3-5-haiku-20241022-v1:0": {
  196. maxTokens: 8192,
  197. contextWindow: 200_000,
  198. supportsImages: false,
  199. supportsPromptCache: false,
  200. inputPrice: 1.0,
  201. outputPrice: 5.0,
  202. cacheWritesPrice: 1.0,
  203. cacheReadsPrice: 0.08,
  204. },
  205. "anthropic.claude-3-5-sonnet-20240620-v1:0": {
  206. maxTokens: 8192,
  207. contextWindow: 200_000,
  208. supportsImages: true,
  209. supportsPromptCache: false,
  210. inputPrice: 3.0,
  211. outputPrice: 15.0,
  212. },
  213. "anthropic.claude-3-opus-20240229-v1:0": {
  214. maxTokens: 4096,
  215. contextWindow: 200_000,
  216. supportsImages: true,
  217. supportsPromptCache: false,
  218. inputPrice: 15.0,
  219. outputPrice: 75.0,
  220. },
  221. "anthropic.claude-3-sonnet-20240229-v1:0": {
  222. maxTokens: 4096,
  223. contextWindow: 200_000,
  224. supportsImages: true,
  225. supportsPromptCache: false,
  226. inputPrice: 3.0,
  227. outputPrice: 15.0,
  228. },
  229. "anthropic.claude-3-haiku-20240307-v1:0": {
  230. maxTokens: 4096,
  231. contextWindow: 200_000,
  232. supportsImages: true,
  233. supportsPromptCache: false,
  234. inputPrice: 0.25,
  235. outputPrice: 1.25,
  236. },
  237. "meta.llama3-3-70b-instruct-v1:0": {
  238. maxTokens: 8192,
  239. contextWindow: 128_000,
  240. supportsImages: false,
  241. supportsComputerUse: false,
  242. supportsPromptCache: false,
  243. inputPrice: 0.72,
  244. outputPrice: 0.72,
  245. },
  246. "meta.llama3-2-90b-instruct-v1:0": {
  247. maxTokens: 8192,
  248. contextWindow: 128_000,
  249. supportsImages: true,
  250. supportsComputerUse: false,
  251. supportsPromptCache: false,
  252. inputPrice: 0.72,
  253. outputPrice: 0.72,
  254. },
  255. "meta.llama3-2-11b-instruct-v1:0": {
  256. maxTokens: 8192,
  257. contextWindow: 128_000,
  258. supportsImages: true,
  259. supportsComputerUse: false,
  260. supportsPromptCache: false,
  261. inputPrice: 0.16,
  262. outputPrice: 0.16,
  263. },
  264. "meta.llama3-2-3b-instruct-v1:0": {
  265. maxTokens: 8192,
  266. contextWindow: 128_000,
  267. supportsImages: false,
  268. supportsComputerUse: false,
  269. supportsPromptCache: false,
  270. inputPrice: 0.15,
  271. outputPrice: 0.15,
  272. },
  273. "meta.llama3-2-1b-instruct-v1:0": {
  274. maxTokens: 8192,
  275. contextWindow: 128_000,
  276. supportsImages: false,
  277. supportsComputerUse: false,
  278. supportsPromptCache: false,
  279. inputPrice: 0.1,
  280. outputPrice: 0.1,
  281. },
  282. "meta.llama3-1-405b-instruct-v1:0": {
  283. maxTokens: 8192,
  284. contextWindow: 128_000,
  285. supportsImages: false,
  286. supportsComputerUse: false,
  287. supportsPromptCache: false,
  288. inputPrice: 2.4,
  289. outputPrice: 2.4,
  290. },
  291. "meta.llama3-1-70b-instruct-v1:0": {
  292. maxTokens: 8192,
  293. contextWindow: 128_000,
  294. supportsImages: false,
  295. supportsComputerUse: false,
  296. supportsPromptCache: false,
  297. inputPrice: 0.72,
  298. outputPrice: 0.72,
  299. },
  300. "meta.llama3-1-8b-instruct-v1:0": {
  301. maxTokens: 8192,
  302. contextWindow: 8_000,
  303. supportsImages: false,
  304. supportsComputerUse: false,
  305. supportsPromptCache: false,
  306. inputPrice: 0.22,
  307. outputPrice: 0.22,
  308. },
  309. "meta.llama3-70b-instruct-v1:0": {
  310. maxTokens: 2048,
  311. contextWindow: 8_000,
  312. supportsImages: false,
  313. supportsComputerUse: false,
  314. supportsPromptCache: false,
  315. inputPrice: 2.65,
  316. outputPrice: 3.5,
  317. },
  318. "meta.llama3-8b-instruct-v1:0": {
  319. maxTokens: 2048,
  320. contextWindow: 4_000,
  321. supportsImages: false,
  322. supportsComputerUse: false,
  323. supportsPromptCache: false,
  324. inputPrice: 0.3,
  325. outputPrice: 0.6,
  326. },
  327. } as const satisfies Record<string, ModelInfo>
  328. // Glama
  329. // https://glama.ai/models
  330. export const glamaDefaultModelId = "anthropic/claude-3-5-sonnet"
  331. export const glamaDefaultModelInfo: ModelInfo = {
  332. maxTokens: 8192,
  333. contextWindow: 200_000,
  334. supportsImages: true,
  335. supportsComputerUse: true,
  336. supportsPromptCache: true,
  337. inputPrice: 3.0,
  338. outputPrice: 15.0,
  339. cacheWritesPrice: 3.75,
  340. cacheReadsPrice: 0.3,
  341. description:
  342. "The new Claude 3.5 Sonnet delivers better-than-Opus capabilities, faster-than-Sonnet speeds, at the same Sonnet prices. Sonnet is particularly good at:\n\n- Coding: New Sonnet scores ~49% on SWE-Bench Verified, higher than the last best score, and without any fancy prompt scaffolding\n- Data science: Augments human data science expertise; navigates unstructured data while using multiple tools for insights\n- Visual processing: excelling at interpreting charts, graphs, and images, accurately transcribing text to derive insights beyond just the text alone\n- Agentic tasks: exceptional tool use, making it great at agentic tasks (i.e. complex, multi-step problem solving tasks that require engaging with other systems)\n\n#multimodal\n\n_This is a faster endpoint, made available in collaboration with Anthropic, that is self-moderated: response moderation happens on the provider's side instead of OpenRouter's. For requests that pass moderation, it's identical to the [Standard](/anthropic/claude-3.5-sonnet) variant._",
  343. }
  344. // OpenRouter
  345. // https://openrouter.ai/models?order=newest&supported_parameters=tools
  346. export const openRouterDefaultModelId = "anthropic/claude-3.5-sonnet:beta" // will always exist in openRouterModels
  347. export const openRouterDefaultModelInfo: ModelInfo = {
  348. maxTokens: 8192,
  349. contextWindow: 200_000,
  350. supportsImages: true,
  351. supportsComputerUse: true,
  352. supportsPromptCache: true,
  353. inputPrice: 3.0,
  354. outputPrice: 15.0,
  355. cacheWritesPrice: 3.75,
  356. cacheReadsPrice: 0.3,
  357. description:
  358. "The new Claude 3.5 Sonnet delivers better-than-Opus capabilities, faster-than-Sonnet speeds, at the same Sonnet prices. Sonnet is particularly good at:\n\n- Coding: New Sonnet scores ~49% on SWE-Bench Verified, higher than the last best score, and without any fancy prompt scaffolding\n- Data science: Augments human data science expertise; navigates unstructured data while using multiple tools for insights\n- Visual processing: excelling at interpreting charts, graphs, and images, accurately transcribing text to derive insights beyond just the text alone\n- Agentic tasks: exceptional tool use, making it great at agentic tasks (i.e. complex, multi-step problem solving tasks that require engaging with other systems)\n\n#multimodal\n\n_This is a faster endpoint, made available in collaboration with Anthropic, that is self-moderated: response moderation happens on the provider's side instead of OpenRouter's. For requests that pass moderation, it's identical to the [Standard](/anthropic/claude-3.5-sonnet) variant._",
  359. }
  360. // Vertex AI
  361. // https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude
  362. export type VertexModelId = keyof typeof vertexModels
  363. export const vertexDefaultModelId: VertexModelId = "claude-3-5-sonnet-v2@20241022"
  364. export const vertexModels = {
  365. "claude-3-5-sonnet-v2@20241022": {
  366. maxTokens: 8192,
  367. contextWindow: 200_000,
  368. supportsImages: true,
  369. supportsComputerUse: true,
  370. supportsPromptCache: false,
  371. inputPrice: 3.0,
  372. outputPrice: 15.0,
  373. },
  374. "claude-3-5-sonnet@20240620": {
  375. maxTokens: 8192,
  376. contextWindow: 200_000,
  377. supportsImages: true,
  378. supportsPromptCache: false,
  379. inputPrice: 3.0,
  380. outputPrice: 15.0,
  381. },
  382. "claude-3-5-haiku@20241022": {
  383. maxTokens: 8192,
  384. contextWindow: 200_000,
  385. supportsImages: false,
  386. supportsPromptCache: false,
  387. inputPrice: 1.0,
  388. outputPrice: 5.0,
  389. },
  390. "claude-3-opus@20240229": {
  391. maxTokens: 4096,
  392. contextWindow: 200_000,
  393. supportsImages: true,
  394. supportsPromptCache: false,
  395. inputPrice: 15.0,
  396. outputPrice: 75.0,
  397. },
  398. "claude-3-haiku@20240307": {
  399. maxTokens: 4096,
  400. contextWindow: 200_000,
  401. supportsImages: true,
  402. supportsPromptCache: false,
  403. inputPrice: 0.25,
  404. outputPrice: 1.25,
  405. },
  406. } as const satisfies Record<string, ModelInfo>
  407. export const openAiModelInfoSaneDefaults: ModelInfo = {
  408. maxTokens: -1,
  409. contextWindow: 128_000,
  410. supportsImages: true,
  411. supportsPromptCache: false,
  412. inputPrice: 0,
  413. outputPrice: 0,
  414. }
  415. // Gemini
  416. // https://ai.google.dev/gemini-api/docs/models/gemini
  417. export type GeminiModelId = keyof typeof geminiModels
  418. export const geminiDefaultModelId: GeminiModelId = "gemini-2.0-flash-thinking-exp-01-21"
  419. export const geminiModels = {
  420. "gemini-2.0-flash-thinking-exp-01-21": {
  421. maxTokens: 65_536,
  422. contextWindow: 1_048_576,
  423. supportsImages: true,
  424. supportsPromptCache: false,
  425. inputPrice: 0,
  426. outputPrice: 0,
  427. },
  428. "gemini-2.0-flash-thinking-exp-1219": {
  429. maxTokens: 8192,
  430. contextWindow: 32_767,
  431. supportsImages: true,
  432. supportsPromptCache: false,
  433. inputPrice: 0,
  434. outputPrice: 0,
  435. },
  436. "gemini-2.0-flash-exp": {
  437. maxTokens: 8192,
  438. contextWindow: 1_048_576,
  439. supportsImages: true,
  440. supportsPromptCache: false,
  441. inputPrice: 0,
  442. outputPrice: 0,
  443. },
  444. "gemini-1.5-flash-002": {
  445. maxTokens: 8192,
  446. contextWindow: 1_048_576,
  447. supportsImages: true,
  448. supportsPromptCache: false,
  449. inputPrice: 0,
  450. outputPrice: 0,
  451. },
  452. "gemini-1.5-flash-exp-0827": {
  453. maxTokens: 8192,
  454. contextWindow: 1_048_576,
  455. supportsImages: true,
  456. supportsPromptCache: false,
  457. inputPrice: 0,
  458. outputPrice: 0,
  459. },
  460. "gemini-1.5-flash-8b-exp-0827": {
  461. maxTokens: 8192,
  462. contextWindow: 1_048_576,
  463. supportsImages: true,
  464. supportsPromptCache: false,
  465. inputPrice: 0,
  466. outputPrice: 0,
  467. },
  468. "gemini-1.5-pro-002": {
  469. maxTokens: 8192,
  470. contextWindow: 2_097_152,
  471. supportsImages: true,
  472. supportsPromptCache: false,
  473. inputPrice: 0,
  474. outputPrice: 0,
  475. },
  476. "gemini-1.5-pro-exp-0827": {
  477. maxTokens: 8192,
  478. contextWindow: 2_097_152,
  479. supportsImages: true,
  480. supportsPromptCache: false,
  481. inputPrice: 0,
  482. outputPrice: 0,
  483. },
  484. "gemini-exp-1206": {
  485. maxTokens: 8192,
  486. contextWindow: 2_097_152,
  487. supportsImages: true,
  488. supportsPromptCache: false,
  489. inputPrice: 0,
  490. outputPrice: 0,
  491. },
  492. } as const satisfies Record<string, ModelInfo>
  493. // OpenAI Native
  494. // https://openai.com/api/pricing/
  495. export type OpenAiNativeModelId = keyof typeof openAiNativeModels
  496. export const openAiNativeDefaultModelId: OpenAiNativeModelId = "gpt-4o"
  497. export const openAiNativeModels = {
  498. // don't support tool use yet
  499. o1: {
  500. maxTokens: 100_000,
  501. contextWindow: 200_000,
  502. supportsImages: true,
  503. supportsPromptCache: false,
  504. inputPrice: 15,
  505. outputPrice: 60,
  506. },
  507. "o1-preview": {
  508. maxTokens: 32_768,
  509. contextWindow: 128_000,
  510. supportsImages: true,
  511. supportsPromptCache: false,
  512. inputPrice: 15,
  513. outputPrice: 60,
  514. },
  515. "o1-mini": {
  516. maxTokens: 65_536,
  517. contextWindow: 128_000,
  518. supportsImages: true,
  519. supportsPromptCache: false,
  520. inputPrice: 3,
  521. outputPrice: 12,
  522. },
  523. "gpt-4o": {
  524. maxTokens: 4_096,
  525. contextWindow: 128_000,
  526. supportsImages: true,
  527. supportsPromptCache: false,
  528. inputPrice: 5,
  529. outputPrice: 15,
  530. },
  531. "gpt-4o-mini": {
  532. maxTokens: 16_384,
  533. contextWindow: 128_000,
  534. supportsImages: true,
  535. supportsPromptCache: false,
  536. inputPrice: 0.15,
  537. outputPrice: 0.6,
  538. },
  539. } as const satisfies Record<string, ModelInfo>
  540. // DeepSeek
  541. // https://platform.deepseek.com/docs/api
  542. export type DeepSeekModelId = keyof typeof deepSeekModels
  543. export const deepSeekDefaultModelId: DeepSeekModelId = "deepseek-chat"
  544. export const deepSeekModels = {
  545. "deepseek-chat": {
  546. maxTokens: 8192,
  547. contextWindow: 64_000,
  548. supportsImages: false,
  549. supportsPromptCache: false,
  550. inputPrice: 0.014, // $0.014 per million tokens
  551. outputPrice: 0.28, // $0.28 per million tokens
  552. description: `DeepSeek-V3 achieves a significant breakthrough in inference speed over previous models. It tops the leaderboard among open-source models and rivals the most advanced closed-source models globally.`,
  553. },
  554. "deepseek-reasoner": {
  555. maxTokens: 8192,
  556. contextWindow: 64_000,
  557. supportsImages: false,
  558. supportsPromptCache: false,
  559. inputPrice: 0.55, // $0.55 per million tokens
  560. outputPrice: 2.19, // $2.19 per million tokens
  561. description: `DeepSeek-R1 achieves performance comparable to OpenAI-o1 across math, code, and reasoning tasks.`,
  562. },
  563. } as const satisfies Record<string, ModelInfo>
  564. // Azure OpenAI
  565. // https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation
  566. // https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#api-specs
  567. export const azureOpenAiDefaultApiVersion = "2024-08-01-preview"
  568. // Mistral
  569. // https://docs.mistral.ai/getting-started/models/models_overview/
  570. export type MistralModelId = keyof typeof mistralModels
  571. export const mistralDefaultModelId: MistralModelId = "codestral-latest"
  572. export const mistralModels = {
  573. "codestral-latest": {
  574. maxTokens: 32_768,
  575. contextWindow: 256_000,
  576. supportsImages: false,
  577. supportsPromptCache: false,
  578. inputPrice: 0.3,
  579. outputPrice: 0.9,
  580. },
  581. } as const satisfies Record<string, ModelInfo>
  582. // Unbound Security
  583. export type UnboundModelId = keyof typeof unboundModels
  584. export const unboundDefaultModelId = "openai/gpt-4o"
  585. export const unboundModels = {
  586. "anthropic/claude-3-5-sonnet-20241022": anthropicModels["claude-3-5-sonnet-20241022"],
  587. "openai/gpt-4o": openAiNativeModels["gpt-4o"],
  588. "deepseek/deepseek-chat": deepSeekModels["deepseek-chat"],
  589. "deepseek/deepseek-reasoner": deepSeekModels["deepseek-reasoner"],
  590. "mistral/codestral-latest": mistralModels["codestral-latest"],
  591. } as const satisfies Record<string, ModelInfo>