{"id":47,"library":"mistral","title":"Mistral AI Python SDK","description":"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.","status":"active","version":"1.12.4","language":"python","source_language":"en","source_url":"https://pypi.org/project/mistralai/","tags":["mistral","llm","chat","completions","agents","embeddings","ocr","france"],"install":[{"cmd":"pip install mistralai","lang":"bash","label":"pip (installs v1 — stable)"},{"cmd":"uv add mistralai","lang":"bash","label":"uv"},{"cmd":"pip install 'mistralai[agents]'","lang":"bash","label":"pip (with agents support)"},{"cmd":"pip install mistralai-azure","lang":"bash","label":"Azure deployment"},{"cmd":"pip install mistralai-gcp","lang":"bash","label":"Google Cloud deployment"}],"dependencies":[{"reason":"v0.x is fully deprecated. MistralClient class no longer exists.","package":"mistralai>=1.0.0","optional":false},{"reason":"Required for agents API (mistral.agents.complete). Python 3.10+ only.","package":"mistralai[agents]","optional":true}],"imports":[{"wrong":"from mistralai import Mistral","symbol":"Mistral","correct":"from mistralai import Mistral"}],"quickstart":{"code":"import os\nfrom mistralai import Mistral\n\nclient = Mistral(api_key=os.environ['MISTRAL_API_KEY'])\n\nresponse = client.chat.complete(\n    model='mistral-large-latest',\n    messages=[{'role': 'user', 'content': 'Hello'}]\n)\nprint(response.choices[0].message.content)","lang":"python","description":"Minimal chat completion using v1 SDK"},"warnings":[{"fix":"Replace MistralClient(api_key=...) with Mistral(api_key=...). Same constructor signature.","message":"MistralClient and MistralAsyncClient are removed. Use Mistral class for both sync and async.","severity":"breaking","affected_versions":"v0.x"},{"fix":"Change client.chat(model=m, messages=msgs) to client.chat.complete(model=m, messages=msgs)","message":"client.chat() call signature removed. Now client.chat.complete() for sync, client.chat.complete_async() for async.","severity":"breaking","affected_versions":"v0.x"},{"fix":"Add .data between chunk and .choices in all streaming handlers","message":"Streaming chunk structure changed. chunk.choices[0] no longer works — must use chunk.data.choices[0].","severity":"breaking","affected_versions":"v0.x"},{"fix":"Replace ChatMessage(role='user', content='...') with {'role': 'user', 'content': '...'}","message":"ChatMessage class removed from mistralai.models.chat_completion. Use plain dicts or new typed message classes.","severity":"breaking","affected_versions":"v0.x"},{"fix":"Always include tool_call_id in tool response messages","message":"tool_call_id is now mandatory in messages with role 'tool'. Omitting it causes API error.","severity":"breaking","affected_versions":"all v1+"},{"fix":"Use PyPI docs at pypi.org/project/mistralai for v1 reference. GitHub main = v2 pre-release.","message":"pip 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.","severity":"gotcha","affected_versions":"current"},{"fix":"pip install 'mistralai[agents]' and ensure Python 3.10+","message":"Agents API requires Python 3.10+ and mistralai[agents] extra. Base install does not include it.","severity":"gotcha","affected_versions":"v1+"},{"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.","message":"mistralai-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.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'agent':52 'ai':2,10 'api':11 'break':17 'chat':50 'code':40 'complet':51 'embed':53 'franc':55 'generat':39 'github':31 'gone':13 'llm':38,49 'llm-gener':37 'longer':46 'major':16 'mistral':1,9,48 'mistralcli':21 'ocr':54 'offici':5 'pattern':43 'pre':28 'pre-releas':27 'pypi':35 'python':3,6 'refer':41 'releas':29 'remov':22 'rewrit':18 'sdk':4,7 'two':15 'v0':19,42 'v1':20,24 'v2':25 'work':47 'yet':33","created_at":"2026-03-16T04:39:09.011572+00:00","updated_at":"2026-04-16T16:33:29.845722+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'Mistral' from 'mistralai' (unknown location)"},"ecosystem":"pypi","meta_description":null,"install_score":0,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"22.0.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://docs.openstack.org/mistral/latest/","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/mistral/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["llm-agents","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-08-26","next_check":"2026-07-10","install_tag":"stale"}}