Turn text into spoken audio with a text-to-speech model.
POST https://opendunes.com/v1/audio/speechBilled, with an API key: Authorization: Bearer $OPENDUNES_API_KEY. The speech models on sale are listed by GET /v1/models?output_modalities=speech, each with its supported_voices. The guide is Text-to-Speech.
curl https://opendunes.com/v1/audio/speech \
-H "Authorization: Bearer $OPENDUNES_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "microsoft/mai-voice-2-flash",
"voice": "fr-FR-Soleil:MAI-Voice-2",
"input": "Votre commande est prête. Merci de votre confiance.",
"response_format": "mp3"
}' \
--output reponse.mp3| Field | Description |
|---|---|
model · input | Required |
voice | Optional. One of the model's supported_voices; left out, the request is sent with no voice, for the model to use its own |
response_format | mp3 or pcm |
speed · instructions · … | The model's own settings, sent as you wrote them |
provider | Only provider.options: settings for one provider, keyed by its slug, sent as you wrote them. Speech takes no routing and no price cap |
The answer is the audio. It carries X-Generation-Id and X-Balance-Available. The input is counted in the model's own unit — characters, or bytes of UTF-8 text where the model prices by byte — as its price on the model page says. A model that is not a speech model is a 404, and nothing is charged.