@@ -12,16 +12,26 @@ import type { ToolConfig } from '@/tools/types'
1212
1313const logger = createLogger ( 'MistralParserTool' )
1414
15+ /**
16+ * Mistral OCR 4 standard pricing, in USD per page ($4 per 1,000 pages).
17+ *
18+ * This tool calls the synchronous `/v1/ocr` endpoint with the `mistral-ocr-latest`
19+ * alias, which Mistral repointed to OCR 4 (`mistral-ocr-4-0`) on 2026-06-23, so the
20+ * standard (non-batch) OCR 4 rate applies. Document AI / annotation pages are priced
21+ * separately, but this tool does not submit annotation requests.
22+ *
23+ * @see https://mistral.ai/news/ocr-4/
24+ * @see https://docs.mistral.ai/getting-started/changelog
25+ */
26+ const MISTRAL_OCR_COST_PER_PAGE = 0.004
27+
1528const MISTRAL_OCR_HOSTING = {
1629 envKeyPrefix : 'MISTRAL_API_KEY' ,
1730 apiKeyParam : 'apiKey' ,
1831 byokProviderId : 'mistral' as const ,
1932 pricing : {
2033 type : 'custom' as const ,
2134 getCost : ( _params : unknown , output : Record < string , unknown > ) => {
22- // Mistral OCR 3 standard pricing: $2 per 1,000 pages ($0.002/page).
23- // Annotated pages are priced separately at $3 per 1,000 annotated pages, but this tool does
24- // not submit annotation requests. Source: https://docs.mistral.ai/models/ocr-3-25-12
2535 const rawUsageInfo = output . usage_info as { pages_processed ?: number } | undefined
2636 const transformedUsageInfo = (
2737 output . metadata as { usageInfo ?: { pagesProcessed ?: number } } | undefined
@@ -33,7 +43,7 @@ const MISTRAL_OCR_HOSTING = {
3343 'Mistral OCR response missing pages_processed in usage_info or metadata.usageInfo.pagesProcessed'
3444 )
3545 }
36- const cost = pagesProcessed * 0.002
46+ const cost = pagesProcessed * MISTRAL_OCR_COST_PER_PAGE
3747 return { cost, metadata : { pagesProcessed } }
3848 } ,
3949 } ,
0 commit comments