---
title: "Mistral AI"
description: "Adds instrumentation for the Mistral AI SDK. (default)"
url: https://docs.sentry.io/platforms/javascript/guides/hono/configuration/integrations/mistral/
---

# Mistral AI | Sentry for Hono

Requires SDK version `11.0.0` or higher.

*Import name: `Sentry.mistralAIIntegration`*

This integration is enabled by default when tracing is enabled. If you'd like to modify your default integrations, read [this](https://docs.sentry.io/platforms/javascript/guides/hono/configuration/integrations.md#modifying-default-integrations).

The `mistralAIIntegration` adds instrumentation for the [`@mistralai/mistralai`](https://www.npmjs.com/package/@mistralai/mistralai) SDK to capture [agent tracing](https://docs.sentry.io/platforms/javascript/guides/hono/agent-tracing.md) `gen_ai` spans, recording model, token usage, latency, and (when enabled) inputs and outputs.

```javascript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  // Tracing must be enabled for agent tracing to work
  tracesSampleRate: 1.0,
  integrations: [Sentry.mistralAIIntegration()],
});
```

## [Supported Operations](https://docs.sentry.io/platforms/javascript/guides/hono/configuration/integrations/mistral.md#supported-operations)

By default, tracing support is added to the following Mistral AI SDK calls:

* `chat.complete()` / `chat.parse()` - Chat completion requests
* `chat.stream()` / `chat.parseStream()` - Streaming chat completions
* `embeddings.create()` - Embedding requests
* `agents.complete()` - Agent completion requests
* `agents.stream()` - Streaming agent completions

Streaming and non-streaming requests are automatically detected and handled appropriately.

## [Supported Versions](https://docs.sentry.io/platforms/javascript/guides/hono/configuration/integrations/mistral.md#supported-versions)

* `@mistralai/mistralai`: `>=2.0.0 <3`

## [Options](https://docs.sentry.io/platforms/javascript/guides/hono/configuration/integrations/mistral.md#options)

### [`recordInputs`](https://docs.sentry.io/platforms/javascript/guides/hono/configuration/integrations/mistral.md#recordinputs)

*Type: `boolean` (optional)*

Records inputs to Mistral AI SDK calls (such as prompts and messages).

Defaults to `true` if `dataCollection.genAI.inputs` is `true` (which is the default when using `dataCollection`), or if the deprecated `sendDefaultPii` is `true`.

### [`recordOutputs`](https://docs.sentry.io/platforms/javascript/guides/hono/configuration/integrations/mistral.md#recordoutputs)

*Type: `boolean` (optional)*

Records outputs from Mistral AI SDK calls (such as generated text and responses).

Defaults to `true` if `dataCollection.genAI.outputs` is `true` (which is the default when using `dataCollection`), or if the deprecated `sendDefaultPii` is `true`.

```javascript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  tracesSampleRate: 1.0,
  integrations: [
    Sentry.mistralAIIntegration({
      recordInputs: true,
      recordOutputs: true,
    }),
  ],
});
```

## [Manual Instrumentation](https://docs.sentry.io/platforms/javascript/guides/hono/configuration/integrations/mistral.md#manual-instrumentation)

*Import name: `Sentry.instrumentMistralAiClient`*

If your application does not use automatic instrumentation, wrap your Mistral client after setting up Sentry. Use the returned client for all Mistral calls.

Import Sentry from the entry point for your runtime: `@sentry/hono/node`, `@sentry/hono/bun`, or `@sentry/hono/cloudflare`.

```javascript
import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({ apiKey: "your-mistral-api-key" });
const client = Sentry.instrumentMistralAiClient(mistral, {
  recordInputs: false,
  recordOutputs: false,
});

const response = await client.chat.complete({
  model: "mistral-small-latest",
  messages: [{ role: "user", content: "Hello!" }],
});
```

Use one instrumentation approach for each client. If automatic instrumentation is already active, you don't need to wrap the client.
