Skip to content

MegaTTS3

Brief: Convert text to speech using the MegaTTS3 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, set to MegaTTS3
inputstringYesText to convert into speech
extra_bodyobjectNoAdditional settings object for language and voice matching
extra_body.prompt_languagestringNoText language, supported values: zh, en. Default: zh
extra_body.intelligibility_weightnumberNoIntelligibility weight, range 1.0 to 3.0. Higher values increase pronunciation clarity
extra_body.similarity_weightnumberNoSimilarity weight, range 1.0 to 3.0. Higher values increase voice resemblance

Tip: Higher intelligibility_weight improves comprehension but may reduce voice similarity, while higher similarity_weight increases voice consistency.


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": "MegaTTS3",
    "input": "Hello, I am the morphogen TTS assistant. Thank you for using our API service!",
    "extra_body": {
      "prompt_language": "zh",
      "intelligibility_weight": 1.8,
      "similarity_weight": 3
    }
  }'

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: 'MegaTTS3',
    input: 'Hello, I am the morphogen TTS assistant. Thank you for using our API service!',
    extra_body: {
      prompt_language: 'zh',
      intelligibility_weight: 1.8,
      similarity_weight: 3
    }
  })
}).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': 'MegaTTS3',
        'input': 'Hello, I am the morphogen TTS assistant. Thank you for using our API service!',
        'extra_body': {
            'prompt_language': 'zh',
            'intelligibility_weight': 1.8,
            'similarity_weight': 3
        }
    }
)
print(response.status_code)
print(response.content[:20])

Response Example (200)

text
<binary audio data returned directly, such as MP3 or WAV file content>

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