---
title: Fish Audio Texte en parole | RunAPI
description: Utilisez le point de terminaison texte vers parole pour recevoir un résultat
  dans la même réponse.
url: https://runapi.ai/fr/docs/api/fish-audio/text-to-speech.md
canonical: https://runapi.ai/fr/docs/api/fish-audio/text-to-speech
locale: fr
---

> Version HTML: https://runapi.ai/fr/docs/api/fish-audio/text-to-speech
> Index du site pour les agents: https://runapi.ai/llms.txt

# Fish Audio Texte en parole

## Vue d'ensemble

Utilisez le point de terminaison texte vers parole et lisez le résultat dans la même réponse.

### Démarrage rapide

1. Créez une clé API et définissez-la comme RUNAPI_API_KEY.
2. Envoyer une requête POST dont le corps correspond au schéma de requête.
3. Lisez le résultat dans le corps de la réponse réussie.

## Point de terminaison

POST /api/v1/fish_audio/text_to_speech

URL de base: https://runapi.ai

Version de l'API: v1

Authentification: Authorization: Bearer YOUR_API_TOKEN

## Modèles pris en charge

Ouvrez une page de modèle pour consulter la tarification actuelle, les limites de débit et les conditions d'utilisation commerciale.

- [s1](https://runapi.ai/fr/models/fish-audio/s1)
- [s2-pro](https://runapi.ai/fr/models/fish-audio/s2-pro)
- [s2.1-pro](https://runapi.ai/fr/models/fish-audio/s2.1-pro)

## Schéma de requête

Envoyez uniquement les champs déclarés pour cet endpoint.

### s1

```json
{
  "bitrate_kbps": {
    "default": 128,
    "description": "Débit MP3. Non accepté pour la sortie WAV.",
    "enum": [
      64,
      128,
      192
    ],
    "type": "integer"
  },
  "model": {
    "description": "Slug du modèle.",
    "required": true,
    "type": "string"
  },
  "output_format": {
    "default": "mp3",
    "description": "Format audio de sortie.",
    "enum": [
      "mp3",
      "wav"
    ],
    "type": "string"
  },
  "references": {
    "description": "Échantillons audio de référence en ligne pour cette requête.",
    "items": {
      "properties": {
        "audio": {
          "description": "Octets audio bruts encodés en Base64.",
          "required": true,
          "type": "string"
        },
        "text": {
          "description": "Transcription exacte de l'audio de référence.",
          "required": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "type": "array"
  },
  "sample_rate_hz": {
    "default": 44100,
    "description": "Fréquence d'échantillonnage de sortie. MP3 prend en charge 32000 et 44100 Hz ; WAV prend en charge toutes les valeurs listées.",
    "enum": [
      8000,
      16000,
      24000,
      32000,
      44100
    ],
    "type": "integer"
  },
  "text": {
    "required": true,
    "type": "string"
  },
  "voice_id": {
    "type": "string"
  }
}
```

### s2-pro

```json
{
  "bitrate_kbps": {
    "default": 128,
    "description": "Débit MP3. Non accepté pour la sortie WAV.",
    "enum": [
      64,
      128,
      192
    ],
    "type": "integer"
  },
  "model": {
    "description": "Slug du modèle.",
    "required": true,
    "type": "string"
  },
  "output_format": {
    "default": "mp3",
    "description": "Format audio de sortie.",
    "enum": [
      "mp3",
      "wav"
    ],
    "type": "string"
  },
  "references": {
    "description": "Échantillons audio de référence en ligne pour cette requête.",
    "items": {
      "properties": {
        "audio": {
          "description": "Octets audio bruts encodés en Base64.",
          "required": true,
          "type": "string"
        },
        "text": {
          "description": "Transcription exacte de l'audio de référence.",
          "required": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "type": "array"
  },
  "sample_rate_hz": {
    "default": 44100,
    "description": "Fréquence d'échantillonnage de sortie. MP3 prend en charge 32000 et 44100 Hz ; WAV prend en charge toutes les valeurs listées.",
    "enum": [
      8000,
      16000,
      24000,
      32000,
      44100
    ],
    "type": "integer"
  },
  "text": {
    "required": true,
    "type": "string"
  },
  "voice_id": {
    "type": "string"
  }
}
```

### s2.1-pro

```json
{
  "bitrate_kbps": {
    "default": 128,
    "description": "Débit MP3. Non accepté pour la sortie WAV.",
    "enum": [
      64,
      128,
      192
    ],
    "type": "integer"
  },
  "model": {
    "description": "Slug du modèle.",
    "required": true,
    "type": "string"
  },
  "output_format": {
    "default": "mp3",
    "description": "Format audio de sortie.",
    "enum": [
      "mp3",
      "wav"
    ],
    "type": "string"
  },
  "references": {
    "description": "Échantillons audio de référence en ligne pour cette requête.",
    "items": {
      "properties": {
        "audio": {
          "description": "Octets audio bruts encodés en Base64.",
          "required": true,
          "type": "string"
        },
        "text": {
          "description": "Transcription exacte de l'audio de référence.",
          "required": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "type": "array"
  },
  "sample_rate_hz": {
    "default": 44100,
    "description": "Fréquence d'échantillonnage de sortie. MP3 prend en charge 32000 et 44100 Hz ; WAV prend en charge toutes les valeurs listées.",
    "enum": [
      8000,
      16000,
      24000,
      32000,
      44100
    ],
    "type": "integer"
  },
  "text": {
    "required": true,
    "type": "string"
  },
  "voice_id": {
    "type": "string"
  }
}
```

#### Règles conditionnelles

Ces exigences s'appliquent lorsque toutes les conditions listées sont réunies.

- **Lorsque**: `output_format` = `wav`; **Non accepté**: `bitrate_kbps`
- **Lorsque**: `output_format` = `mp3`
- **Lorsque**: `output_format` = `{"present" => false}`

## Réponse de succès

HTTP 200 - POST /api/v1/fish_audio/text_to_speech

### Schéma de réponse

```json
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "format": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url",
          "format",
          "mime_type",
          "size_bytes"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "audios",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemple de réponse

```json
{
  "audios": [
    {
      "format": "mp3",
      "mime_type": "audio/mpeg",
      "size_bytes": 128,
      "url": "https://file.runapi.ai/reference-audio.mp3"
    }
  ],
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "completed"
}
```

## Erreurs

HTTP 401 - POST /api/v1/fish_audio/text_to_speech

### Schéma de réponse

```json
{
  "properties": {
    "error": {
      "description": "Message d'erreur lisible par l'humain.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemple de réponse

```json
{
  "error": "Authentication required"
}
```

## Erreurs

HTTP 400 - POST /api/v1/fish_audio/text_to_speech

### Schéma de réponse

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "Message d'erreur lisible par l'humain.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "Résumé de validation lisible par l'humain.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Messages de validation indexés par champ de requête public, avec un tableau de chaînes lisibles par l'humain pour chaque champ.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### Exemple de réponse

```json
{
  "error": "model must be one of: s1, s2-pro, s2.1-pro"
}
```

## Erreurs

HTTP 402 - POST /api/v1/fish_audio/text_to_speech

### Schéma de réponse

```json
{
  "properties": {
    "error": {
      "description": "Message d'erreur lisible par l'humain.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemple de réponse

```json
{
  "error": "Insufficient balance"
}
```

## Erreurs

HTTP 429 - POST /api/v1/fish_audio/text_to_speech

### Schéma de réponse

```json
{
  "properties": {
    "error": {
      "description": "Message d'erreur lisible par l'humain.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemple de réponse

```json
{
  "error": "API key credit limit exceeded"
}
```

## Erreurs

HTTP 409 - POST /api/v1/fish_audio/text_to_speech

### Schéma de réponse

```json
{
  "properties": {
    "error": {
      "description": "Message d'erreur lisible par l'humain.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemple de réponse

```json
{
  "error": "The request uses features that are not supported for the selected model"
}
```

## Erreurs

HTTP 429 - POST /api/v1/fish_audio/text_to_speech

### Schéma de réponse

```json
{
  "properties": {
    "error": {
      "description": "Message d'erreur lisible par l'humain.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemple de réponse

```json
{
  "error": "Rate limit reached. Please retry later."
}
```

## Erreurs

HTTP 503 - POST /api/v1/fish_audio/text_to_speech

### Schéma de réponse

```json
{
  "properties": {
    "error": {
      "description": "Message d'erreur lisible par l'humain.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemple de réponse

```json
{
  "error": "Service under maintenance, please try again later"
}
```

## Erreurs

HTTP 504 - POST /api/v1/fish_audio/text_to_speech

### Schéma de réponse

```json
{
  "properties": {
    "error": {
      "description": "Message d'erreur lisible par l'humain.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemple de réponse

```json
{
  "error": "The request timed out"
}
```

## Exemples de code générés

Utilisez directement cURL, ou installez un SDK pour votre langage. Chaque exemple soumet la requête validée indiquée dans cette référence.

### curl

```curl
curl -X POST https://runapi.ai/api/v1/fish_audio/text_to_speech \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"model":"s1","text":"Welcome to RunAPI."}'
```

### javascript

#### Installer

```bash
npm install @runapi.ai/fish-audio
```

```javascript
import { FishAudioClient } from "@runapi.ai/fish-audio";

const client = new FishAudioClient({ apiKey: process.env.RUNAPI_API_KEY });
const result = await client.textToSpeech.run({
  "model": "s1",
  "text": "Welcome to RunAPI."
});
```

### python

#### Installer

```bash
pip install runapi-fish-audio
```

```python
import os
from runapi.fish_audio import FishAudioClient

client = FishAudioClient(api_key=os.environ["RUNAPI_API_KEY"])
result = client.text_to_speech.run(
  model="s1",
  text="Welcome to RunAPI."
)
```

### go

#### Installer

```bash
go get github.com/runapi-ai/fish-audio-sdk/go@latest
```

```go
package main

import (
  "context"
  "log"
  "os"

  "github.com/runapi-ai/core-sdk/go/option"
  fishaudio "github.com/runapi-ai/fish-audio-sdk/go/fishaudio"
)

func main() {
  client, err := fishaudio.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
  if err != nil {
    log.Fatal(err)
  }

  result, err := client.TextToSpeech.Run(context.Background(), fishaudio.TextToSpeechParams{
    Model: "s1",
    Text: "Welcome to RunAPI.",
  })
  if err != nil {
    log.Fatal(err)
  }
  _ = result
}
```

### ruby

#### Installer

```bash
gem install runapi-fish-audio
```

```ruby
require "runapi/fish_audio"

client = RunApi::FishAudio::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
result = client.text_to_speech.run(
  model: "s1",
  text: "Welcome to RunAPI."
)
```

### java

#### Installer

```kotlin
implementation("ai.runapi:runapi-fish-audio")
```

```java
import ai.runapi.fishaudio.FishAudioClient;
import ai.runapi.fishaudio.types.TextToSpeechParams;
import ai.runapi.fishaudio.types.TextToSpeechResponse;

public final class Example {
  public static void main(String[] args) {
    FishAudioClient client = FishAudioClient.builder()
        .apiKey(System.getenv("RUNAPI_API_KEY"))
        .build();
    TextToSpeechResponse result = client.textToSpeech().run(
        TextToSpeechParams.builder()
        .model("s1")
        .text("Welcome to RunAPI.")
            .build()
    );
  }
}
```

### php

#### Installer

```bash
composer require runapi-ai/fish-audio
```

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use RunApi\Core\ClientOptions;
use RunApi\FishAudio\FishAudioClient;

$client = new FishAudioClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$result = $client->textToSpeech->run([
  "model" => "s1",
  "text" => "Welcome to RunAPI."
]);
```

## Guides associés

- [Authentification](https://runapi.ai/fr/docs/guides/authentication.md)
- [Démarrage rapide](https://runapi.ai/fr/docs/guides/task-api/quickstart.md)

---

## Plus de ressources de RunAPI

- [Accueil](https://runapi.ai/fr/.md)
- [Catalogue de modèles](https://runapi.ai/fr/models.md)
- [Tarifs](https://runapi.ai/fr/pricing.md)
- [Fournisseurs](https://runapi.ai/fr/models)
- [Documentation](https://runapi.ai/fr/docs/guides)
- [SDK](https://runapi.ai/fr/sdk.md)
- [CLI](https://runapi.ai/fr/cli.md)
- [Serveur MCP](https://runapi.ai/fr/mcp.md)
- [Claude Code vs Cursor](https://runapi.ai/fr/claude-code-vs-cursor.md)
- [Configuration de l’API Cursor](https://runapi.ai/fr/cursor-api-setup.md)
- [RunAPI vs OpenRouter](https://runapi.ai/fr/openrouter-alternative.md)
- [Entreprise](https://runapi.ai/fr/contact.md)
- [Contact](https://runapi.ai/fr/contact.md)
- [Conditions](https://runapi.ai/fr/terms.md)
- [Confidentialité](https://runapi.ai/fr/privacy.md)
- [Index du site pour les agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Données structurées

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "fr",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/fr",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/fr/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "fr",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/fr",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/fricon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "fr",
    "@type": "TechArticle",
    "headline": "Fish Audio Texte en parole",
    "description": "Utilisez le point de terminaison texte vers parole pour recevoir un résultat dans la même réponse.",
    "url": "https://runapi.ai/fr/docs/api/fish-audio/text-to-speech",
    "mainEntityOfPage": "https://runapi.ai/fr/docs/api/fish-audio/text-to-speech"
  }
]
```
