Implementation:Mistralai Client python Pip Install Mistralai
| Knowledge Sources | |
|---|---|
| Domains | SDK_Setup, Package_Management |
| Last Updated | 2026-02-15 14:00 GMT |
Overview
Concrete tool for installing the Mistral AI Python SDK and configuring API authentication provided by pip/PyPI.
Description
The mistralai package is a Speakeasy-generated Python SDK for Mistral AI's API. Installing it via pip resolves the following key dependencies: httpx (async HTTP client), pydantic (data validation), typing_extensions, eval_type_backport, and opentelemetry-api (tracing). After installation, an API key must be set as the MISTRAL_API_KEY environment variable.
Usage
Run this command once per environment before using any Mistral AI SDK functionality. Use pip install mistralai for the standard SDK, pip install mistralai_azure for Azure deployments, or pip install "mistralai[gcp]" for GCP Vertex AI.
Code Reference
Source Location
- Repository: client-python
- File: pyproject.toml
Signature
pip install mistralai
Import
from mistralai import Mistral
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| Python environment | Python >= 3.9 | Yes | Active Python interpreter with pip |
| Network access | Internet | Yes | Access to PyPI registry |
Outputs
| Name | Type | Description |
|---|---|---|
| mistralai package | Python package | Installed SDK with all dependencies |
| MISTRAL_API_KEY | Environment variable | Must be set separately for authentication |
Usage Examples
Standard Installation
# Install the SDK
pip install mistralai
# Set API key
export MISTRAL_API_KEY="your-api-key-here"
Installation with Extras
# For GCP Vertex AI support
pip install "mistralai[gcp]"
# For Azure support
pip install mistralai_azure