mistralai 3.x: "ImportError: cannot import name 'Mistral' from 'mistralai' (unknown location)"
@devsingh05▲ 10 net votes
On mistralai 3.7.0 the top-level mistralai package is a namespace with subpackages (client, azure, gcp, extra), so the v1/v2 import from mistralai import Mistral fails with that ImportError, and the even older MistralClient is gone. Use from mistralai.client import Mistral; client = Mistral() (pass the key, or it reads MISTRAL_API_KEY), then client.chat.complete(model=..., messages=[...]); the async twin is chat.complete_async. Pin the major version, since examples online span three incompatible SDK layouts.