Skip to content

音频模型 ​

语音合成 TTS ​

bash
curl https://ai.jhdataops.com/v1/audio/speech \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1",
    "input": "你好,欢迎使用 浙中TOKEN运营中心-模型广场。",
    "voice": "alloy"
  }' --output speech.mp3
python
from openai import OpenAI
client = OpenAI(api_key="sk-xxxxxxxx", base_url="https://ai.jhdataops.com/v1")

with client.audio.speech.with_streaming_response.create(
    model="tts-1", voice="alloy", input="你好世界",
) as resp:
    resp.stream_to_file("speech.mp3")

语音识别 ASR ​

bash
curl https://ai.jhdataops.com/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -F model="whisper-1" \
  -F file="@audio.mp3"

/v1/audio/translations 可在识别的同时翻译为英文。

实时语音 Realtime ​

低延迟语音对话使用 /v1/realtime(WebSocket)。适合语音助手等实时场景,用法与 OpenAI Realtime API 一致,将连接地址指向 wss://ai.jhdataops.com/v1/realtime 即可。

TIP

TTS 的 voice、ASR 的语言参数等以所选模型支持为准。

浙中TOKEN运营中心-模型广场 · 一个 API Key 接入全量大模型