Skip to content

ChatTTS

Brief: Convert text to speech using the ChatTTS model.


Overview

  • Method: POST
  • Path: /v1/audio/speech
  • Content-Type: application/json

Authentication

  • Header: Authorization: Bearer <token>
  • Optional Header: Accept: */*

Request Body Parameters

ParameterTypeRequiredDescription
modelstringYesModel name, fixed to ChatTTS
inputstringYesText to convert into speech, up to 4096 characters
voicestringYesVoice style, options include alloy, echo, fable, onyx, nova, shimmer
extra_bodyobjectNoAdditional settings for output style and sampling
extra_body.promptstringNoConversational tone level, value range oral_1 to oral_9
extra_body.temperaturenumberNoSampling temperature, range 0.0 to 1.0; higher values produce more random output
extra_body.top_PnumberNoTop-p sampling parameter, range 0.0 to 1.0
extra_body.top_KnumberNoTop-k sampling parameter, range 0 to 20
extra_body.voice_urlstringNoCustom voice file URL, must be .pt format

curl Example

bash
curl -X POST "https://api.gpt.ge/v1/audio/speech" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-xxxx" \
  -H "Accept: */*" \
  -d '{
    "model": "ChatTTS",
    "input": "Hello, I am the vapi TTS assistant. Thank you for using our API service!",
    "voice": "alloy",
    "extra_body": {
      "prompt": "oral_1",
      "temperature": 0.2,
      "top_K": 20
    }
  }'

JavaScript (fetch) Example

javascript
fetch('https://api.gpt.ge/v1/audio/speech', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer sk-xxxx',
    'Accept': '*/*'
  },
  body: JSON.stringify({
    model: 'ChatTTS',
    input: 'Hello, I am the vapi TTS assistant. Thank you for using our API service!',
    voice: 'alloy',
    extra_body: {
      prompt: 'oral_1',
      temperature: 0.2,
      top_K: 20
    }
  })
}).then(r => r.blob()).then(console.log);

Python (requests) Example

python
import requests

response = requests.post(
    'https://api.gpt.ge/v1/audio/speech',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'Bearer sk-xxxx',
        'Accept': '*/*'
    },
    json={
        'model': 'ChatTTS',
        'input': 'Hello, I am the vapi TTS assistant. Thank you for using our API service!',
        'voice': 'alloy',
        'extra_body': {
            'prompt': 'oral_1',
            'temperature': 0.2,
            'top_K': 20
        }
    }
)
print(response.status_code)
print(response.content[:20])

Response Example (200)

text
<binary audio data in the requested format, such as MP3 or WAV>

Note: The response usually returns the audio file content directly in the selected audio format.