Speech generation endpoint handler.
POST
/v1/audio/speech
const url = 'https://example.com/v1/audio/speech';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"input":"[S1] Dia is an open weights text to dialogue model. [S2] You get full control over scripts and voices. [S1] Wow. Amazing. (laughs) [S2] Try it now on Git hub or Hugging Face.","model":"nari-labs/Dia-1.6B","response_format":"mp3"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/audio/speech \ --header 'Content-Type: application/json' \ --data '{ "input": "[S1] Dia is an open weights text to dialogue model. [S2] You get full control over scripts and voices. [S1] Wow. Amazing. (laughs) [S2] Try it now on Git hub or Hugging Face.", "model": "nari-labs/Dia-1.6B", "response_format": "mp3" }'Request Body required
Section titled “Request Body required ” Media type application/json
Speech generation request
object
input
required
The text content to convert to speech.
string
Example
[S1] Dia is an open weights text to dialogue model. [S2] You get full control over scripts and voices. [S1] Wow. Amazing. (laughs) [S2] Try it now on Git hub or Hugging Face. model
The TTS model to use for audio generation.
string
Example
nari-labs/Dia-1.6B response_format
required
The desired audio format for the generated speech.
string
Responses
Section titled “ Responses ”Speech generation