skillfed

mistral_common

Mistral-common is a library of common utilities for Mistral AI.

mistral-common v1.11.7 8.9M downloads/30d#1,573 on PyPI
Permissive license Apache-2.0 Active released

What it is and what it does

mistral-common is a utility library that exposes Mistral AI's internal tokenization, validation, and normalization code for public use. It handles tokenization of text, images, and tool calls, plus request/response validation built on Pydantic. The library is versioned to guarantee backward compatibility with released models.

The package is designed for two audiences: developers integrating Mistral models into applications, and those building custom models who want to use Mistral's tokenization and validation approach. It ships with eight runtime dependencies (pydantic, requests, numpy, pillow, tiktoken, jsonschema, typing-extensions, pydantic-extra-types) and supports optional extras for image, audio, Hugging Face Hub integration, and experimental server mode.

Use it for:

  • Tokenize text and images before sending to Mistral models to verify token counts and optimize prompt engineering.
  • Validate and normalize API requests and tool calls to match Mistral's expected format before calling the model.
  • Build custom LLM applications that need consistent tokenization behavior across multiple model versions.
  • Integrate Mistral model support into frameworks that require standardized token counting and validation.
  • Develop local preprocessing pipelines that mirror Mistral's server-side validation without API calls.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides tokenizers, validation, and normalization utilities for working with Mistral AI models, supporting text, images, and tool calls with versioned tokenizers for backward compatibility.

Yes. mistral-common is actively maintained, has no known vulnerabilities, and low install friction. Install it if you are building applications with Mistral models and need local tokenization, validation, or want to ensure token counts match what the API will see. The permissive Apache 2.0 license poses no restrictions. Skip it only if you are not using Mistral models or do not need pre-flight validation.

Install

mistral-common on PyPI

pip

pip install mistral-common

uv

uv add mistral-common

poetry

poetry add mistral-common

Installing mistral_common

Before you install

Low install friction with a pure-wheel distribution and eight common dependencies (pydantic, requests, numpy, pillow, tiktoken, jsonschema, typing-extensions, pydantic-extra-types). Actively maintained with a release 22 days ago.

License in practice

Licensed under Apache 2.0 (permissive), allowing commercial use and modification with attribution. No notable restrictions for typical integration into applications.

Quickstart

pip install mistral-common

from mistral_common.tokens.tiktoken import get_encoding

encoding = get_encoding("v3")
tokens = encoding.encode("Hello, world!")

Requires Python 3.10 or later (supports up to 3.14); optional extras (image, audio, hf-hub, sentencepiece, server) available for extended functionality.

Verify before relying

  • Whether the tokenizers are compatible with all current Mistral model versions or only specific releases.
  • Performance characteristics (tokenization speed, memory overhead) compared to direct model APIs.
  • Whether validation and normalization code is used by the official Mistral Python client or is independent.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (<3.15,>=3.10.0)
Install friction low — pure-Python wheel
Runtime dependencies 8 — pydantic, jsonschema, typing-extensions, tiktoken, pillow, requests, numpy, pydantic-extra-types
Maintenance actively maintained — 22 days since the last release
First released
Downloads 8,944,595/month — #1,573 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mistral_common-1.11.7-py3-none-any.whl

Tags

mistral ai tokenizerllm tokenization librarymistral model utilitiestext and image tokenizationpydantic validation for llms
mistral-aitokenizationllm-utilities

More Artificial Intelligence packages