Skip to content

improvement(mistral): update OCR pricing to OCR 4 rate ($4/1,000 pages)#5193

Merged
waleedlatif1 merged 2 commits into
stagingfrom
update-mistral-ocr-4
Jun 24, 2026
Merged

improvement(mistral): update OCR pricing to OCR 4 rate ($4/1,000 pages)#5193
waleedlatif1 merged 2 commits into
stagingfrom
update-mistral-ocr-4

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Mistral's mistral-ocr-latest alias (what we call) now resolves to OCR 4 (mistral-ocr-4-0), so the model is already current — no model-string change needed.
  • The per-page cost constant was stale at OCR 3's rate ($0.002/page). OCR 4's synchronous /v1/ocr standard rate is $4/1,000 pages, so updated the cost to $0.004/page.
  • Extracted the magic number into a documented MISTRAL_OCR_COST_PER_PAGE constant with TSDoc citing the source.

Type of Change

  • Bug fix (cost-tracking accuracy)

Testing

Tested manually — verified OCR 4 pricing against https://mistral.ai/news/ocr-4/ and https://mistral.ai/pricing.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jun 24, 2026 7:10am

Request Review

@cursor

cursor Bot commented Jun 24, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Billing/metadata accuracy only; no API, auth, or OCR execution logic changes.

Overview
Updates Mistral PDF Parser cost tracking so reported usage matches Mistral OCR 4’s synchronous /v1/ocr rate ($0.004/page, $4 per 1,000 pages), replacing the outdated OCR 3 $0.002/page value.

The per-page rate is now MISTRAL_OCR_COST_PER_PAGE with TSDoc explaining that mistral-ocr-latest maps to OCR 4 and that annotation pricing does not apply to this tool. MISTRAL_OCR_HOSTING’s custom getCost uses that constant for all parser variants (mistral_parser, v2, v3); OCR request behavior is unchanged.

Reviewed by Cursor Bugbot for commit f81e252. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Updates the Mistral OCR cost-tracking constant from the stale OCR 3 rate ($0.002/page) to the current OCR 4 rate ($0.004/page), reflecting Mistral's June 23, 2026 repoint of mistral-ocr-latest to mistral-ocr-4-0.

  • Extracts the magic number into MISTRAL_OCR_COST_PER_PAGE = 0.004 with a TSDoc block citing the OCR 4 announcement and changelog — keeping the alias assumption auditable in code.
  • No model string, endpoint, or logic changes; only the per-page multiplier is updated.

Confidence Score: 5/5

Safe to merge — the change is a single-constant update to a pricing multiplier, with no behavioral or logic changes.

The diff touches only the cost multiplier in the getCost function. The updated value ($0.004/page) correctly reflects the OCR 4 rate ($4/1,000 pages), the alias resolution is documented with sources in TSDoc, and the constant name follows the project's SCREAMING_SNAKE_CASE convention. No other code paths are affected.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/tools/mistral/parser.ts Replaces the hardcoded OCR 3 rate ($0.002/page) with a named MISTRAL_OCR_COST_PER_PAGE constant set to $0.004/page (OCR 4 rate), and adds a TSDoc comment documenting the pricing source and alias resolution date. No logic changes beyond the cost value update.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[OCR API Response] --> B{usage_info or metadata.usageInfo present?}
    B -- No --> C[Throw Error]
    B -- Yes --> D[Extract pagesProcessed]
    D --> E["cost = pagesProcessed × MISTRAL_OCR_COST_PER_PAGE\n($0.004 / page — OCR 4 rate)"]
    E --> F[Return cost + metadata]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[OCR API Response] --> B{usage_info or metadata.usageInfo present?}
    B -- No --> C[Throw Error]
    B -- Yes --> D[Extract pagesProcessed]
    D --> E["cost = pagesProcessed × MISTRAL_OCR_COST_PER_PAGE\n($0.004 / page — OCR 4 rate)"]
    E --> F[Return cost + metadata]
Loading

Reviews (2): Last reviewed commit: "docs(mistral): document mistral-ocr-late..." | Re-trigger Greptile

Comment thread apps/sim/tools/mistral/parser.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1 waleedlatif1 merged commit b212a5d into staging Jun 24, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the update-mistral-ocr-4 branch June 24, 2026 07:12

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit f81e252. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant