← Back to Leaderboard
Mmistralai

mistralai/mistral-common

Python SDK for Mistral input validation and model-specific tokenization

View on GitHub ↗
AI FrameworkQuickstart ↓
Engineering Health (Methodology)
A+ · 94/100
Maintenance Activity
● Updated 2d ago
Latest Release
v1.13.1
Commercial License Check
Apache-2.0 · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption19/25
Release Cadence20/20
License Clarity20/20
CLI
Total Stars
★ 973
24h Growth
+0
7d Growth
+5
Forks
208

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

mistralai/mistral-common Star History (2024-04-16 - 2026-12-03) ALL-TIME STAR HISTORY (2024-04 – 2026-12) +972 in 961d · avg +1/day 1k 514 0 2024-04-16: ★ 12024-06-15: ★ 4312024-08-17: ★ 4612024-10-19: ★ 6092024-12-21: ★ 6342025-02-22: ★ 6592025-04-26: ★ 6942025-06-28: ★ 7322025-08-30: ★ 7732025-11-01: ★ 7952026-01-03: ★ 8222026-03-07: ★ 8552026-05-09: ★ 8812026-07-11: ★ 9132026-09-12: ★ 9342026-12-03: ★ 973 ★ 973 2024-04 2025-08 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

mistral-common is an in-process Python preprocessing layer between application payloads and a Mistral model runtime. It uses Pydantic for validation and normalization of requests, messages, tool calls, and responses. On the input path, the version-matched tokenizer converts normalized inputs into the representation expected by the target model. Model execution is outside this layer.

The base package depends on Pydantic 2.x (minimum 2.12), jsonschema, tiktoken, Pillow, NumPy, and requests, among other packages. Tokenizer implementations and input modalities define the main integration choices: newer models use Tekken, SentencePiece support is optional, and image, audio, and Hugging Face Hub support are distributed as install extras. The experimental server extra is another way to run tokenization, not an inference engine.

Key Capabilities & Differentiators

The library covers text, image, and tool-call tokenization, with audio tokenization available through an extra. Its structured request handling matters most for chat and tool integrations: plain text encoding alone does not enforce the message and tool-result conventions expected by a particular model. Select the tokenizer by target model and validate each required modality rather than assuming that every tokenizer version accepts the same inputs.

The version boundaries affect application behavior. In v1.13.0, tokenizer v2 rejects multiple tool results. In v1.13.1, from_openai maps the OpenAI developer role to system, and the v15 instruct tokenizer gained unit-suite coverage for model settings and JSON schemas. Exercise role conversion, tool-result cardinality, and schema-bearing requests in integration tests before changing package or tokenizer versions.

Trade-offs & Limitations

Compared with calling a general-purpose tokenizer such as tiktoken directly, this library gives you Mistral-specific request validation and versioned encoding in one place. That is valuable when tool calls, message roles, or media are part of the input contract. If your application already handles formatting and only needs raw text encoding and decoding, the additional validation stack and dependency footprint may not be worthwhile. If a hosted API already performs preprocessing, add the library only if you have a concrete need for local validation or tokenization.

Versioned tokenizers help preserve compatibility, but they do not make versions interchangeable. Pin and test the package, tokenizer assets, and target model together, especially across role-conversion and tool-validation changes. The library is Apache-2.0; commercial redistribution still requires the applicable notices, and the terms for model weights and separately obtained artifacts must be reviewed independently.

Hardware & Deployment Guide

Install with pip install mistral-common on Python 3.11 through 3.15. The manifest requires tiktoken >=0.7.0 through Python 3.13 and >=0.12.0 from Python 3.14 onward. Add only the extras you need: image, audio, hf-hub, sentencepiece, or the experimental server. For repository development, the uv.lock workflow uses uv sync --frozen --all-extras --group dev.

For an offline deployment, stage the matching tokenizer assets before rollout and test startup without network access; the hf-hub extra is for downloading assets, not a requirement for running preprocessing against locally available files. The v1.13.0 cache_dir fix makes cached-file listing respect a custom directory. Size preprocessing against representative payloads and concurrency, particularly for media, and budget model serving separately.

Architecture: a Python preprocessing library, separate from model execution.
Data contract: Pydantic 2.12+ within major version 2 underpins validation and normalization of requests, messages, tool calls, and responses.
Tokenizer selection: recent Mistral models use Tekken; SentencePiece support installs separately for models that need it.
Media inputs: image and audio support are packaged as independent extras.
Artifact management: the hf-hub extra supports tokenizer downloads, and v1.13.0 honors cache_dir when listing locally cached files.
Compatibility: v1.13.1 maps OpenAI developer messages to system in from_openai; v1.13.0 rejects multiple tool results in tokenizer v2.
Best For

Python applications and self-hosted Mistral inference stacks that need model-matched tokenization and consistent handling of chat, tools, or supported media inputs.

Skip If

You need a model server that runs generation, a provider-neutral tokenizer, or no local preprocessing because your hosted API already handles it.

Reviewed on 2026-12-01 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

CLI
pip install mistral-common

Comparison vs. Top LLMs & Inference Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
mistral-common ★973+5PythonApache-2.0Python SDK for Mistral input validation and model-specific tokenization
transformers169.6k+337PythonApache-2.0A PyTorch model-definition SDK for unified inference and training across modalit
pytorch105.9k+299Python—Python-first tensor SDK for GPU-accelerated training and inference
qlib50.8k+197PythonMITModular Python framework for quant research, from market data to backtests

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/mistralai/mistral-common.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

mistralai/mistral-common Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about mistral-common

Where does mistral-common fit in a self-hosted inference stack?

Put it at the request-to-model boundary. Validate and normalize structured messages and tool calls, select the tokenizer that matches the target model, and pass the prepared input to your inference runtime. The experimental server extra exposes tokenization in server mode; it does not run model weights.

How should I size hardware for preprocessing?

There is no separate model-weight VRAM budget for this library. Size the preprocessing path for CPU time and host memory based on input length, media size, and concurrent requests. Benchmark representative image and audio inputs separately from text, and size the generation runtime independently.

Can I use it in a commercial self-hosted product?

The library is Apache-2.0 and can be used in commercial self-hosted systems. Meet its license and notice obligations when redistributing it, and review the terms for model weights, tokenizer artifacts, and optional dependencies separately. The library license does not grant rights to those components.

Is this a replacement for a general-purpose tokenizer?

Not for every workload. A general-purpose tokenizer is enough if you only need raw text encoding and decoding and already handle input formatting. Choose mistral-common when you need Mistral-specific structured request validation and model-version-specific encoding for chat, tools, or supported media. For non-Mistral models, use the input contract and tokenizer those models expect.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining mistralai/mistral-common? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature mistralai/mistral-common on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare