Skip to content

feat(mistral): add mistral/mistral-ocr-2512 (OCR 3) to cost map - #31463

Merged
mateo-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_add_mistral_ocr_2512
Jun 26, 2026
Merged

feat(mistral): add mistral/mistral-ocr-2512 (OCR 3) to cost map#31463
mateo-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_add_mistral_ocr_2512

Conversation

@mateo-berri

Copy link
Copy Markdown
Contributor

Relevant issues

Resolves LIT-3882

Linear ticket

LIT-3882

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Ran a live proxy with the new entry (registering mistral/mistral-ocr-2512 and forcing the in-repo cost map so the brand-new price resolves before it lands on main) and sent a real OCR request to the Mistral API.

export LITELLM_LOCAL_MODEL_COST_MAP=True
python litellm/proxy/proxy_cli.py --config ocr_2512_proof_config.yaml --port 4000

config:

model_list:
  - model_name: mistral-ocr-2512
    litellm_params:
      model: mistral/mistral-ocr-2512
      api_key: os.environ/MISTRAL_API_KEY

5-page OCR call, checking the cost header (5 pages x $0.002/page = $0.01):

curl -s -D - http://localhost:4000/v1/ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-1234" \
  -d '{
    "model": "mistral-ocr-2512",
    "document": {"type": "document_url", "document_url": "https://arxiv.org/pdf/2201.04234"},
    "pages": [0, 1, 2, 3, 4]
  }' -o /dev/null
x-litellm-model-id: adb9957c3bd90d1c88196506af492c7fde40c2ddf35e04b0309d85eb7d657826
x-litellm-response-cost: 0.01
x-litellm-response-cost-original: 0.01

The response came back from the real API with model: mistral-ocr-2512 and usage_info.pages_processed: 2 on a 2-page call, and the 5-page call above billed exactly $0.01

Type

🆕 New Feature

Changes

mistral/mistral-ocr-2512 (Mistral OCR 3, Premier v25.12, released 2025-12-18) was missing from LiteLLM. This adds it to both model_prices_and_context_window.json and the bundled litellm/model_prices_and_context_window_backup.json at $2 / 1000 pages (ocr_cost_per_page: 0.002) and $3 / 1000 annotated pages (annotation_cost_per_page: 0.003), per the OCR 3 model card, mirroring the shape of the existing Mistral OCR entries. The Mistral OCR transformation is model-agnostic and passes the model name straight through, so no code changes were needed beyond the cost map.

Regression tests in tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_cost.py assert the entry exists with the correct pricing in both cost maps and that completion_cost scales at $0.002/page. Mutating either pricing value fails the new tests.

Adds the OCR 3 model (mistral-ocr-2512) released 2025-12-18 to both the
root and bundled backup cost maps at $2 / 1000 pages and $3 / 1000
annotated pages, mirroring the existing Mistral OCR entries. Regresses
the pricing in both maps and verifies completion_cost scales per page.
@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds mistral/mistral-ocr-2512 (Mistral OCR 3, Premier v25.12) to both cost maps at $0.002/page and $0.003/annotated page, matching the structure of the existing Mistral OCR entries. No code changes are required because the Mistral OCR transformation already passes the model name through generically.

  • Both model_prices_and_context_window.json and the bundled backup receive an identical new entry with mode: "ocr", ocr_cost_per_page: 0.002, and annotation_cost_per_page: 0.003.
  • Three new tests validate the JSON entries directly and exercise get_model_info / completion_cost against the local cost map via a monkeypatched fixture that avoids any network calls in CI.

Confidence Score: 5/5

Safe to merge — the change is limited to two JSON cost map files and a test file, with no modifications to any production code paths.

The change is additive-only: a new JSON entry in two cost map files that exactly mirrors the structure of the existing mistral-ocr-latest and mistral-ocr-4-0 entries. Tests confirm the entry is present and priced correctly in both files and that completion_cost scales linearly; the fixture correctly forces the local map to avoid CI network calls. No existing entries, tests, or logic were modified.

No files require special attention.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds mistral/mistral-ocr-2512 entry with ocr_cost_per_page: 0.002 and annotation_cost_per_page: 0.003, matching the schema of existing Mistral OCR entries.
litellm/model_prices_and_context_window_backup.json Mirror of the main cost map change — adds the same mistral/mistral-ocr-2512 entry to the bundled backup used when LITELLM_LOCAL_MODEL_COST_MAP is set.
tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_cost.py Adds three new test functions (raw JSON validation, get_model_info, and cost-scaling) for mistral-ocr-2512; uses a monkeypatched local cost map fixture to avoid network calls in CI.

Reviews (1): Last reviewed commit: "feat(mistral): add mistral/mistral-ocr-2..." | Re-trigger Greptile

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri
mateo-berri merged commit 5a1c783 into litellm_internal_staging Jun 26, 2026
122 checks passed
@mateo-berri
mateo-berri deleted the litellm_add_mistral_ocr_2512 branch June 26, 2026 17:29
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.

2 participants