一键导入
deepgram-rust-text-to-speech
// Use when implementing Deepgram text-to-speech in the Rust SDK, including Aura model selection, speak feature flags, output file or byte-stream handling, and real crate APIs under speak::options and Speak.
// Use when implementing Deepgram text-to-speech in the Rust SDK, including Aura model selection, speak feature flags, output file or byte-stream handling, and real crate APIs under speak::options and Speak.
Use when implementing Deepgram audio intelligence from the Rust SDK, especially when intelligence features are attached to STT Options and batch responses instead of a separate audio-intelligence module.
Use when implementing Deepgram Flux conversational STT from the Rust SDK, including flux_request APIs, turn events, FluxResponse handling, and turn-detection tuning for voice-agent-style pipelines.
Use when implementing Deepgram project, key, member, scope, billing, invitation, or usage operations from the Rust SDK, including manage feature flags and the real Deepgram::projects/keys/members/scopes/billing/usage APIs.
Use when implementing Deepgram speech-to-text in the Rust SDK, including prerecorded REST transcription, live WebSocket streaming, listen feature flags, Options builder usage, and response handling.
Use when a user asks for Deepgram text intelligence from Rust. Route to raw HTTP guidance because this crate does not currently expose a dedicated /v1/read client or typed text-intelligence module.
Use when a user asks for Deepgram Voice Agent support from Rust. Route honestly: this crate does not currently expose the Agent WebSocket API, reusable agent configurations, or typed voice-agent events.
| name | deepgram-rust-text-to-speech |
| description | Use when implementing Deepgram text-to-speech in the Rust SDK, including Aura model selection, speak feature flags, output file or byte-stream handling, and real crate APIs under speak::options and Speak. |
Use this skill when generating audio from text with the Rust SDK's Speak surface.
speak_to_file(...).speak_to_stream(...).speak::options::Options.For a TTS-only install:
[dependencies]
deepgram = { version = "0.10.0", default-features = false, features = ["speak"] }
tokio = { version = "1", features = ["full"] }
futures = "0.3"
# Only add `bytes = "1"` if you need to name `bytes::Bytes` in your own signatures.
# The code below relies on type inference and does not import bytes directly.
let dg = deepgram::Deepgram::new(std::env::var("DEEPGRAM_API_KEY")?)?;
Authorization: Token <api_key>.use std::{path::Path, time::Instant};
use deepgram::{
speak::options::{Container, Encoding, Model, Options},
Deepgram,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let api_key = std::env::var("DEEPGRAM_API_KEY")?;
let dg = Deepgram::new(&api_key)?;
let options = Options::builder()
.model(Model::AuraAsteriaEn)
.encoding(Encoding::Linear16)
.sample_rate(16000)
.container(Container::Wav)
.build();
let start = Instant::now();
dg.text_to_speech()
.speak_to_file("Hello from Rust.", &options, Path::new("output.wav"))
.await?;
println!("Time to download audio: {:.2?}", start.elapsed());
Ok(())
}
use deepgram::{
speak::options::{Container, Encoding, Model, Options},
Deepgram,
};
use futures::stream::StreamExt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let api_key = std::env::var("DEEPGRAM_API_KEY")?;
let dg = Deepgram::new(&api_key)?;
let options = Options::builder()
.model(Model::AuraAsteriaEn)
.encoding(Encoding::Linear16)
.sample_rate(16000)
.container(Container::Wav)
.build();
let mut stream = dg
.text_to_speech()
.speak_to_stream("Hello from Rust.", &options)
.await?;
while let Some(chunk) = stream.next().await {
println!("received {} bytes", chunk.len());
}
Ok(())
}
Deepgram::text_to_speech(), Speak::speak_to_file(...), Speak::speak_to_stream(...).Options builder fields: model, encoding, sample_rate, container, bit_rate.deepgram::speak::options::Model and includes voices such as AuraAsteriaEn, AuraLunaEn, AuraOrionEn, plus CustomId(String).speak_to_stream(...) returns impl Stream<Item = bytes::Bytes>.README.mdsrc/speak/rest.rssrc/speak/options.rsexamples/speak/rest/text_to_speech_to_file.rsexamples/speak/rest/text_to_speech_to_stream.rshttps://developers.deepgram.com/openapi.yamlhttps://developers.deepgram.com/reference/text-to-speech/speak-requesthttps://developers.deepgram.com/asyncapi.yaml/llmstxt/developers_deepgram_llms_txthttps://developers.deepgram.com/docs/text-to-speechhttps://developers.deepgram.com/docs/tts-restsrc/speak/ today.Container::None; for .wav output use Container::Wav.speak_to_stream(...) still uses the REST endpoint. It streams HTTP response bytes; it is not the separate TTS WebSocket API.Token. Do not send API keys as Bearer.examples/speak/rest/text_to_speech_to_file.rsexamples/speak/rest/text_to_speech_to_stream.rsFor cross-language Deepgram product knowledge — the consolidated API reference, documentation finder, focused runnable recipes, third-party integration examples, and MCP setup — install the central skills:
npx skills add deepgram/skills
This SDK ships language-idiomatic code skills; deepgram/skills ships cross-language product knowledge (see api, docs, recipes, examples, starters, setup-mcp).