List all voices (excluding sample data)
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.audio.voices.list(limit=10, offset=0, type_="all")
# Handle response
print(res)
| Parameter | Type | Required | Description |
|---|
limit | Optional[int] | :heavy_minus_sign: | Maximum number of voices to return |
offset | Optional[int] | :heavy_minus_sign: | Offset for pagination |
type | Optional[models.ListVoicesV1AudioVoicesGetType] | :heavy_minus_sign: | Filter the voices between customs and presets |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.VoiceListResponse
| Error Type | Status Code | Content Type |
|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Create a new voice with a base64-encoded audio sample
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.audio.voices.create(name="<value>", sample_audio="<value>", retention_notice=30)
# Handle response
print(res)
| Parameter | Type | Required | Description |
|---|
name | str | :heavy_check_mark: | N/A |
sample_audio | str | :heavy_check_mark: | Base64-encoded audio file |
slug | OptionalNullable[str] | :heavy_minus_sign: | N/A |
languages | List[str] | :heavy_minus_sign: | N/A |
gender | OptionalNullable[str] | :heavy_minus_sign: | N/A |
age | OptionalNullable[int] | :heavy_minus_sign: | N/A |
tags | List[str] | :heavy_minus_sign: | N/A |
color | OptionalNullable[str] | :heavy_minus_sign: | N/A |
description | OptionalNullable[str] | :heavy_minus_sign: | N/A |
retention_notice | Optional[int] | :heavy_minus_sign: | N/A |
sample_filename | OptionalNullable[str] | :heavy_minus_sign: | Original filename for extension detection |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.VoiceResponse
| Error Type | Status Code | Content Type |
|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Delete a custom voice
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.audio.voices.delete(voice_id="f42bf0d7-8a10-4b98-bbfa-589a232209d2")
# Handle response
print(res)
| Parameter | Type | Required | Description |
|---|
voice_id | str | :heavy_check_mark: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.VoiceResponse
| Error Type | Status Code | Content Type |
|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Update voice metadata (name, gender, languages, age, tags).
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.audio.voices.update(voice_id="030a6b20-e287-414d-9a77-6b76a4a56c9d")
# Handle response
print(res)
| Parameter | Type | Required | Description |
|---|
voice_id | str | :heavy_check_mark: | N/A |
name | OptionalNullable[str] | :heavy_minus_sign: | N/A |
languages | List[str] | :heavy_minus_sign: | N/A |
gender | OptionalNullable[str] | :heavy_minus_sign: | N/A |
age | OptionalNullable[int] | :heavy_minus_sign: | N/A |
tags | List[str] | :heavy_minus_sign: | N/A |
description | OptionalNullable[str] | :heavy_minus_sign: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.VoiceResponse
| Error Type | Status Code | Content Type |
|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Get voice details (excluding sample)
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.audio.voices.get(voice_id="<id>")
# Handle response
print(res)
| Parameter | Type | Required | Description |
|---|
voice_id | str | :heavy_check_mark: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.VoiceResponse
| Error Type | Status Code | Content Type |
|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Get the audio sample for a voice
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.audio.voices.get_sample_audio(voice_id="<id>")
# Handle response
print(res)
| Parameter | Type | Required | Description |
|---|
voice_id | str | :heavy_check_mark: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
httpx.Response
| Error Type | Status Code | Content Type |
|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |