feat(deepgram): add Deepgram speech-to-text and text-to-speech provider
SA
16d ago+2142+2142+0123456789012345678901234567890123456789-2-2-0123456789
Adds a deepgram provider type: Deepgram's pre-recorded speech-to-text and its text-to-speech behind /v1/audio/transcriptions and /v1/audio/speech. Set DEEPGRAM_API_KEY to enable it.
Speech-to-text (POST /listen: audio as the request body, options as query parameters)
response_formatjson,text,verbose_json,srtandvttare all built from Deepgram's result. Segments and caption cues come from its utterances, since Deepgram has no caption output of its own.- Without
languagethe request sendsdetect_language=true, because Deepgram would otherwise assume English.smart_format=trueis on by default so transcripts are punctuated like OpenAI's. - Other form fields are forwarded as query parameters (
diarize,keyterm,smart_format=false, ...). prompt,stream=true,callback,callback_methodandmultichannelreturn 400 instead of being dropped.- Deepgram's reported duration is returned as OpenAI's
usage, so transcriptions are metered by audio seconds. Fortext,srtandvttthe duration travels beside the body in a newcore.AudioResponse.AudioSecondsfield, which the transcription handler prices from before measuring the upload. - With
diarize=true,verbose_jsonsegments and words carry Deepgram'sspeakernumber.
Text-to-speech (POST /speak)
- A Deepgram model id names the voice (
aura-2-thalia-en) and there is no voice parameter. Send the full id asmodel, or the familyaura-2asmodelwithvoice: "thalia-en". A voice that names another voice than the model (for examplealloy) returns 400. response_formatmp3,opus,aac,flac,wavandpcmmap to Deepgram'sencoding/container/sample_rate.speedis fitted to Deepgram's 0.7-1.5 range, as the ElevenLabs adapter does.instructionsreturns 400.- Deepgram's
bit_rate,sample_rate,mip_opt_outandtagare forwarded from extra JSON members;callback,callback_methodandstream_format: "sse"return 400. - Audio is relayed as Deepgram produces it and metered by input characters.
Models come from Deepgram's GET /models: the pre-recorded speech-to-text models and the voice models, plus the short ids Deepgram documents (nova-3 for nova-3-general) and the voice families.
Testing
- Unit tests against a fake upstream.
- A local gateway run against a fake Deepgram server: model listing, both endpoints, the 400 paths, and the usage rows (characters, audio seconds).
- No Deepgram key was available, so the request and response mapping is not verified against the live API. It follows the published reference: pre-recorded audio, text-to-speech, media output settings, models, errors. Checked live:
GET /v1/models(public, no key) and the error body for an invalid key. The docs page carries the same note.
Part of #739. Remaining: live streaming over Deepgram's WebSocket APIs (/v1/realtime relays OpenAI-shaped sessions and has no event translation), Flux text-to-speech (/v2/speak), and voice listing.