Tree BG 1
Tree
Tree
TreeLeaves
TreeLeaves
Cat IdleGrassGrassRockRock

Audio Speech Endpoints

API for speech generation.

Speech

POST /v1/audio/speech#

Speech

200 (application/json)

200 (text/event-stream)

Speech audio data.

audio_data#
*string

Base64 encoded audio data

Playground

Test the endpoints live

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

const mistral = new Mistral({
  apiKey: "MISTRAL_API_KEY",
});

async function run() {
  const result = await mistral.audio.speech.complete({
    input: "<value>",
  });

  console.log(result);
}

run();
from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.audio.speech.complete(input="<value>", stream=False, additional_properties={

    })

    with res as event_stream:
        for event in event_stream:
            # handle event
            print(event, flush=True)

curl https://api.mistral.ai/v1/audio/speech \
 -X POST \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE' \
 -H 'Content-Type: application/json' \
 -d '{
  "input": "Example input."
}'

200 (application/json)

200 (text/event-stream)

{
  "audio_data": "base64-encoded-audio-data"
}