---
id: audio
title: Offline
sidebar_position: 1.1
---

# Offline Transcription

<SectionTab as="h1" sectionId="before-you-start">Before You Start</SectionTab>

### Models with Audio Capabilities

Audio capable models:
- **Voxtral Small** (`voxtral-small-latest`) with audio input for [chat](#chat-with-audio) use cases.
- **Voxtral Mini Transcribe 2** (`voxtral-mini-latest` via `audio/transcriptions`), with an efficient [transcription](#transcription) only service.

:::tip
For faster transcription time, we recommend uploading your audio files.
:::

<SectionTab as="h1" sectionId="models">Chat with Audio</SectionTab>

### Use Audio with Instruction Following models

Our Voxtral models are capable of being used for chat use cases with our chat completions endpoint.

:::tip
Before continuing, we recommend reading the [Chat Completions](/studio/conversations/chat-completion) documentation to learn more about the chat completions API and how to use it before proceeding.
:::

<ExplorerTabs id="chat-with-audio">
  <ExplorerTab value="passing-an-audio-file" label="Passing an Audio File in Base64">
    To pass a local audio file, you can encode it in base64 and pass it as a string.

<Tabs groupId="code">
    <TabItem value="python" label="python">
        <Tabs groupId="sdk-version">
            <TabItem value="v1" label="V1">

```python
import base64
from mistralai import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-small-latest"

client = Mistral(api_key=api_key)

# Encode the audio file in base64
with open("examples/files/bcn_weather.mp3", "rb") as f:
    content = f.read()
audio_base64 = base64.b64encode(content).decode('utf-8')

chat_response = client.chat.complete(
    model=model,
    messages=[{
        "role": "user",
        "content": [
            {
                "type": "input_audio",
                "input_audio": audio_base64,
            },
            {
                "type": "text",
                "text": "What's in this file?"
            },
        ]
    }],
)
```

            </TabItem>
            <TabItem value="v2" label="V2" default>

```python
import base64
from mistralai.client import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-small-latest"

client = Mistral(api_key=api_key)

# Encode the audio file in base64
with open("examples/files/bcn_weather.mp3", "rb") as f:
    content = f.read()
audio_base64 = base64.b64encode(content).decode('utf-8')

chat_response = client.chat.complete(
    model=model,
    messages=[{
        "role": "user",
        "content": [
            {
                "type": "input_audio",
                "input_audio": audio_base64,
            },
            {
                "type": "text",
                "text": "What's in this file?"
            },
        ]
    }],
)
```

            </TabItem>
        </Tabs>
    </TabItem>
    <TabItem value="typescript" label="typescript">

```typescript

const apiKey = process.env["MISTRAL_API_KEY"];

const client = new Mistral({ apiKey: apiKey });

// Encode the audio file in base64
const audio_file = fs.readFileSync('local_audio.mp3');
const audio_base64 = audio_file.toString('base64');

const chatResponse = await client.chat.complete({
  model: "voxtral-small-latest",
  messages: [
    {
      role: "user",
      content: [
        {
          type: "input_audio",
          input_audio: audio_base64,
        },
        {
          type: "text",
          text: "What's in this file?",
        },
      ],
    },
  ],
});
```

    </TabItem>
    <TabItem value="curl" label="curl" default>

```bash
curl --location https://api.mistral.ai/v1/chat/completions \
  --header "Authorization: Bearer $MISTRAL_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "voxtral-small-latest",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "input_audio",
            "input_audio": "<audio_base64>",
          },
          {
            "type": "text",
            "text": "What'\''s in this file?"
          }
        ]
      }
    ]
  }'
```

    </TabItem>
    <TabItem value="output" label="output">

  ```json
{
  "id": "d719e752a0f845c895758933ea488cb0",
  "created": 1756386611,
  "model": "voxtral-small-latest",
  "usage": {
    "prompt_audio_seconds": 19,
    "prompt_tokens": 10,
    "total_tokens": 452,
    "completion_tokens": 67
  },
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "tool_calls": null,
        "content": "The audio file appears to be a compilation of music or sound effects, as indicated by the repeated, short, and varied sounds. However, without the context of the audio, it's challenging to determine what specific sounds or music are included. If you have more details or the audio itself, I could provide a more accurate analysis."
      }
    }
  ]
}
```

    </TabItem>
</Tabs>
  </ExplorerTab>
  <ExplorerTab value="passing-an-audio-url" label="Passing an Audio URL">
    You can also provide a public url of a file.

<Tabs groupId="code">
    <TabItem value="python" label="python">
        <Tabs groupId="sdk-version">
            <TabItem value="v1" label="V1">

```python
import os
from mistralai import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-small-latest"

client = Mistral(api_key=api_key)

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "input_audio",
                "input_audio": "https://download.samplelib.com/mp3/sample-15s.mp3",
            },
            {
                "type": "text",
                "text": "What's in this file?"
            }
        ]
    }
]

chat_response = client.chat.complete(
    model=model,
    messages=messages
)
```

            </TabItem>
            <TabItem value="v2" label="V2" default>

```python
import os
from mistralai.client import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-small-latest"

client = Mistral(api_key=api_key)

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "input_audio",
                "input_audio": "https://download.samplelib.com/mp3/sample-15s.mp3",
            },
            {
                "type": "text",
                "text": "What's in this file?"
            }
        ]
    }
]

chat_response = client.chat.complete(
    model=model,
    messages=messages
)
```

            </TabItem>
        </Tabs>
    </TabItem>
    <TabItem value="typescript" label="typescript">

```typescript

const apiKey = process.env["MISTRAL_API_KEY"];

const client = new Mistral({ apiKey: apiKey });

const chatResponse = await client.chat.complete({
  model: "voxtral-small-latest",
  messages: [
    {
      role: "user",
      content: [
        {
          type: "input_audio",
          input_audio: "https://download.samplelib.com/mp3/sample-15s.mp3",
        },
        {
          type: "text",
          text: "What's in this file?",
        },
      ],
    },
  ],
});
```

    </TabItem>
    <TabItem value="curl" label="curl" default>

```bash
curl --location https://api.mistral.ai/v1/chat/completions \
  --header "Authorization: Bearer $MISTRAL_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "voxtral-small-latest",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "input_audio",
            "input_audio": "https://download.samplelib.com/mp3/sample-15s.mp3"
          },
          {
            "type": "text",
            "text": "What'\''s in this file?"
          }
        ]
      }
    ]
  }'
```

    </TabItem>
    <TabItem value="output" label="output">

  ```json
{
  "id": "d719e752a0f845c895758933ea488cb0",
  "created": 1756386611,
  "model": "voxtral-small-latest",
  "usage": {
    "prompt_audio_seconds": 19,
    "prompt_tokens": 10,
    "total_tokens": 452,
    "completion_tokens": 67
  },
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "tool_calls": null,
        "content": "The audio file appears to be a compilation of music or sound effects, as indicated by the repeated, short, and varied sounds. However, without the context of the audio, it's challenging to determine what specific sounds or music are included. If you have more details or the audio itself, I could provide a more accurate analysis."
      }
    }
  ]
}
```

    </TabItem>
</Tabs>
  </ExplorerTab>
  <ExplorerTab value="passing-an-uploaded-audio-file" label="Passing an Uploaded Audio File">
    Alternatively, you can upload a local file to our cloud and then use a signed URL for the task.

<Tabs groupId="code">
    <TabItem value="python" label="python">
        <Tabs groupId="sdk-version">
            <TabItem value="v1" label="V1">

```python
import os
from mistralai import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-small-latest"

client = Mistral(api_key=api_key)

# If local audio, upload and retrieve the signed url
with open("music.mp3", "rb") as f:
    uploaded_audio = client.files.upload(
      file={
          "content": f,
          "file_name": f.name
      },
      purpose="audio"
    )
signed_url = client.files.get_signed_url(file_id=uploaded_audio.id)

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "input_audio",
                "input_audio": signed_url.url,
            },
            {
                "type": "text",
                "text": "What's in this file?"
            }
        ]
    }
]

chat_response = client.chat.complete(
    model=model,
    messages=messages
)
```

            </TabItem>
            <TabItem value="v2" label="V2" default>

```python
import os
from mistralai.client import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-small-latest"

client = Mistral(api_key=api_key)

# If local audio, upload and retrieve the signed url
with open("music.mp3", "rb") as f:
    uploaded_audio = client.files.upload(
      file={
          "content": f,
          "file_name": f.name
      },
      purpose="audio"
    )
signed_url = client.files.get_signed_url(file_id=uploaded_audio.id)

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "input_audio",
                "input_audio": signed_url.url,
            },
            {
                "type": "text",
                "text": "What's in this file?"
            }
        ]
    }
]

chat_response = client.chat.complete(
    model=model,
    messages=messages
)
```

            </TabItem>
        </Tabs>
    </TabItem>
    <TabItem value="typescript" label="typescript">

```typescript

const apiKey = process.env["MISTRAL_API_KEY"];

const client = new Mistral({ apiKey: apiKey });

// If local document, upload and retrieve the signed url
const audio_file = fs.readFileSync('local_audio.mp3');
const uploaded_audio = await client.files.upload({
  file: audio_file,
  purpose: "audio",
});
const signedUrl = await client.files.getSignedUrl({
    fileId: uploaded_audio.id,
});

const chatResponse = await client.chat.complete({
  model: "voxtral-small-latest",
  messages: [
    {
      role: "user",
      content: [
        {
          type: "input_audio",
          input_audio: signedUrl.url,
        },
        {
          type: "text",
          text: "What's in this file?",
        },
      ],
    },
  ],
});
```

    </TabItem>
    <TabItem value="curl" label="curl" default>

**Upload the Audio File**
```bash
curl --location https://api.mistral.ai/v1/files \
  --header "Authorization: Bearer $MISTRAL_API_KEY" \
  --form purpose="audio" \
  --form file="@local_audio.mp3"
```

**Get the Signed URL**
```bash
curl --location "https://api.mistral.ai/v1/files/$id/url?expiry=24" \
    --header "Accept: application/json" \
    --header "Authorization: Bearer $MISTRAL_API_KEY"
```

**Send Completion Request**
```bash
curl --location https://api.mistral.ai/v1/chat/completions \
  --header "Authorization: Bearer $MISTRAL_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "voxtral-small-latest",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "input_audio",
            "input_audio": "<signed_url>"
          },
          {
            "type": "text",
            "text": "What'\''s in this file?"
          }
        ]
      }
    ]
  }'
```

    </TabItem>
    <TabItem value="output" label="output">

```json
{
  "id": "d719e752a0f845c895758933ea488cb0",
  "created": 1756386611,
  "model": "voxtral-small-latest",
  "usage": {
    "prompt_audio_seconds": 19,
    "prompt_tokens": 10,
    "total_tokens": 452,
    "completion_tokens": 67
  },
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "tool_calls": null,
        "content": "The audio file appears to be a compilation of music or sound effects, as indicated by the repeated, short, and varied sounds. However, without the context of the audio, it's challenging to determine what specific sounds or music are included. If you have more details or the audio itself, I could provide a more accurate analysis."
      }
    }
  ]
}
```

    </TabItem>
</Tabs>
  </ExplorerTab>
</ExplorerTabs>

<SectionTab as="h2" variant="secondary" sectionId="example-samples">Example Samples</SectionTab>

Below you can find a few of the multiple use cases possible, by leveraging the audio capabilities of our models.

<ExplorerTabs id="audio-transcription-2" mode="close">
  <ExplorerTab value="chat" label="Chat">
    **User**

<audio controls>
    <source src="/audio/chat.wav" type="audio/wav"/>
    Your browser does not support the audio element.
</audio>

**Assistant**

Sure, here is the transcription of what you said:  
"Today on July 15th, 2025, Mistral AI is announcing the new Voxtral models."  
And here is the Python code to generate the first n digits of the Fibonacci sequence:  
```python
def fibonacci(n):
    if n <= 0:
        return []
    elif n == 1:
        return [0]
    elif n == 2:
        return [0, 1]

fib_sequence = [0, 1]
for i in range(2, n):
    next_value = fib_sequence[-1] + fib_sequence[-2]
    fib_sequence.append(next_value)

return fib_sequence

# Example usage:
n = 10  # Change this value to get the first n digits of the Fibonacci sequence
print(fibonacci(n))
```
This code defines a function `fibonacci` that takes an integer `n` and returns a list containing the first `n` digits of the Fibonacci sequence. You can change the value of `n` to get the desired number of Fibonacci digits.
  </ExplorerTab>
  <ExplorerTab value="music" label="Music">
    **User**

<audio controls>
    <source src="/audio/music.mp3" type="audio/mp3"/>
    Your browser does not support the audio element.
</audio>
What's in this file?

**Assistant**

The audio file contains music.
  </ExplorerTab>
  <ExplorerTab value="compare-speakers" label="Compare Speakers">
    **User**

<audio controls>
    <source src="/audio/obama.mp3" type="audio/mp3"/>
    Your browser does not support the audio element.
</audio>
<audio controls>
    <source src="/audio/bcn_weather.mp3" type="audio/mp3"/>
    Your browser does not support the audio element.
</audio>

Which speaker do you prefer between the two? Why? How are they different from each other?

**Assistant**

The speaker who delivers the farewell address is more engaging and inspiring.  
They express gratitude and optimism, emphasizing the importance of self-government and citizenship.  
They also share personal experiences and observations, making the speech more relatable and heartfelt.  
In contrast, the second speaker provides factual information about the weather in Barcelona, which is less engaging and lacks the emotional depth of the first speaker's address.
  </ExplorerTab>
</ExplorerTabs>

<SectionTab as="h1" sectionId="transcription">Transcription</SectionTab>

### Transcribe any Audio

Transcription provides an optimized endpoint for transcription purposes and currently supports `voxtral-mini-latest`, which runs **Voxtral Mini Transcribe 2**.

**Parameters**  
We provide different settings and parameters for transcription, such as:
- `timestamp_granularities`: This allows you to set timestamps to track not only "what" was said but also "when". You can find more about timestamps [here](#transcription-with-timestamps).
- `diarize`: This allows you to keep track of who is talking.
- `context_bias`: Provide up to 100 words or phrases to guide the model toward correct spellings of names, technical terms, or domain-specific vocabulary. Particularly useful for proper nouns or industry terminology that standard models often miss. Context biasing is optimized for English; support for other languages is experimental. You can find more about context biasing [here](#context-biasing).
- `language`: Our transcription service also works as a language detection service. However, you can manually set the language of the transcription for better accuracy if the language of the audio is already known.

**Realtime**:
We provide a live transcription functionality. You can find more info about Realtime [here](/studio/audio/speech_to_text/realtime_transcription).

<ExplorerTabs id="audio-transcription-3">
  <ExplorerTab value="passing-an-audio-file" label="Passing an Audio File">
    Among the different methods to pass the audio, you can directly provide a path to a local file to upload and transcribe it as follows:

<ExplorerTabs id="codestral">
    <ExplorerTab value="Basic" label="Basic">
        <Tabs groupId="code">
    <TabItem value="python" label="python">
        <Tabs groupId="sdk-version">
            <TabItem value="v1" label="V1">

```python
import os
from mistralai import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"

client = Mistral(api_key=api_key)

with open("/path/to/file/audio.mp3", "rb") as f:
    transcription_response = client.audio.transcriptions.complete(
        model=model,
        file={
            "content": f,
            "file_name": "audio.mp3",
        },
        ## language="en"
    )
```

            </TabItem>
            <TabItem value="v2" label="V2" default>

```python
import os
from mistralai.client import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"

client = Mistral(api_key=api_key)

with open("/path/to/file/audio.mp3", "rb") as f:
    transcription_response = client.audio.transcriptions.complete(
        model=model,
        file={
            "content": f,
            "file_name": "audio.mp3",
        },
        ## language="en"
    )
```

            </TabItem>
        </Tabs>
    </TabItem>
    <TabItem value="typescript" label="typescript">

```typescript

const apiKey = process.env["MISTRAL_API_KEY"];

const client = new Mistral({ apiKey: apiKey });

const audio_file = fs.readFileSync('/path/to/file/audio.mp3');
const transcriptionResponse = await client.audio.transcriptions.complete({
  model: "voxtral-mini-latest",
  file: {
    fileName: "audio.mp3",
    content: audio_file,
  },
  // language: "en"
});
```

    </TabItem>
    <TabItem value="curl" label="curl" default>

```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
  --header "x-api-key: $MISTRAL_API_KEY" \
  --form 'file=@"/path/to/file/audio.mp3"' \
  --form 'model="voxtral-mini-latest"'
```

**With Language defined**  
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
  --header "x-api-key: $MISTRAL_API_KEY" \
  --form 'file=@"/path/to/file/audio.mp3"' \
  --form 'model="voxtral-mini-latest"' \
  --form 'language="en"' \
```
  </TabItem>
  <TabItem value="output" label="output">
```json
{
  "model":"voxtral-mini-latest",
  "text":"This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American people, in living rooms, in schools, at farms and on factory floors, at diners and on distant military outposts, All these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better President, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers. And I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees. to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy. to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title – citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise. And I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you. And God bless the United States of America.",
  "language":"en",
  "segments":[],
  "usage":{
    "prompt_audio_seconds":203,
    "prompt_tokens":4,
    "total_tokens":3264,
    "completion_tokens":635
  }
}
```

    </TabItem>
</Tabs>
    </ExplorerTab>
    <ExplorerTab value="Diarization" label="Diarization">
        <Tabs groupId="code">
    <TabItem value="python" label="python">
        <Tabs groupId="sdk-version">
            <TabItem value="v1" label="V1">

```python
# Not available in the V1 SDK (mistralai 1.x).
# This feature requires the V2 SDK: pip install "mistralai>=2", then use the V2 tab.
# Migration guide: https://docs.mistral.ai/resources/migration-guides
```

            </TabItem>
            <TabItem value="v2" label="V2" default>

```python
import os
from mistralai.client import Mistral
from mistralai.client.models import File
def main():
    api_key = os.environ["MISTRAL_API_KEY"]
    model = "voxtral-mini-latest"

    client = Mistral(api_key=api_key)
    with open("/path/to/file/audio.mp3", "rb") as f:
        response = client.audio.transcriptions.complete(
            model=model,
            file=File(content=f, file_name=f.name),
            diarize=True,
            timestamp_granularities=["segment"],
        )
        for segment in response.segments:
            speaker = segment.speaker_id or "unknown"
            print(
                f"[{segment.start:.1f}s → {segment.end:.1f}s] {speaker}: {segment.text.strip()}"
            )
main()
```

            </TabItem>
        </Tabs>
    </TabItem>
    <TabItem value="typescript" label="typescript">

```typescript

async function main() {
    const apiKey = process.env["MISTRAL_API_KEY"];
    const model = "voxtral-mini-latest";

    const client = new Mistral({ apiKey: apiKey });
    const audioFile = fs.readFileSync("/path/to/file/audio.mp3");

    const response = await client.audio.transcriptions.complete({
        model: model,
        file: {
            fileName: "audio_file_name.mp3",
            content: audioFile,
        },
        diarize: true,
        timestampGranularities: ["segment"],
    });

    for (const segment of response.segments) {
        const speaker = segment.speaker_id || "unknown";
        console.log(
            `[${segment.start.toFixed(1)}s → ${segment.end.toFixed(1)}s] ${speaker}: ${segment.text.trim()}`
        );
    }
}

main().catch(console.error);
```

    </TabItem>
    <TabItem value="curl" label="curl">
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
  --header "x-api-key: $MISTRAL_API_KEY" \
  --form 'file=@"/path/to/file/audio.mp3"' \
  --form 'model="voxtral-mini-latest"' \
  --form 'diarize=true' \
  --form 'timestamp_granularities="segment"'
```

**With Language defined**  
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
  --header "x-api-key: $MISTRAL_API_KEY" \
  --form 'file=@"/path/to/file/audio.mp3"' \
  --form 'model="voxtral-mini-latest"' \
  --form 'language="en"' \
  --form 'diarize=true' \
  --form 'timestamp_granularities="segment"'
```
    </TabItem>
  <TabItem value="output" label="output">
```json
{
    "model":"voxtral-mini-latest", 
    "text":" This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, My conversations with you, the American people, in living rooms, in schools, at farms, and on factory floors, at diners, and on distant military outposts, all these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better president, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers, and I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees, to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy, to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title, citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise, and I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you, and God bless the United States of America.",
    "language":null,
    "segments":
        [
            {
                "text":" This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me.","start":0.8,"end":8.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" It was an opportunity to say thank you.","start":8.9,"end":10.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Whether we've seen eye to eye or rarely agreed at all,","start":11.7,"end":14.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" My conversations with you, the American people, in living rooms, in schools, at farms, and on factory floors, at diners, and on distant military outposts,","start":15.4,"end":26.2,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" all these conversations are what have kept me honest, kept me inspired, and kept me going.","start":26.9,"end":32.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Every day, I learned from you.","start":33.2,"end":35.0,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" You made me a better president, and you made me a better man.","start":35.8,"end":39.0,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people.","start":39.7,"end":45.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes.","start":46.4,"end":51.5,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've hugged cancer survivors who finally know the security of affordable health care.","start":52.3,"end":56.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit.","start":57.5,"end":65.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen the hopeful faces of young graduates and our newest military officers.","start":67.0,"end":71.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've mourned with grieving families searching for answers, and I found grace in a Charleston church.","start":72.0,"end":77.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again.","start":78.9,"end":85.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks.","start":86.3,"end":92.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine.","start":93.0,"end":99.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen the youngest of children remind us of our obligations to care for our refugees, to work in peace, and above all, to look out for each other.","start":100.5,"end":111.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government.","start":111.8,"end":119.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" But we can't take our democracy for granted.","start":120.6,"end":122.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" All of us, regardless of party, should throw ourselves into the work of citizenship.","start":123.7,"end":128.8,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Not just when there is an election.","start":129.6,"end":130.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Not just when our own narrow interest is at stake.","start":131.7,"end":134.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" But over the full span of a lifetime.","start":135.2,"end":137.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" If you're tired of arguing with strangers on the Internet, try to talk with one in real life.","start":138.6,"end":143.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" If something needs fixing, lace up your shoes and do some organizing.","start":144.5,"end":148.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself.","start":149.4,"end":155.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Our success depends on our participation, regardless of which way the pendulum of power swings.","start":157.0,"end":164.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" It falls on each of us to be guardians of our democracy, to embrace the joyous task we've been given to continually try to improve this great nation of ours.","start":165.5,"end":174.8,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Because for all our outward differences, we all share the same proud title, citizen.","start":175.7,"end":181.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" It has been the honor of my life to serve you as President.","start":183.3,"end":186.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Eight years later, I am even more optimistic about our country's promise, and I look forward to working along your side as a citizen for all my days that remain.","start":187.1,"end":197.5,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Thanks, everybody.","start":198.7,"end":199.8,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" God bless you, and God bless the United States of America.","start":200.1,"end":203.5,"speaker_id":"speaker_1","type":"transcription_segment"
            }
        ],
        "usage":
            {
                "prompt_audio_seconds":203,
                "prompt_tokens":7,
                "total_tokens":938,
                "completion_tokens":931,
                "request_count":1,
                "num_cached_tokens":0
            },
        "type":"transcription.done"
}
```
    </TabItem>
</Tabs>
    </ExplorerTab>
</ExplorerTabs>
  </ExplorerTab>
  <ExplorerTab value="passing-an-audio-url" label="Passing an Audio URL">
    Similarly, you can provide an url of an audio file.

<ExplorerTabs id="codestral">
    <ExplorerTab value="Basic" label="Basic">
        <Tabs groupId="code">
    <TabItem value="python" label="python">
        <Tabs groupId="sdk-version">
            <TabItem value="v1" label="V1">

```python
import os
from mistralai import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"

client = Mistral(api_key=api_key)

transcription_response = client.audio.transcriptions.complete(
    model=model,
    file_url="https://docs.mistral.ai/audio/obama.mp3",
    ## language="en"
)
```

            </TabItem>
            <TabItem value="v2" label="V2" default>

```python
import os
from mistralai.client import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"

client = Mistral(api_key=api_key)

transcription_response = client.audio.transcriptions.complete(
    model=model,
    file_url="https://docs.mistral.ai/audio/obama.mp3",
    ## language="en"
)
```

            </TabItem>
        </Tabs>
    </TabItem>
    <TabItem value="typescript" label="typescript">

```typescript

const apiKey = process.env["MISTRAL_API_KEY"];

const client = new Mistral({ apiKey: apiKey });

const transcriptionResponse = await client.audio.transcriptions.complete({
  model: "voxtral-mini-latest",
  fileUrl: "https://docs.mistral.ai/audio/obama.mp3",
  // language: "en"
});
```

    </TabItem>
    <TabItem value="curl" label="curl" default>

```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
  --header "x-api-key: $MISTRAL_API_KEY" \
  --form 'file_url="https://docs.mistral.ai/audio/obama.mp3"' \
  --form 'model="voxtral-mini-latest"'
```

**With Language defined**  
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
  --header "x-api-key: $MISTRAL_API_KEY" \
  --form 'file_url="https://docs.mistral.ai/audio/obama.mp3"' \
  --form 'model="voxtral-mini-latest"' \
  --form 'language="en"' \
```

    </TabItem>
    <TabItem value="output" label="output">

```json
{
  "model":"voxtral-mini-latest",
  "text":"This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American people, in living rooms, in schools, at farms and on factory floors, at diners and on distant military outposts, All these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better President, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers. And I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees. to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy. to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title – citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise. And I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you. And God bless the United States of America.",
  "language":"en",
  "segments":[],
  "usage":{
    "prompt_audio_seconds":203,
    "prompt_tokens":4,
    "total_tokens":3264,
    "completion_tokens":635
  }
}
```

    </TabItem>
</Tabs>
    </ExplorerTab>
    <ExplorerTab value="Diarization" label="Diarization">
        <Tabs groupId="code">
    <TabItem value="python" label="python">
        <Tabs groupId="sdk-version">
            <TabItem value="v1" label="V1">

```python
# Not available in the V1 SDK (mistralai 1.x).
# This feature requires the V2 SDK: pip install "mistralai>=2", then use the V2 tab.
# Migration guide: https://docs.mistral.ai/resources/migration-guides
```

            </TabItem>
            <TabItem value="v2" label="V2" default>

```python
import os
from mistralai.client import Mistral
from mistralai.client.models import File
def main():
    api_key = os.environ["MISTRAL_API_KEY"]
    model = "voxtral-mini-latest"

    client = Mistral(api_key=api_key)
    with open("/path/to/file/audio.mp3", "rb") as f:
        response = client.audio.transcriptions.complete(
            model=model,
            file_url="https://docs.mistral.ai/audio/obama.mp3",
            diarize=True,
            timestamp_granularities=["segment"],
        )
        for segment in response.segments:
            speaker = segment.speaker_id or "unknown"
            print(
                f"[{segment.start:.1f}s → {segment.end:.1f}s] {speaker}: {segment.text.strip()}"
            )
main()
```

            </TabItem>
        </Tabs>
    </TabItem>
    <TabItem value="typescript" label="typescript">

```typescript

async function main() {
    const apiKey = process.env["MISTRAL_API_KEY"];
    const model = "voxtral-mini-latest";

    const client = new Mistral({ apiKey: apiKey });
    const audioFile = fs.readFileSync("/path/to/file/audio.mp3");

    const response = await client.audio.transcriptions.complete({
        model: model,
        fileUrl: "https://docs.mistral.ai/audio/obama.mp3",
        diarize: true,
        timestampGranularities: ["segment"],
    });

    for (const segment of response.segments) {
        const speaker = segment.speaker_id || "unknown";
        console.log(
            `[${segment.start.toFixed(1)}s → ${segment.end.toFixed(1)}s] ${speaker}: ${segment.text.trim()}`
        );
    }
}

main().catch(console.error);
```

    </TabItem>
    <TabItem value="curl" label="curl">
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
  --header "x-api-key: $MISTRAL_API_KEY" \
  --form 'file_url="https://docs.mistral.ai/audio/obama.mp3"' \
  --form 'model="voxtral-mini-latest"' \
  --form 'diarize=true' \
  --form 'timestamp_granularities="segment"'
```

**With Language defined**  
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
  --header "x-api-key: $MISTRAL_API_KEY" \
  --form 'file_url="https://docs.mistral.ai/audio/obama.mp3"' \
  --form 'model="voxtral-mini-latest"' \
  --form 'language="en"' \
  --form 'diarize=true' \
  --form 'timestamp_granularities="segment"'
```
    </TabItem>
    <TabItem value="output" label="output">

```json
{
    "model":"voxtral-mini-latest", 
    "text":" This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, My conversations with you, the American people, in living rooms, in schools, at farms, and on factory floors, at diners, and on distant military outposts, all these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better president, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers, and I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees, to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy, to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title, citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise, and I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you, and God bless the United States of America.",
    "language":null,
    "segments":
        [
            {
                "text":" This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me.","start":0.8,"end":8.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" It was an opportunity to say thank you.","start":8.9,"end":10.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Whether we've seen eye to eye or rarely agreed at all,","start":11.7,"end":14.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" My conversations with you, the American people, in living rooms, in schools, at farms, and on factory floors, at diners, and on distant military outposts,","start":15.4,"end":26.2,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" all these conversations are what have kept me honest, kept me inspired, and kept me going.","start":26.9,"end":32.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Every day, I learned from you.","start":33.2,"end":35.0,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" You made me a better president, and you made me a better man.","start":35.8,"end":39.0,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people.","start":39.7,"end":45.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes.","start":46.4,"end":51.5,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've hugged cancer survivors who finally know the security of affordable health care.","start":52.3,"end":56.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit.","start":57.5,"end":65.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen the hopeful faces of young graduates and our newest military officers.","start":67.0,"end":71.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've mourned with grieving families searching for answers, and I found grace in a Charleston church.","start":72.0,"end":77.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again.","start":78.9,"end":85.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks.","start":86.3,"end":92.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine.","start":93.0,"end":99.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen the youngest of children remind us of our obligations to care for our refugees, to work in peace, and above all, to look out for each other.","start":100.5,"end":111.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government.","start":111.8,"end":119.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" But we can't take our democracy for granted.","start":120.6,"end":122.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" All of us, regardless of party, should throw ourselves into the work of citizenship.","start":123.7,"end":128.8,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Not just when there is an election.","start":129.6,"end":130.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Not just when our own narrow interest is at stake.","start":131.7,"end":134.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" But over the full span of a lifetime.","start":135.2,"end":137.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" If you're tired of arguing with strangers on the Internet, try to talk with one in real life.","start":138.6,"end":143.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" If something needs fixing, lace up your shoes and do some organizing.","start":144.5,"end":148.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself.","start":149.4,"end":155.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Our success depends on our participation, regardless of which way the pendulum of power swings.","start":157.0,"end":164.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" It falls on each of us to be guardians of our democracy, to embrace the joyous task we've been given to continually try to improve this great nation of ours.","start":165.5,"end":174.8,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Because for all our outward differences, we all share the same proud title, citizen.","start":175.7,"end":181.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" It has been the honor of my life to serve you as President.","start":183.3,"end":186.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Eight years later, I am even more optimistic about our country's promise, and I look forward to working along your side as a citizen for all my days that remain.","start":187.1,"end":197.5,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Thanks, everybody.","start":198.7,"end":199.8,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" God bless you, and God bless the United States of America.","start":200.1,"end":203.5,"speaker_id":"speaker_1","type":"transcription_segment"
            }
        ],
        "usage":
            {
                "prompt_audio_seconds":203,
                "prompt_tokens":7,
                "total_tokens":938,
                "completion_tokens":931,
                "request_count":1,
                "num_cached_tokens":0
            },
        "type":"transcription.done"
}
```

    </TabItem>
</Tabs>
    </ExplorerTab>
</ExplorerTabs>
  </ExplorerTab>
  <ExplorerTab value="passing-an-uploaded-audio-file" label="Passing an Uploaded Audio File">
    Alternatively, you can first upload the file to our cloud service and then pass the signed URL instead.

<ExplorerTabs id="codestral">
    <ExplorerTab value="Basic" label="Basic">
        <Tabs groupId="code">
    <TabItem value="python" label="python">
        <Tabs groupId="sdk-version">
            <TabItem value="v1" label="V1">

```python
import os
from mistralai import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"

client = Mistral(api_key=api_key)

# If local audio, upload and retrieve the signed url
with open("local_audio.mp3", "rb") as f:
    uploaded_audio = client.files.upload(
        file={
            "content": f,
            "file_name": "local_audio.mp3",
            },
        purpose="audio"
    )
signed_url = client.files.get_signed_url(file_id=uploaded_audio.id)

transcription_response = client.audio.transcriptions.complete(
    model=model,
    file_url=signed_url.url,
    ## language="en"
)
```

            </TabItem>
            <TabItem value="v2" label="V2" default>

```python
import os
from mistralai.client import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"

client = Mistral(api_key=api_key)

# If local audio, upload and retrieve the signed url
with open("local_audio.mp3", "rb") as f:
    uploaded_audio = client.files.upload(
        file={
            "content": f,
            "file_name": "local_audio.mp3",
            },
        purpose="audio"
    )
signed_url = client.files.get_signed_url(file_id=uploaded_audio.id)

transcription_response = client.audio.transcriptions.complete(
    model=model,
    file_url=signed_url.url,
    ## language="en"
)
```

            </TabItem>
        </Tabs>
    </TabItem>
    <TabItem value="typescript" label="typescript">

```typescript

const apiKey = process.env["MISTRAL_API_KEY"];

const client = new Mistral({ apiKey: apiKey });

// If local document, upload and retrieve the signed url
const uploaded_pdf = await client.files.upload({
    file: {
        fileName: "local_audio.mp3",
        content: fs.readFileSync("local_audio.mp3"),
        },
    purpose: "audio",
});
const signedUrl = await client.files.getSignedUrl({
    fileId: uploaded_pdf.id,
});

// Get the transcription
const transcriptionResponse = await client.audio.transcriptions.complete({
    model: "voxtral-mini-latest",
    fileUrl: signedUrl.url,
    // language: "en"
});
```

    </TabItem>
    <TabItem value="curl" label="curl" default>

**Upload the Audio File**
```bash
curl --location https://api.mistral.ai/v1/files \
  --header "Authorization: Bearer $MISTRAL_API_KEY" \
  --form purpose="audio" \
  --form file="@local_audio.mp3"
```

**Get the Signed URL**
```bash
curl --location "https://api.mistral.ai/v1/files/$id/url?expiry=24" \
    --header "Accept: application/json" \
    --header "Authorization: Bearer $MISTRAL_API_KEY"
```

**Send Transcription Request**
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
    --header "x-api-key: $MISTRAL_API_KEY" \
    --form 'file_url="<signed_url>"' \
    --form 'model="voxtral-mini-latest"'
```

**Send Transcription Request with Language defined**
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
    --header "x-api-key: $MISTRAL_API_KEY" \
    --form 'file_url="<signed_url>"' \
    --form 'model="voxtral-mini-latest"' \
    --form 'language="en"' \
```

    </TabItem>
    <TabItem value="output" label="output">

```json
{
  "model":"voxtral-mini-latest",
  "text":"This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American people, in living rooms, in schools, at farms and on factory floors, at diners and on distant military outposts, All these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better President, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers. And I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees. to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy. to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title – citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise. And I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you. And God bless the United States of America.",
  "language":"en",
  "segments":[],
  "usage":{
    "prompt_audio_seconds":203,
    "prompt_tokens":4,
    "total_tokens":3264,
    "completion_tokens":635
  }
}
```

    </TabItem>
</Tabs>
    </ExplorerTab>
    <ExplorerTab value="Diarization" label="Diarization">
        <Tabs groupId="code">
    <TabItem value="python" label="python">
        <Tabs groupId="sdk-version">
            <TabItem value="v1" label="V1">

```python
# Not available in the V1 SDK (mistralai 1.x).
# This feature requires the V2 SDK: pip install "mistralai>=2", then use the V2 tab.
# Migration guide: https://docs.mistral.ai/resources/migration-guides
```

            </TabItem>
            <TabItem value="v2" label="V2" default>

```python
import os
from mistralai.client import Mistral
def main():
    api_key = os.environ["MISTRAL_API_KEY"]
    model = "voxtral-mini-latest"
    client = Mistral(api_key=api_key)

    # Upload local audio file and get signed URL
    with open("local_audio.mp3", "rb") as f:
        uploaded_audio = client.files.upload(
            file={
                "content": f,
                "file_name": "local_audio.mp3",
            },
            purpose="audio"
        )
        signed_url = client.files.get_signed_url(file_id=uploaded_audio.id)

        # Perform transcription with diarization
        response = client.audio.transcriptions.complete(
            model=model,
            file_url=signed_url.url,
            diarize=True,
            timestamp_granularities=["segment"],
        )

        # Print results with speaker diarization
        for segment in response.segments:
            speaker = segment.speaker_id or "unknown"
            print(
                f"[{segment.start:.1f}s → {segment.end:.1f}s] {speaker}: {segment.text.strip()}"
            )

if __name__ == "__main__":
    main()
```

            </TabItem>
        </Tabs>
    </TabItem>
    <TabItem value="typescript" label="typescript">

```typescript

async function main() {
    const apiKey = process.env["MISTRAL_API_KEY"];
    if (!apiKey) {
        throw new Error("MISTRAL_API_KEY is not set in environment variables");
    }

    const model = "voxtral-mini-latest";
    const client = new Mistral({ apiKey: apiKey });

    try {
        // Upload local audio file and get signed URL
        const uploadedAudio = await client.files.upload({
            file: {
                fileName: "local_audio.mp3",
                content: fs.readFileSync("local_audio.mp3"),
            },
            purpose: "audio",
        });

        const signedUrl = await client.files.getSignedUrl({
            fileId: uploadedAudio.id,
        });

        // Perform transcription with diarization
        const response = await client.audio.transcriptions.complete({
            model: model,
            fileUrl: signedUrl.url,
            diarize: true,
            timestampGranularities: ["segment"],
        });

        // Print results with speaker diarization
        for (const segment of response.segments) {
            const speaker = segment.speaker_id || "unknown";
            console.log(
                `[${segment.start.toFixed(1)}s → ${segment.end.toFixed(1)}s] ${speaker}: ${segment.text.trim()}`
            );
        }
    } catch (error) {
        console.error("Error during transcription:", error);
        throw error;
    }
}

main().catch(console.error);
```

    </TabItem>
    <TabItem value="curl" label="curl" default>

**Upload the Audio File**
```bash
curl --location https://api.mistral.ai/v1/files \
  --header "Authorization: Bearer $MISTRAL_API_KEY" \
  --form purpose="audio" \
  --form file="@local_audio.mp3"
```

**Get the Signed URL**
```bash
curl --location "https://api.mistral.ai/v1/files/$id/url?expiry=24" \
    --header "Accept: application/json" \
    --header "Authorization: Bearer $MISTRAL_API_KEY"
```

**Send Transcription Request**
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
    --header "x-api-key: $MISTRAL_API_KEY" \
    --form 'file_url="<signed_url>"' \
    --form 'model="voxtral-mini-latest"' \
    --form 'diarize=true' \
    --form 'timestamp_granularities="segment"'
```

**Send Transcription Request with Language defined**
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
    --header "x-api-key: $MISTRAL_API_KEY" \
    --form 'file_url="<signed_url>"' \
    --form 'model="voxtral-mini-latest"' \
    --form 'language="en"' \
    --form 'diarize=true' \
    --form 'timestamp_granularities="segment"'
```

    </TabItem>
    <TabItem value="output" label="output">

```json
{
    "model":"voxtral-mini-latest", 
    "text":" This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, My conversations with you, the American people, in living rooms, in schools, at farms, and on factory floors, at diners, and on distant military outposts, all these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better president, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers, and I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees, to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy, to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title, citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise, and I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you, and God bless the United States of America.",
    "language":null,
    "segments":
        [
            {
                "text":" This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me.","start":0.8,"end":8.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" It was an opportunity to say thank you.","start":8.9,"end":10.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Whether we've seen eye to eye or rarely agreed at all,","start":11.7,"end":14.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" My conversations with you, the American people, in living rooms, in schools, at farms, and on factory floors, at diners, and on distant military outposts,","start":15.4,"end":26.2,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" all these conversations are what have kept me honest, kept me inspired, and kept me going.","start":26.9,"end":32.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Every day, I learned from you.","start":33.2,"end":35.0,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" You made me a better president, and you made me a better man.","start":35.8,"end":39.0,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people.","start":39.7,"end":45.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes.","start":46.4,"end":51.5,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've hugged cancer survivors who finally know the security of affordable health care.","start":52.3,"end":56.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit.","start":57.5,"end":65.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen the hopeful faces of young graduates and our newest military officers.","start":67.0,"end":71.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've mourned with grieving families searching for answers, and I found grace in a Charleston church.","start":72.0,"end":77.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again.","start":78.9,"end":85.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks.","start":86.3,"end":92.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine.","start":93.0,"end":99.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" I've seen the youngest of children remind us of our obligations to care for our refugees, to work in peace, and above all, to look out for each other.","start":100.5,"end":111.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government.","start":111.8,"end":119.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" But we can't take our democracy for granted.","start":120.6,"end":122.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" All of us, regardless of party, should throw ourselves into the work of citizenship.","start":123.7,"end":128.8,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Not just when there is an election.","start":129.6,"end":130.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Not just when our own narrow interest is at stake.","start":131.7,"end":134.4,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" But over the full span of a lifetime.","start":135.2,"end":137.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" If you're tired of arguing with strangers on the Internet, try to talk with one in real life.","start":138.6,"end":143.7,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" If something needs fixing, lace up your shoes and do some organizing.","start":144.5,"end":148.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself.","start":149.4,"end":155.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Our success depends on our participation, regardless of which way the pendulum of power swings.","start":157.0,"end":164.6,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" It falls on each of us to be guardians of our democracy, to embrace the joyous task we've been given to continually try to improve this great nation of ours.","start":165.5,"end":174.8,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Because for all our outward differences, we all share the same proud title, citizen.","start":175.7,"end":181.9,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" It has been the honor of my life to serve you as President.","start":183.3,"end":186.1,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Eight years later, I am even more optimistic about our country's promise, and I look forward to working along your side as a citizen for all my days that remain.","start":187.1,"end":197.5,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" Thanks, everybody.","start":198.7,"end":199.8,"speaker_id":"speaker_1","type":"transcription_segment"},{"text":" God bless you, and God bless the United States of America.","start":200.1,"end":203.5,"speaker_id":"speaker_1","type":"transcription_segment"
            }
        ],
        "usage":
            {
                "prompt_audio_seconds":203,
                "prompt_tokens":7,
                "total_tokens":938,
                "completion_tokens":931,
                "request_count":1,
                "num_cached_tokens":0
            },
        "type":"transcription.done"
}
```
    </TabItem>
</Tabs>
    </ExplorerTab>
</ExplorerTabs>
  </ExplorerTab>
</ExplorerTabs>

<SectionTab as="h2" variant="secondary" sectionId="example-samples-2">Example Samples</SectionTab>

Below you can find a few examples using the audio transcription endpoint.

<ExplorerTabs id="audio-transcription-4" mode="close">
  <ExplorerTab value="obama" label="Obama">
    **Audio**
<audio controls>
    <source src="/audio/obama.mp3" type="audio/mp3"/>
    Your browser does not support the audio element.
</audio>

**Transcription**

This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American people, in living rooms, in schools, at farms and on factory floors, at diners and on distant military outposts, All these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better President, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers. And I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees. to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy. to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title – citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise. And I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you. And God bless the United States of America.  

**Language**

English
  </ExplorerTab>
</ExplorerTabs>

<SectionTab as="h2" variant="secondary" sectionId="transcription-with-timestamps">Transcription with Timestamps</SectionTab>

You can request timestamps for the transcription by passing the `timestamp_granularities` parameter, currently supporting `segment` and `word`.  
It will return the start and end time of each segment in the audio file.

:::note
`timestamp_granularities` is currently not compatible with `language`, please use either one or the other.
:::

<Tabs groupId="code">
  <TabItem value="python" label="python">
    <Tabs groupId="sdk-version">
        <TabItem value="v1" label="V1">

```python
import os
from mistralai import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"

client = Mistral(api_key=api_key)

transcription_response = client.audio.transcriptions.complete(
    model=model,
    file_url="https://docs.mistral.ai/audio/obama.mp3",
    timestamp_granularities=["segment"] # or "word"
)
```

        </TabItem>
        <TabItem value="v2" label="V2" default>

```python
import os
from mistralai.client import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"

client = Mistral(api_key=api_key)

transcription_response = client.audio.transcriptions.complete(
    model=model,
    file_url="https://docs.mistral.ai/audio/obama.mp3",
    timestamp_granularities=["segment"] # or "word"
)
```

        </TabItem>
    </Tabs>
  </TabItem>
  <TabItem value="typescript" label="typescript">

```typescript

const apiKey = process.env["MISTRAL_API_KEY"];

const client = new Mistral({ apiKey: apiKey });

const transcriptionResponse = await client.audio.transcriptions.complete({
  model: "voxtral-mini-latest",
  fileUrl: "https://docs.mistral.ai/audio/obama.mp3",
  timestampGranularities: ["segment"] // or "word"
});
```

  </TabItem>
  <TabItem value="curl" label="curl" default>
With `segment`:
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
--header "x-api-key: $MISTRAL_API_KEY" \
--form 'file_url="https://docs.mistral.ai/audio/obama.mp3"' \
--form 'model="voxtral-mini-latest"' \
--form 'timestamp_granularities="segment"'
```
With `word`:
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
--header "x-api-key: $MISTRAL_API_KEY" \
--form 'file_url="https://docs.mistral.ai/audio/obama.mp3"' \
--form 'model="voxtral-mini-latest"' \
--form 'timestamp_granularities="word"'
```

  </TabItem>
  <TabItem value="output" label="output">
```json
{
  "model": "voxtral-mini-latest",
  "text": "This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American people, in living rooms, in schools, at farms and on factory floors, at diners and on distant military outposts. All these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better President, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers. And I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees. to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there's an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy. to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title, citizen. It has been the honor of my life to serve you as president. Eight years later, I am even more optimistic about our country's promise, and I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you, and God bless the United States of America.",
  "language": null,
  "segments": [
    {
      "text": "This week, I traveled to Chicago to deliver my final farewell address to the nation, following",
      "start": 0.8,
      "end": 6.2,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "in the tradition of presidents before me.",
      "start": 6.2,
      "end": 9.0,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "It was an opportunity to say thank you.",
      "start": 9.0,
      "end": 11.8,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American",
      "start": 11.8,
      "end": 17.6,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "people, in living rooms, in schools, at farms and on factory floors, at diners and on distant",
      "start": 17.6,
      "end": 24.9,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "military outposts.",
      "start": 24.9,
      "end": 26.6,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "All these conversations are what have kept me honest, kept me inspired, and kept me going.",
      "start": 26.6,
      "end": 32.8,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Every day, I learned from you.",
      "start": 32.8,
      "end": 35.4,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "You made me a better President, and you made me a better man.",
      "start": 35.4,
      "end": 39.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people.",
      "start": 39.3,
      "end": 46.1,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes.",
      "start": 46.1,
      "end": 51.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've hugged cancer survivors who finally know the security of affordable health care.",
      "start": 52.2,
      "end": 56.5,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit.",
      "start": 57.1,
      "end": 65.7,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen the hopeful faces of young graduates and our newest military officers.",
      "start": 66.5,
      "end": 71.1,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've mourned with grieving families searching for answers.",
      "start": 71.7,
      "end": 74.4,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "And I found grace in a Charleston church.",
      "start": 75.2,
      "end": 77.7,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen our scientists help a paralyzed man regain his sense of touch and our wounded warriors walk again.",
      "start": 78.5,
      "end": 85.2,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks.",
      "start": 85.9,
      "end": 91.9,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've learned from students who are building robots and curing diseases and who will change the world in ways we can't even imagine.",
      "start": 92.6,
      "end": 99.2,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen the youngest of children remind us of our obligations to care for our refugees.",
      "start": 100.1,
      "end": 105.8,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "to work in peace, and above all, to look out for each other.",
      "start": 106.6,
      "end": 111.6,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government.",
      "start": 111.6,
      "end": 120.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "But we can't take our democracy for granted.",
      "start": 120.3,
      "end": 123.4,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "All of us, regardless of party, should throw ourselves into the work of citizenship.",
      "start": 123.4,
      "end": 129.2,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Not just when there's an election.",
      "start": 129.2,
      "end": 131.2,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Not just when our own narrow interest is at stake.",
      "start": 131.2,
      "end": 134.7,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "But over the full span of a lifetime.",
      "start": 134.7,
      "end": 138.1,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "If you're tired of arguing with strangers on the Internet,",
      "start": 138.1,
      "end": 141.4,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "try to talk with one in real life.",
      "start": 141.4,
      "end": 144.0,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "If something needs fixing,",
      "start": 144.0,
      "end": 146.0,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "lace up your shoes and do some organizing.",
      "start": 146.0,
      "end": 149.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself.",
      "start": 149.3,
      "end": 156.8,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Our success depends on our participation, regardless of which way the pendulum of power swings.",
      "start": 156.8,
      "end": 165.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "It falls on each of us to be guardians of our democracy.",
      "start": 165.3,
      "end": 168.5,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "to embrace the joyous task we've been given to continually try to improve this great nation of ours.",
      "start": 168.5,
      "end": 174.6,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Because for all our outward differences, we all share the same proud title, citizen.",
      "start": 175.4,
      "end": 181.7,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "It has been the honor of my life to serve you as president.",
      "start": 182.7,
      "end": 186.0,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Eight years later, I am even more optimistic about our country's promise,",
      "start": 186.9,
      "end": 190.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "and I look forward to working along your side as a citizen for all my days that remain.",
      "start": 190.3,
      "end": 197.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Thanks, everybody. God bless you, and God bless the United States of America.",
      "start": 198.5,
      "end": 203.4,
      "speaker_id": null,
      "type": "transcription_segment"
    }
  ],
  "usage": {
    "prompt_audio_seconds": 203,
    "prompt_tokens": 4,
    "total_tokens": 3945,
    "completion_tokens": 1316
  }
}
```
  </TabItem>
</Tabs>

<SectionTab as="h2" variant="secondary" sectionId="context-biasing">Context biasing</SectionTab>

Provide up to 100 words or phrases to guide the model toward correct spellings of names, technical terms, or domain-specific vocabulary. Particularly useful for proper nouns or industry terminology that standard models often miss. Context biasing is optimized for English; support for other languages is experimental.

<Tabs groupId="code">
    <TabItem value="python" label="python">
        <Tabs groupId="sdk-version">
            <TabItem value="v1" label="V1">

```python
# Not available in the V1 SDK (mistralai 1.x).
# This feature requires the V2 SDK: pip install "mistralai>=2", then use the V2 tab.
# Migration guide: https://docs.mistral.ai/resources/migration-guides
```

            </TabItem>
            <TabItem value="v2" label="V2" default>

```python
import os
from mistralai.client import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"

client = Mistral(api_key=api_key)

transcription_response = client.audio.transcriptions.complete(
    model=model,
    file_url="https://docs.mistral.ai/audio/obama.mp3",
    context_bias=[
        "Chicago",
        "Joplin",
        "Boston",
        "Charleston",
        "farewell_address",
        "self-government",
        "citizenship",
        "democracy",
        "American_people",
        "cancer_survivors",
        "affordable_health_care",
        "wounded_warriors",
        "refugees",
        "elected_officials",
        "American_spirit",
        "work_of_citizenship",
        "guardians_of_our_democracy",
    ]
)
```

            </TabItem>
        </Tabs>
    </TabItem>
    <TabItem value="typescript" label="typescript">

```typescript

const apiKey = process.env["MISTRAL_API_KEY"];

const client = new Mistral({ apiKey: apiKey });

const transcriptionResponse = await client.audio.transcriptions.complete({
  model: "voxtral-mini-latest",
  fileUrl: "https://docs.mistral.ai/audio/obama.mp3",
  contextBias: [
    "Chicago",
    "Joplin",
    "Boston",
    "Charleston",
    "farewell_address",
    "self-government",
    "citizenship",
    "democracy",
    "American_people",
    "cancer_survivors",
    "affordable_health_care",
    "wounded_warriors",
    "refugees",
    "elected_officials",
    "American_spirit",
    "work_of_citizenship",
    "guardians_of_our_democracy",
  ]
});
```

    </TabItem>
    <TabItem value="curl" label="curl" default>

```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
  --header "x-api-key: $MISTRAL_API_KEY" \
  --form 'file_url="https://docs.mistral.ai/audio/obama.mp3"' \
  --form 'model="voxtral-mini-latest"' \
  --form 'context_bias="Chicago"' \
  --form 'context_bias="Joplin"' \
  --form 'context_bias="Boston"' \
  --form 'context_bias="Charleston"' \
  --form 'context_bias="farewell_address"' \
  --form 'context_bias="self-government"' \
  --form 'context_bias="citizenship"' \
  --form 'context_bias="democracy"' \
  --form 'context_bias="American_people"' \
  --form 'context_bias="cancer_survivors"' \
  --form 'context_bias="affordable_health_care"' \
  --form 'context_bias="wounded_warriors"' \
  --form 'context_bias="refugees"' \
  --form 'context_bias="elected_officials"' \
  --form 'context_bias="American_spirit"' \
  --form 'context_bias="work_of_citizenship"' \
  --form 'context_bias="guardians_of_our_democracy"'
```

**With Language defined**  
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
  --header "x-api-key: $MISTRAL_API_KEY" \
  --form 'file_url="https://docs.mistral.ai/audio/obama.mp3"' \
  --form 'model="voxtral-mini-latest"' \
  --form 'language="en"' \
  --form 'context_bias="Chicago"' \
  --form 'context_bias="Joplin"' \
  --form 'context_bias="Boston"' \
  --form 'context_bias="Charleston"' \
  --form 'context_bias="farewell_address"' \
  --form 'context_bias="self-government"' \
  --form 'context_bias="citizenship"' \
  --form 'context_bias="democracy"' \
  --form 'context_bias="American_people"' \
  --form 'context_bias="cancer_survivors"' \
  --form 'context_bias="affordable_health_care"' \
  --form 'context_bias="wounded_warriors"' \
  --form 'context_bias="refugees"' \
  --form 'context_bias="elected_officials"' \
  --form 'context_bias="American_spirit"' \
  --form 'context_bias="work_of_citizenship"' \
  --form 'context_bias="guardians_of_our_democracy"'
```
  </TabItem>
  <TabItem value="output" label="output">
```json
{
    "model":"voxtral-mini-latest",
    "text":"This week, I traveled to Chicago to deliver my final farewell_address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, My conversations with you, the American_people, in living rooms, in schools, at farms, and on factory floors, at diners, and on distant military outposts, all these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better president, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer_survivors who finally know the security of affordable_health_care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American-spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers, and I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded_warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees, to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work_of_citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy, to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title, citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise, and I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you, and God bless the United States of America.",
    "language":null,
    "segments":[],
    "usage":
        {
            "prompt_audio_seconds":203,
            "prompt_tokens":70,
            "total_tokens":716,
            "completion_tokens":646,
            "request_count":1,
            "num_cached_tokens":0
        },
        "type":"transcription.done"
}
```
    </TabItem>
</Tabs>
<SectionTab as="h1" sectionId="openai-sdk-compatibility">
  OpenAI SDK compatibility
</SectionTab>

The Mistral transcription endpoint follows the same request structure as the OpenAI audio transcriptions API. You can use the OpenAI SDK by pointing it at the Mistral base URL and swapping the model name.

:::warning
We don't recommend using the OpenAI SDK for long-term use. This compatibility layer targets quick testing and prototyping. For production usage, we recommend using the [Mistral SDK](/resources/sdks) for full feature support.
:::

<SectionTab as="h2" variant="secondary" sectionId="compatibility-table">
  Compatibility table
</SectionTab>

| Feature                                             | OpenAI SDK compatible     |
| :-------------------------------------------------- | :------------------------ |
| Basic transcription (`file`)                        | Yes                       |
| Language specification (`language`)                 | Yes                       |
| Timestamp granularities (`timestamp_granularities`) | Yes                       |
| Streaming (`stream`)                                | Yes                       |
| Diarization (`diarize`)                             | Yes with `extra_body`     |
| Context biasing (`context_bias`)                    | Yes with `extra_body`     |
| Audio URL input (`file_url`)                        | No (not supported)        |

<SectionTab as="h2" variant="secondary" sectionId="example-samples-3">
  Examples
</SectionTab>

<Tabs groupId="code">
  <TabItem value="python" label="python" default>

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["MISTRAL_API_KEY"],
    base_url="https://api.mistral.ai/v1",
)

with open("/path/to/file/audio.mp3", "rb") as f:
    transcription = client.audio.transcriptions.create(
        model="voxtral-mini-latest",
        file=f,
        extra_body={"diarize": True, "context_bias": ["bias1", "bias2"]}
    )

print(transcription.text)
```

  </TabItem>
  <TabItem value="typescript" label="typescript">

```typescript

const client = new OpenAI({
  apiKey: process.env['MISTRAL_API_KEY'],
  baseURL: 'https://api.mistral.ai/v1',
});

const transcription = await client.audio.transcriptions.create({
  model: 'voxtral-mini-latest',
  file: fs.createReadStream('/path/to/file/audio.mp3'),
  extra_body: { diarize: true, context_bias: ['bias1', 'bias2'] },
});

console.log(transcription.text);
```

  </TabItem>
</Tabs>

:::note
The OpenAI SDK does not natively support Mistral-specific parameters (`diarize`, `context_bias`). Use the [Mistral SDK](/resources/sdks) for those features, or pass them through the `extra_body` parameter.
:::

<SectionTab as="h1" sectionId="faq">FAQ</SectionTab>

<Faq>
  <FaqItem question="What's the maximum audio length?">

    The maximum length will depend on the endpoint used, currently the limits are as follows:
    - [Chat with Audio](#chat-with-audio): ≈20 minutes for [Voxtral Mini Transcribe](/models/voxtral-mini-transcribe-25-07) and [Voxtral Small](/models/voxtral-small-25-07).
    - [Transcription](#transcription): ≈15 minutes for [Voxtral Mini Transcribe](/models/voxtral-mini-transcribe-25-07) and [Voxtral Small](/models/voxtral-small-25-07), and ≈3 hours for [Voxtral Mini Transcribe 2](/models/voxtral-mini-transcribe-26-02).

    :::tip
    Here are some tips if you need to handle longer audio files:
    - **Divide the audio into smaller segments:** Transcribe each segment individually. However, be aware that this might lead to a loss of context, difficulties in splitting the audio at natural pauses (such as mid-sentence), and the need to combine the transcriptions afterward.
    - **Increase the playback speed:** Send the file at a faster pace by speeding up the audio. Keep in mind that this can reduce audio quality and require adjusting the transcription timestamps to align with the original audio file.
    :::

  </FaqItem>
</Faq>