Deepgram ↗ 提供语音 AI API,支持语音转文本、文本转语音和语音智能体。
https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepgram向 Deepgram 发送请求时,将当前使用的 URL 中的 https://api.deepgram.com/ 替换为 https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepgram/。
向 Deepgram 发送请求时,请确保具备以下条件:
- 你的 AI Gateway Account ID。
- 你的 AI Gateway gateway 名称。
- 有效的 Deepgram API 令牌。
import { createClient, LiveTranscriptionEvents } from "@deepgram/sdk";
const deepgram = createClient("{deepgram_api_key}", {
global: {
websocket: {
options: {
url: "wss://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepgram/",
_nodeOnlyHeaders: {
"cf-aig-authorization": "Bearer {CF_AIG_TOKEN}"
}
}
}
}
});
const connection = deepgram.listen.live({
model: "nova-3",
language: "en-US",
smart_format: true,
});
connection.send(...);