Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Mistralai Client python Pip Install Mistralai

From Leeroopedia
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

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

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment