Registry / llm-agents / mistral

mistral

JSON →
library22.0.0pypypi✓ verified 26d ago

Official Python SDK for Mistral AI API. Has gone through two major breaking rewrites: v0 → v1 (MistralClient removed) and v1 → v2 (in pre-release on GitHub, not yet on PyPI). Most LLM-generated code references v0 patterns which no longer work.

pip install mistralai
INSTALL
IMPORT
SIG · MISTRAL
M
mistral
llm-agentspythonv22.0.0
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
2/4 runs
2/4 runs
py 3.11
2/4 runs
2/4 runs
py 3.12
2/4 runs
2/4 runs
py 3.13
2/4 runs
2/4 runs
py 3.9
2/4 runs
2/4 runs
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Mistral
from mistralai import Mistral
from mistralai import Mistral

Minimal chat completion using v1 SDK

import os from mistralai import Mistral client = Mistral(api_key=os.environ['MISTRAL_API_KEY']) response = client.chat.complete( model='mistral-large-latest', messages=[{'role': 'user', 'content': 'Hello'}] ) print(response.choices[0].message.content)
Debug
Known issues
breakingMistralClient and MistralAsyncClient are removed. Use Mistral class for both sync and async.
fix
Replace MistralClient(api_key=...) with Mistral(api_key=...). Same constructor signature.
affects: v0.x
breakingclient.chat() call signature removed. Now client.chat.complete() for sync, client.chat.complete_async() for async.
fix
Change client.chat(model=m, messages=msgs) to client.chat.complete(model=m, messages=msgs)
affects: v0.x
breakingStreaming chunk structure changed. chunk.choices[0] no longer works — must use chunk.data.choices[0].
fix
Add .data between chunk and .choices in all streaming handlers
affects: v0.x
breakingChatMessage class removed from mistralai.models.chat_completion. Use plain dicts or new typed message classes.
fix
Replace ChatMessage(role='user', content='...') with {'role': 'user', 'content': '...'}
affects: v0.x
breakingtool_call_id is now mandatory in messages with role 'tool'. Omitting it causes API error.
fix
Always include tool_call_id in tool response messages
affects: all v1+
gotchapip install mistralai installs v1 (stable). GitHub main branch shows v2 docs which are NOT on PyPI yet. Don't follow GitHub README — it documents unreleased v2.
fix
Use PyPI docs at pypi.org/project/mistralai for v1 reference. GitHub main = v2 pre-release.
affects: current
gotchaAgents API requires Python 3.10+ and mistralai[agents] extra. Base install does not include it.
fix
pip install 'mistralai[agents]' and ensure Python 3.10+
affects: v1+
gotchamistralai-azure and mistralai-gcp are not separate PyPI packages. Azure/GCP deployments are typically configured via 'base_url' or specific client initialization parameters, not by installing additional packages.
fix
Refer to official Mistral AI documentation for configuring Azure/GCP deployments. Do not attempt to 'pip install mistralai-azure' or 'mistralai-gcp' as these packages are not available.
affects: all
Upgrade
Version history
22.0.0latest on PyPI · released Apr 1, 2026
Audit
Dependencies
mistralai>=1.0.0requiredv0.x is fully deprecated. MistralClient class no longer exists.
mistralai[agents]optionalRequired for agents API (mistral.agents.complete). Python 3.10+ only.
Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
mistral — pip install mistral · libregistry