mistralai/client-python
Typed Python SDK for Mistral inference APIs on Mistral, Azure AI, and Vertex AI
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
mistralai/client-python is a Python SDK for calling Mistral APIs, not a model-serving engine. Its Speakeasy-generated surface groups operations into resource namespaces such as chat, embeddings, files, and audio. The base package depends on Pydantic 2 for data modeling and httpx2 for HTTP, and also includes OpenTelemetry API and semantic-convention dependencies. The Mistral entry point supports both synchronous and asynchronous context managers, so either style can scope the client lifecycle explicitly.
The cloud adapters handle provider-specific connection details. MistralAzure takes an endpoint and key and injects api-version; MistralGCP resolves Google Application Default Credentials, refreshes tokens, and constructs the Vertex AI URL from project and region. Extras keep additional dependencies out of the base install: realtime adds websockets, mcp adds the MCP package, and agents adds MCP, Griffe, and Authlib.
Key Capabilities & Differentiators
For application inference, the SDK covers chat completions, embeddings, agent completions, and file upload. The chat example uses mistral-large-latest, the embedding example uses mistral-embed, and the Vertex AI example uses mistral-small-2503. These are example model IDs, not a cross-provider availability list. The audio surface includes speech generation, SSE transcription streaming, custom voice operations, and lifecycle APIs for live audio-agent sessions. Live voice conversations require the voice-agents extra.
The beta API surface extends beyond inference calls. Its RAG namespace exposes operations to list and register ingestion pipeline configurations and update run information. Evaluation operations cover pipelines and scorers, run search, record lookup, and statistics; optimization trials can be listed with paginated results. These are client interfaces for remote operations, not local ingestion or evaluation engines.
Trade-offs & Limitations
Compared with direct HTTP calls, the SDK is most useful when an application needs typed request and response models, both sync and async paths, streaming, or provider-specific credentials. For a service that calls one or two fixed operations, a thin HTTP wrapper can mean fewer dependencies and tighter control over compatibility. The cost of adopting a broad generated surface is that SDK upgrades can affect imports and types even when the application is not deliberately adopting new endpoints.
Compared with a local inference server, the SDK avoids model loading and GPU provisioning, but request latency, quotas, data handling, and usage costs still depend on the remote service. The Azure and Vertex AI adapters simplify connection and authentication; they do not establish feature parity across providers. Apache-2.0 covers the client code, not model-weight rights or the terms of the hosted service.
Hardware & Deployment Guide
Install mistralai into a Python 3.10+ application with pip, uv, or Poetry. For the Mistral API, credential precedence is a per-request Authorization header, an explicit api_key (which may be a callable), the mounted file at MISTRAL_SA_TOKEN_PATH, then MISTRAL_API_KEY. The file is reread on every request for rotation; an unreadable or empty file raises ServiceAccountTokenError instead of falling back to the environment key. Azure requires a deployed endpoint and key; Vertex AI requires a configured Google Cloud project, application credentials, and the gcp extra.
Hosted calls do not require local model weights, CUDA, or GPU VRAM. Size the client for concurrent requests, open streams, and file handling. For version selection, distinguish the source manifest (3.10.0) from the latest listed release (v3.9.0). The v3.8.0 notes list seven stable-surface removals, and v3.9.0 lists 122 beta-surface removals alongside a generated-baseline discrepancy. Pin the release you test and check the specific methods and types your application imports before upgrading.
Python backends that need typed access to Mistral chat, embeddings, or audio, with sync and async calls or dedicated Azure AI and Vertex AI adapters.
You need offline inference, control over the serving stack, or a provider-neutral API. For a single stable endpoint, direct HTTP may be easier to maintain.
Quick Start & Installation
uv add mistralaiComparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| client-python ★ | 784 | +3 | Python | Apache-2.0 | Typed Python SDK for Mistral inference APIs on Mistral, Azure AI, and Vertex AI |
| transformers | 169.6k | +337 | Python | Apache-2.0 | A PyTorch model-definition SDK for unified inference and training across modalit |
| pytorch | 105.9k | +299 | Python | — | Python-first tensor SDK for GPU-accelerated training and inference |
| qlib | 50.8k | +197 | Python | MIT | Modular 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.
curl -sL https://repoforai.com/repo/mistralai/client-python.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about client-python
How do I integrate the client into a synchronous service or an asyncio application?
Mistral from mistralai.client and use it as a context manager. Call chat.complete in synchronous code or await chat.complete_async in an async with block. If using a mounted token, remember that a per-request Authorization header or an explicit api_key takes precedence over MISTRAL_SA_TOKEN_PATH.Does the client need a GPU, and what determines its resource footprint?
Can I use it commercially or self-host inference under Apache-2.0?
When should I use this SDK instead of calling the API directly?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
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