Skip to content
GitHubLog inStart free
cetra is not released yet. These docs describe the development version.

Mistral AI

Trace Mistral AI model calls with cetra from Python, with the OpenInference Mistral instrumentation.

Terminal window
pip install "cetra-sdk[mistralai]" mistralai
import os
import cetra
from mistralai.client import Mistral
cetra.init(instrument=["mistralai"])
client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])
response = client.chat.complete(
model="mistral-small-latest",
messages=[{"role": "user", "content": "What is the capital of France?"}],
)
print(response.choices[0].message.content)
cetra.flush()
  • Each chat completion is an llm span with the provider mistral_ai.
  • Input and output token counts come from the response.
  • Cost comes from the built-in prices.
  • The fixtures were captured with mistralai 3.7.0 and openinference-instrumentation-mistralai 2.3.5.
  • If a field is missing, look at the span’s Attributes tab and compare it with Span attributes.