@@ -10,6 +10,29 @@ import type { ToolConfig } from '@/tools/types'
1010
1111const logger = createLogger ( 'MistralParserTool' )
1212
13+ const MISTRAL_OCR_HOSTING = {
14+ envKeyPrefix : 'MISTRAL_API_KEY' ,
15+ apiKeyParam : 'apiKey' ,
16+ byokProviderId : 'mistral' as const ,
17+ pricing : {
18+ type : 'custom' as const ,
19+ getCost : ( _params : Record < string , unknown > , output : Record < string , unknown > ) => {
20+ // Mistral OCR: $1 per 1,000 pages ($0.001/page) — https://mistral.ai/pricing
21+ const usageInfo = output . usage_info as { pages_processed ?: number } | undefined
22+ if ( usageInfo ?. pages_processed == null ) {
23+ throw new Error ( 'Mistral OCR response missing pages_processed in usage_info' )
24+ }
25+ const pagesProcessed = usageInfo . pages_processed
26+ const cost = pagesProcessed * 0.001
27+ return { cost, metadata : { pagesProcessed } }
28+ } ,
29+ } ,
30+ rateLimit : {
31+ mode : 'per_request' as const ,
32+ requestsPerMinute : 60 ,
33+ } ,
34+ }
35+
1336export const mistralParserTool : ToolConfig < MistralParserInput , MistralParserOutput > = {
1437 id : 'mistral_parser' ,
1538 name : 'Mistral PDF Parser' ,
@@ -492,6 +515,7 @@ export const mistralParserV3Tool: ToolConfig<MistralParserV2Input, MistralParser
492515 ...mistralParserV2Tool ,
493516 id : 'mistral_parser_v3' ,
494517 version : '3.0.0' ,
518+ hosting : MISTRAL_OCR_HOSTING ,
495519 params : {
496520 file : {
497521 type : 'file' ,
0 commit comments