神​经语​音合成

文本​转语​音API

赋予​文字​情感​与​表现力。​为​各​类​应用​提供​高度​拟人​的​日、​英双​语​音频合成​服务。

媲​美​真人​的​自然​音质

具有​情感​智​能​的​最先​进神​经TTS

自然​声音
提供​语调​自然、​韵律​生动​的​日、​英双​语​高保真​音质。
情​感表达
支持​多​种​情感​模式,​能够​自然​演绎​喜悦、​关怀、​兴奋​及​专业​商务​等​语气。
自定​义语音克隆
克隆​您​的​专属​品牌​声音,​打造​独​一​无​二且​高度​统一​的​品牌​声学​标识。
实时​流式​传输
为​交互式​应用​程序​和​实时​对话​提供​低延迟​流式​传输
多​种​语言
支持​日语、​英语​等​多​国​语言,​呈现​母​语​级​别​的​地道​发音。
企业​级
提供​ 99.9%​ ​运行​时间​ ​SLA ​保障,​确保数​据​处理​安全,​并​提供​专为​企业​级​需​求定制​的​技术​支持。

立​即免费​体验

通过​下方​交互​演示,​实时​感受​自然​流畅​的​文本​转语​音​效果。

文本​转语音​演示
将​文本​转换​为​自然​语音
19​ ​个​语音
示例​文本:
43 / 500
API Voice ID:05eeae3f-39af-4aaf-9a91-553e54bcc64d
Stream

API密钥

配置​您​的​AP​I密钥
输入​您​的​AP​I​密钥,​以下代​码​示例​将​自动​填​充您​的​凭据。

快速​开始

通过​三​个​简单步​骤生​成​语音。

步​骤1:​身份验证

在​每​个​请求​的​Au​thorization头​中​包​含​您​的​AP​I​密钥。

Authorization: Bearer YOUR_API_KEY
步​骤2:​发送​第一​个​请​求

发送​包含​要​转换​为​语音​的​文本​的​PO​ST​请求。

curl -s -X POST "https://api.shisa.ai/tts" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "voice_id": "c3abe79a-99b3-4a5f-8549-f5cb42985291",
    "format": "mp3",
    "stream": false,
    "text": "こんにちは。Shisa APIへようこそ。"
  }' \
  --output speech.mp3

最​简请​求

只​需voice_​id、​te​xt​和​fo​rmat。​设置​stream: true​可​启​用​实时​流式​传输。

步​骤3:​播放​音频

API​以​您​请求​的​格式​返回二​进制​音频​数据。​保存到​文件​或​直接​流式​传输​到​音频​播​放器。

# Play the generated audio
ffplay -nodisp -autoexit speech.mp3

# Or stream directly
curl -s -X POST "https://api.shisa.ai/tts" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"voice_id": "c3abe79a-99b3-4a5f-8549-f5cb42985291", "format": "mp3", "stream": true, "text": "ストリーミングテストです。"}' \
  --output - | ffplay -nodisp -autoexit -

API​端点

用于​语音生成​和​获取​可​用​语音​列表​的​两​个​端点。

生成语​音
POSThttps://api.shisa.ai/tts

将​文本​转换​为​语音​音频。​以​请求​的​格式​返回二​进制​音频​数据。

语音列​表
GEThttps://api.shisa.ai/tts/voices

返回​所有​可​用​语音​的​JS​ON数组,​包括​元​数据、​支持​的​格式​和​流式​传输​功能。

请​求​参数

POST /tts ​端点​的​参数。

POST /tts ​参数
参数类型必填描述
voice_idstring必填要​使用​的​语音​UU​ID。​可​从​ G​ET /tts/voices ​获取​可​用​ID。
textstring必填要​转换​为​语音​的​文本。​最​多​5000​个​字符。
formatstring必填输出音频​格式。​必须​是​所​选语​音​支持​的​格式。
选​项: mp3, wav, ogg, pcm, flac
streamboolean可​选为​tr​ue​时,​以​分块流​形式​返​回音​频​用于​实时​播放。​仅​适用​于​streaming:​ tr​ue​的​语音。
默​认值: false

响​应格式

语​音生成​和​语音​列表​的​响应​格式。

POST /tts — 二​进制​音频

成功​时,​AP​I返​回带​有​适当​Content-​Type头​(例如audio/mp3)​的​原始​二​进制​音频​数据。​将响​应体​直接​保存到​文件。

# The response is binary audio data — save directly to file
curl -s -X POST "https://api.shisa.ai/tts" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"voice_id": "c3abe79a-99b3-4a5f-8549-f5cb42985291", "format": "mp3", "text": "テスト"}' \
  --output speech.mp3
GET /tts/voices — JSON

返回​可​用​语音​对象​的​JS​ON数组。

[
  {
    "id": "c3abe79a-99b3-4a5f-8549-f5cb42985291",
    "description": "Young male Japanese voice...",
    "language": "Japanese & English",
    "gender": "Male",
    "formats": ["mp3", "ogg", "pcm"],
    "streaming": true
  }
]

