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
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model name, set to MegaTTS3 |
| input | string | Yes | Text to convert into speech |
| extra_body | object | No | Additional settings object for language and voice matching |
| extra_body.prompt_language | string | No | Text language, supported values: zh, en. Default: zh |
| extra_body.intelligibility_weight | number | No | Intelligibility weight, range 1.0 to 3.0. Higher values increase pronunciation clarity |
| extra_body.similarity_weight | number | No | Similarity weight, range 1.0 to 3.0. Higher values increase voice resemblance |
Tip: Higher
intelligibility_weightimproves comprehension but may reduce voice similarity, while highersimilarity_weightincreases 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.