name: senseaudio-tts description: SenseAudio Text-to-Speech (TTS) API for converting text to natural speech. Supports synchronous and SSE streaming modes, multiple voices, emotion control, speed/pitch/volume adjustment, and multi-language (Chinese/English). version: 1.0.0 metadata: openclaw: requires: env: - SENSEAUDIO_API_KEY primaryEnv: SENSEAUDIO_API_KEY homepage: https://senseaudio.cn/docs/text_to_speech_introduction
SenseAudio TTS converts text to natural, emotionally rich speech using a large language model. Supports 10+ emotions, streaming output (SSE), and fine-grained voice control.
Endpoint: POST https://api.senseaudio.cn/v1/t2a_v2
Auth: Authorization: Bearer $SENSEAUDIO_API_KEY
Max text length: 10,000 characters
| Header | Required | Value |
|---|---|---|
| Authorization | yes | Bearer YOUR_API_KEY |
| Content-Type | yes | application/json |
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | yes | SenseAudio-TTS-1.0 |
| text | string | yes | Text to synthesize. Supports <break time=500> pause tags |
| stream | boolean | yes | false = sync response; true = SSE streaming |
| voice_setting | object | yes | Voice configuration (see below) |
| audio_setting | object | no | Audio format configuration (see below) |
| dictionary | array | no | Polyphonic character corrections (cloned voices + TTS-1.5 only) |
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
| voice_id | string | - | - | Voice ID (system or cloned) |
| speed | float | 1.0 | [0.5, 2.0] | Speech speed |
| vol | float | 1.0 | [0, 10] | Volume |
| pitch | int | 0 | [-12, 12] | Pitch adjustment |
| latex_read | boolean | false | - | Read LaTeX/MathML formulas aloud |
| Parameter | Type | Default | Options |
|---|---|---|---|
| format | string | mp3 | mp3, wav, pcm, flac |
| sample_rate | int | 32000 | 8000, 16000, 22050, 24000, 32000, 44100 |
| bitrate | int | 128000 | 32000, 64000, 128000, 256000 (MP3 only) |
| channel | int | 2 | 1 (mono), 2 (stereo) |
<break> Pause TagInsert pauses in text:
你好<break time=500>歡迎使用我們的服務
time unit: milliseconds, min 100ms{
"data": {
"audio": "hex-encoded audio data...",
"status": 2
},
"extra_info": {
"audio_length": 3500,
"audio_sample_rate": 32000,
"audio_size": 56000,
"bitrate": 128000,
"audio_format": "mp3",
"audio_channel": 1,
"word_count": 24,
"usage_characters": 30
},
"base_resp": {"status_code": 0, "status_msg": "success"}
}
data.audio is hex-encoded. Decode: bytes.fromhex(audio_hex)
Each chunk: data: {"data":{"audio":"hex...","status":1},...}
Final chunk has status: 2 and includes extra_info.
curl -X POST https://api.senseaudio.cn/v1/t2a_v2 \
-H "Authorization: Bearer $SENSEAUDIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "SenseAudio-TTS-1.0",
"text": "道可道,非常道。名可名,非常名。",
"stream": false,
"voice_setting": {"voice_id": "male_0004_a"}
}' -o response.json
jq -r '.data.audio' response.json | xxd -r -p > output.mp3
import requests
resp = requests.post(
"https://api.senseaudio.cn/v1/t2a_v2",
headers={"Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"},
json={
"model": "SenseAudio-TTS-1.0",
"text": "道可道,非常道。",
"stream": False,
"voice_setting": {"voice_id": "male_0004_a"}
}
)
result = resp.json()
audio_bytes = bytes.fromhex(result["data"]["audio"])
with open("output.mp3", "wb") as f:
f.write(audio_bytes)
import requests, json
with requests.post(
"https://api.senseaudio.cn/v1/t2a_v2",
headers={"Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"},
json={"model": "SenseAudio-TTS-1.0", "text": "這是流式輸出示例。", "stream": True,
"voice_setting": {"voice_id": "male_0004_a"}},
stream=True
) as r:
with open("output.mp3", "wb") as f:
for line in r.iter_lines():
if line:
line_str = line.decode("utf-8")
if line_str.startswith("data: "):
chunk = json.loads(line_str[6:])
if chunk.get("data", {}).get("audio"):
f.write(bytes.fromhex(chunk["data"]["audio"]))
SenseAudio TTS 基於千億引數大模型,將文字轉化為自然流暢、情感豐富的語音。支援 10+ 種情感、流式輸出(SSE)及精細化語音控制。
介面地址: POST https://api.senseaudio.cn/v1/t2a_v2
鑑權: Authorization: Bearer $SENSEAUDIO_API_KEY
最大文本長度: 10,000 字元
| 引數名 | 必填 | 說明 |
|---|---|---|
| Authorization | 是 | Bearer YOUR_API_KEY |
| Content-Type | 是 | application/json |
| 引數名 | 型別 | 必填 | 說明 |
|---|---|---|---|
| model | string | 是 | SenseAudio-TTS-1.0 |
| text | string | 是 | 待合成文本,支援 <break time=500> 停頓符 |
| stream | boolean | 是 | false 同步;true SSE 流式 |
| voice_setting | object | 是 | 音色設定(見下表) |
| audio_setting | object | 否 | 音訊格式設定(見下表) |
| dictionary | array | 否 | 多音字糾正(僅克隆音色 + TTS-1.5) |
| 引數名 | 型別 | 預設值 | 範圍 | 說明 |
|---|---|---|---|---|
| voice_id | string | - | - | 音色 ID(系統音色或克隆音色) |
| speed | float | 1.0 | [0.5, 2.0] | 語速 |
| vol | float | 1.0 | [0, 10] | 音量 |
| pitch | int | 0 | [-12, 12] | 音調 |
| latex_read | boolean | false | - | 數學公式朗讀 |
小蔥技能7w4.net有完整的技能分類。
| 引數名 | 型別 | 預設值 | 選項 |
|---|---|---|---|
| format | string | mp3 | mp3, wav, pcm, flac |
| sample_rate | int | 32000 | 8000/16000/22050/24000/32000/44100 |
| bitrate | int | 128000 | 32000/64000/128000/256000(僅 MP3) |
| channel | int | 2 | 1(單聲道), 2(雙聲道) |
<break> 停頓符在文本中插入停頓:
你好<break time=500>歡迎使用我們的服務
time 單位為毫秒,最小值 100ms{
"data": {"audio": "hex編碼音訊...", "status": 2},
"extra_info": {
"audio_length": 3500,
"audio_sample_rate": 32000,
"audio_size": 56000,
"audio_format": "mp3",
"word_count": 24,
"usage_characters": 30
},
"base_resp": {"status_code": 0, "status_msg": "success"}
}
data.audio 為 hex 編碼,解碼:bytes.fromhex(audio_hex)
每個資料塊:data: {"data":{"audio":"hex...","status":1},...}
最後一個 chunk status: 2,包含完整 extra_info。
curl -X POST https://api.senseaudio.cn/v1/t2a_v2 \
-H "Authorization: Bearer $SENSEAUDIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "SenseAudio-TTS-1.0",
"text": "道可道,非常道。名可名,非常名。",
"stream": false,
"voice_setting": {"voice_id": "male_0004_a"}
}' -o response.json
jq -r '.data.audio' response.json | xxd -r -p > output.mp3
import requests
resp = requests.post(
"https://api.senseaudio.cn/v1/t2a_v2",
headers={"Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"},
json={
"model": "SenseAudio-TTS-1.0",
"text": "道可道,非常道。",
"stream": False,
"voice_setting": {"voice_id": "male_0004_a"}
}
)
audio_bytes = bytes.fromhex(resp.json()["data"]["audio"])
open("output.mp3", "wb").write(audio_bytes)
這個Skill質量不錯,文件寫得詳細清楚,中英文雙語對國內使用者很友好。引數說明全面,程式碼示例豐富,兩種呼叫模式都有覆蓋。不過缺少FAQ和音色推薦指南,新手可能需要額外查閱官方文件才能快速上手。總體來說是一個實用且完整的TTS API技能文件。