🎤 Voice API

用户认证系统

📧 新用户将自动注册,已有账户直接登录

🔑 使用已有的 API Key 直接登录

🎤 Voice API 用户管理

加载中...

-
账号等级
-
今日配额
-
总请求数
-

开发者接入文档

接入总览

生产 Base URL:https://voice.wmj.com.cn。所有 HTTP API 使用 Header X-API-Key 鉴权;浏览器 WebSocket 使用 URL 参数 ?api_key=

页面上方的 API Key 就是当前账号可用密钥。复制按钮会自动把当前 API Key 写入示例,方便直接发给开发者或 AI 生成代码。

TTS 文字转语音

POST /tts_to_audio 返回 WAV;/tts_to_ogg/tts_to_mp3/tts_to_adpcm 返回压缩格式;/tts_to_audio_stream 返回流式 PCM。

ASR 语音识别

POST /asr 上传音频文件;/asr/stream 上传 16kHz 单声道 Int16 PCM;/asr/funasr 适合长音频和高精度识别。

实时 WebSocket

wss://voice.wmj.com.cn/ws/tts/stream/web/ws/asr/web 支持浏览器接入,URL 携带 api_key

发音人 speaker ID

开发时请把下面的 speaker ID 原样传入请求体的 speaker 字段。默认推荐女声:prompt_female_high;默认推荐男声:prompt_bobo

女声-高音,播报/提示音 prompt_female_high
女声-多多,亲和客服 prompt_duoduo
桃桃-温柔,助理/朗读 prompt_wenroutaotao
女声-温柔,中长文本 prompt_ref_audio_01
女声-英文,英文/中英混合 prompt_junjun
男声-优雅,播报/讲解 prompt_bobo
男声-坤坤,轻松互动 prompt_kunkun
男声-搞怪,角色化内容 prompt_ref_audio_02
自定义 atlantic custom_1765531319_atlantic
自定义 duanlaoshi,教学内容 custom_1772859966_duanlaoshi

curl 快速测试

curl -X POST "https://voice.wmj.com.cn/tts_to_audio" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"你好,欢迎使用 Voice API。","speaker":"prompt_female_high","speed":1.0,"num_step":2}' \
  --output reply.wav

curl -X POST "https://voice.wmj.com.cn/asr" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "audio=@recording.wav"

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://voice.wmj.com.cn/get_speakers"

JavaScript 示例

const API_KEY = 'YOUR_API_KEY';

async function textToSpeech(text) {
  const response = await fetch('https://voice.wmj.com.cn/tts_to_audio', {
    method: 'POST',
    headers: {
      'X-API-Key': API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      text,
      speaker: 'prompt_female_high',
      speed: 1.0,
      num_step: 2
    })
  });
  if (!response.ok) throw new Error(await response.text());
  return await response.blob();
}

Python 示例

import requests

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://voice.wmj.com.cn"

resp = requests.post(
    f"{BASE_URL}/tts_to_audio",
    headers={"X-API-Key": API_KEY},
    json={
        "text": "你好,欢迎使用 Voice API。",
        "speaker": "prompt_female_high",
        "speed": 1.0,
        "num_step": 2,
    },
    timeout=60,
)
resp.raise_for_status()
open("reply.wav", "wb").write(resp.content)

账户等级说明

  • Normal 普通用户:可使用 GPU 计算节点,每日限制 1000 次请求
  • Pro Pro 用户:可使用 GPU 计算节点,更高每日配额
  • Admin 管理员:无限制