#text-to-speech #real-time-streaming #streaming

aristech-stt-client

A Rust client library for the Aristech Speech-to-Text API

17 stable releases

3.2.0 Oct 14, 2025
3.1.2 Aug 25, 2025
3.1.1 May 15, 2025
3.1.0 Mar 27, 2025
1.0.0 Oct 21, 2024

#208 in Audio

Download history 8/week @ 2025-07-18 59/week @ 2025-07-25 60/week @ 2025-08-01 5/week @ 2025-08-08 15/week @ 2025-08-15 122/week @ 2025-08-22 67/week @ 2025-08-29 9/week @ 2025-09-05 9/week @ 2025-09-12 92/week @ 2025-09-26 30/week @ 2025-10-03 147/week @ 2025-10-10 37/week @ 2025-10-17 8/week @ 2025-10-24

228 downloads per month

MIT license

32KB
318 lines

Aristech STT-Client for Rust

This is the Rust client implementation for the Aristech STT-Server.

Installation

To use the client in your project, add it to your Cargo.toml or use cargo to add it:

cargo add aristech-stt-client

Usage

use aristech_stt_client::{SttClientBuilder, recognize_file};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    // Creating a client like this will attempt to parse the API key from the environment variable `ARISTECH_STT_API_KEY`.
    // If the environment variable is not set or invalid, it will fall back to default values.
    let mut client = SttClientBuilder::new()
        .build()
        .await?;

    // To manually specify the API key and catch invalid API keys, use the default builder and the `api_key` method.
    // let mut client = SttClientBuilder::default() // <- won't attempt to parse the API key from the environment variable
    //     .api_key("at-abc123...")? // <- will return an error if the API key is invalid
    //     .build()
    //     .await?;

    let results = recognize_file(&mut client, "path/to/audio/file.wav", None).await?;
    for result in results {
        println!(
            "{}",
            result
                .chunks
                .get(0)
                .unwrap()
                .alternatives
                .get(0)
                .unwrap()
                .text
        );
    }
    Ok(())
}

There are several examples in the examples directory:

  • file.rs: Demonstrates how to perform recognition on a file.
  • live.rs: Demonstrates how to perform live recognition using the microphone.
  • models.rs: Demonstrates how to get the available models from the server.
  • nlpFunctions.rs: Demonstrates how to list the configured NLP-Servers and the coresponding functions.
  • nlpProcess.rs: Demonstrates how to perform NLP processing on a text by using the STT-Server as a proxy.
  • account.rs: Demonstrates how to retrieve the account information from the server.

To run the examples, use cargo. For example:

cargo run --example live

API Key

If you didn't get an API key but a token, secret and host instead, you can simply convert those values with our API key generator.

Alternatively you can still provide the connection options manually.
use aristech_stt_client::{SttClientBuilder, Auth};

let mut client = SttClientBuilder::default()
    .host("https://stt.example.com:443")?
    .auth(Some(Auth {
        token: "your-token".to_string(),
        secret: "your-secret".to_string(),
    }))
    .build()
    .await?;

Build

To build the library, run:

cargo build

Dependencies

~13–25MB
~416K SLoC