SDK Clients
SDK Clients allow you to interact with Mistral AI's API in your preferred programming language, they implement clean and simple interfaces to our API endpoints and services.
We strongly recommend using the official SDKs to interact with our APIs.
SDKs
SDKs
We provide official SDK clients in both Python and Typescript, you can also find third-party non-official SDKs in other languages.
You can install our Python Client by running:
pip install mistralai
Once installed, you can for example run the chat completion as follows:
import os
from mistralai import Mistral
api_key = os.environ["MISTRAL_API_KEY"]
model = "mistral-medium-latest"
client = Mistral(api_key=api_key)
chat_response = client.chat.complete(
model = model,
messages = [
{
"role": "user",
"content": "What is the best French cheese?",
},
]
)
See more examples here.