Skip to main content
冰岩云支持三类语音能力(取决于所选模型):
  1. 语音转文字(STT / 转录):将音频转为文本。
  2. 语音翻译:将非英文音频转为英文文本。
  3. 文字转语音(TTS):将文本合成为语音。

语音转文字(转录)

使用 /v1/audio/transcriptions 将音频转为同语言的文本。通常以 multipart/form-data 上传音频文件。

cURL 示例

curl https://moxus.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-你的密钥" \
  -F model="whisper-1" \
  -F file="@meeting.mp3"

参数

参数说明
model转录模型名称,如 whisper-1(以模型广场为准)
file音频文件(mp3、wav、m4a 等)
language(可选)音频语言,如 zhen,指定可提升准确率
response_format(可选)返回格式:json(默认)、textsrtvtt
prompt(可选)提示词,帮助模型识别专有名词

响应(默认 json)

{
  "text": "这是会议录音转成的文字内容……"
}

Python 示例

from openai import OpenAI

client = OpenAI(api_key="sk-你的密钥", base_url="https://moxus.ai/v1")

with open("meeting.mp3", "rb") as f:
    resp = client.audio.transcriptions.create(
        model="whisper-1",
        file=f,
        language="zh",
    )
print(resp.text)

典型应用

  • 会议或访谈录音转文字。
  • 语音笔记整理。
  • 视频字幕生成(使用 srtvtt 格式)。

语音翻译

使用 /v1/audio/translations 将非英文音频直接转为英文文本(转录与翻译一步完成)。
curl https://moxus.ai/v1/audio/translations \
  -H "Authorization: Bearer sk-你的密钥" \
  -F model="whisper-1" \
  -F file="@chinese-speech.mp3"
响应:
{
  "text": "This is the English translation of the audio content..."
}
该接口的输出固定为英文。如需翻译为其他语言,可先转录再使用对话模型翻译。

文字转语音(TTS)

使用 /v1/audio/speech 将文本合成为语音,返回音频文件(二进制流)。

请求

{
  "model": "tts-1",
  "input": "你好,欢迎使用冰岩云的语音合成能力。",
  "voice": "alloy"
}
参数说明
modelTTS 模型名称,如 tts-1tts-1-hd(以模型广场为准)
input要合成的文本
voice音色,如 alloyechofableonyxnovashimmer
response_format(可选)音频格式:mp3(默认)、opusaacflac
speed(可选)语速,通常 0.25 至 4.0,默认 1.0

cURL 示例(保存为 mp3)

curl https://moxus.ai/v1/audio/speech \
  -H "Authorization: Bearer sk-你的密钥" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1",
    "input": "你好,欢迎使用冰岩云。",
    "voice": "alloy"
  }' \
  --output speech.mp3

Python 示例

from openai import OpenAI

client = OpenAI(api_key="sk-你的密钥", base_url="https://moxus.ai/v1")

resp = client.audio.speech.create(
    model="tts-1",
    voice="alloy",
    input="你好,欢迎使用冰岩云的语音合成能力。",
)
resp.stream_to_file("speech.mp3")
print("语音已保存为 speech.mp3")

典型应用

  • 有声读物、文章朗读。
  • 语音播报、语音助手。
  • 无障碍朗读。

计费说明

  • 语音转文字与翻译:通常按音频时长(如每分钟)计费。
  • 文字转语音:通常按输入字符或 Token 数计费。
具体价格参见 模型与定价

注意事项

  • 确认所选模型支持相应语音能力。
  • 音频文件存在大小或时长上限,过长的文件建议分段处理。
  • TTS 返回的是二进制音频流,代码中须以二进制方式写入文件,不得作为文本处理。

后续步骤