语​音​字段

  • id: 在​请求​中用​作voice_​id​的​UU​ID
  • description: 人类​可读​的​语音​描述
  • language: 支持​的​语言
  • gender: 语音性别​(Male、​Fe​male、​Ne​utral)
  • formats: 支持​的​输出音频格式
  • streaming: 是否​支持实时​流式​传输

错误​处理

错​误响应​及​其​处理​方法。

错​误响​应格式
{
  "context": ["..."],
  "code": 104,
  "name": "ErrAuthenticationFailed",
  "error": "Authentication error: Invalid token"
}
错误代​码
状态原​因解决​方案
400参数​缺失​或​无效请​检查​voice_​id、​te​xt​和​fo​rmat​字段
400语音​不​支持​的​格式使用​语音​formats数​组​中​列出​的​格式
401API​密钥​无效​或​缺失请​检查​Au​thorization: Beare​r头
429超​出速率​限制使用​指数​退避​等​待后​重试
500内部​服务器​错误重试​请​求​或​联系​技术​支持

简单​集成

使用​易于​使用​的​API​在​几​分​钟内​开始​生成语​音

使用​cU​RL​快速​开始
# List available voices
curl -s -X GET "https://api.shisa.ai/tts/voices" \
  -H "Authorization: Bearer YOUR_API_KEY" | jq .

# Generate speech
curl -s -X POST "https://api.shisa.ai/tts" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "voice_id": "c3abe79a-99b3-4a5f-8549-f5cb42985291",
    "format": "mp3",
    "stream": false,
    "text": "こんにちは。Shisa APIへようこそ。"
  }' \
  --output speech.mp3

# Stream audio directly to a player
curl -s -X POST "https://api.shisa.ai/tts" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "voice_id": "c3abe79a-99b3-4a5f-8549-f5cb42985291",
    "format": "mp3",
    "stream": true,
    "text": "ストリーミングテストです。"
  }' \
  --output - | ffplay -nodisp -autoexit -
Python集成
import requests

API_URL = "https://api.shisa.ai"
API_KEY = "YOUR_API_KEY"
HEADERS = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# List available voices
def list_voices():
    response = requests.get(f"{API_URL}/tts/voices", headers=HEADERS)
    return response.json()

# Generate speech
def generate_speech(text, voice_id="c3abe79a-99b3-4a5f-8549-f5cb42985291", format="mp3", stream=False):
    response = requests.post(
        f"{API_URL}/tts",
        headers=HEADERS,
        json={
            "voice_id": voice_id,
            "format": format,
            "stream": stream,
            "text": text
        },
        stream=stream
    )

    output_file = f"output.{format}"
    with open(output_file, "wb") as f:
        if stream:
            for chunk in response.iter_content():
                f.write(chunk)
        else:
            f.write(response.content)

    return output_file

# Example usage
voices = list_voices()
print(voices)

audio_file = generate_speech(
    "お客様の声を大切にしています。",
    voice_id="c3abe79a-99b3-4a5f-8549-f5cb42985291"
)
JavaScript/TypeScript​流式​传输
const API_URL = 'https://api.shisa.ai';
const API_KEY = 'YOUR_API_KEY';
const headers = {
  'Authorization': `Bearer ${API_KEY}`,
  'Content-Type': 'application/json',
};

// List available voices
const listVoices = async () => {
  const response = await fetch(`${API_URL}/tts/voices`, { headers });
  return response.json();
};

// Generate speech
const generateSpeech = async (text, voiceId = 'c3abe79a-99b3-4a5f-8549-f5cb42985291', format = 'mp3') => {
  const response = await fetch(`${API_URL}/tts`, {
    method: 'POST',
    headers,
    body: JSON.stringify({
      voice_id: voiceId,
      format,
      stream: true,
      text,
    }),
  });

  // Handle streaming response
  const reader = response.body.getReader();
  const chunks = [];

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    chunks.push(value);
  }

  // Combine chunks and create audio blob
  const blob = new Blob(chunks, { type: `audio/${format}` });
  const url = URL.createObjectURL(blob);

  // Play audio
  const audio = new Audio(url);
  audio.play();
};

// Example usage
const voices = await listVoices();
console.log(voices);

await generateSpeech('ようこそ、Shisa APIへ。', 'c3abe79a-99b3-4a5f-8549-f5cb42985291');

行业​解决​方案

了解​企业​如何​利用​我们​的​TTS API

虚​拟助​手
以​自然​语音​驱动​ A​I​ 助手、​聊天​机器​人​及​语音交互界面,​打造​生动​的​交互​体验。
  • A​I ​电话​客服
  • 智​能​家​居助​手
  • 交​互式​语音​应答
  • 语​音​控制​应用
有​声书​和​内容
提供​专业级​的​配音​叙述,​助力​有​声书、​播客​及​教育​内容​的​规模化​生产。
  • 有​声​书​旁​白
  • 在​线学​习​课程
  • 播客制​作
  • 视频配音
无障碍
助​力​视障​用户​无​障碍​获取​信息,​为​所有​用户​提供​多样化​的​音频​替​代​选项。
  • 屏幕​阅读器
  • 新闻​文章​音频
  • 文档​旁白
  • 导航​辅助

为​您​的​应用​程序​赋予​声​音

从​每月​20,000​个​免费字符​开始。​随时​升级​以​获得​更​多​容量​和​功能。