Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ full = [
"azure_openai",
"api",
"elevenlabs",
"sixtydb",
"agent",
"cohere",
"mistral",
Expand Down Expand Up @@ -79,6 +80,7 @@ cli = [
]
api = ["dep:axum", "dep:tower-http", "dep:uuid"]
elevenlabs = []
sixtydb = []
agent = []
rodio = ["dep:rodio"]
logging = ["dep:env_logger"]
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

> **Note**: This crate name previously belonged to another project. The current implementation represents a new and different library. The previous crate is now archived and will not receive any updates. **ref: https://github.com/rustformers/llm**

**LLM** is a **Rust** library that lets you use **multiple LLM backends** in a single project: [OpenAI](https://openai.com), [Anthropic (Claude)](https://www.anthropic.com), [Ollama](https://github.com/ollama/ollama), [DeepSeek](https://www.deepseek.com), [xAI](https://x.ai), [Phind](https://www.phind.com), [Groq](https://www.groq.com), [Google](https://cloud.google.com/gemini), [Cohere](https://cohere.com), [Mistral](https://mistral.ai), [Hugging Face](https://huggingface.co) and [ElevenLabs](https://elevenlabs.io).
**LLM** is a **Rust** library that lets you use **multiple LLM backends** in a single project: [OpenAI](https://openai.com), [Anthropic (Claude)](https://www.anthropic.com), [Ollama](https://github.com/ollama/ollama), [DeepSeek](https://www.deepseek.com), [xAI](https://x.ai), [Phind](https://www.phind.com), [Groq](https://www.groq.com), [Google](https://cloud.google.com/gemini), [Cohere](https://cohere.com), [Mistral](https://mistral.ai), [Hugging Face](https://huggingface.co), [ElevenLabs](https://elevenlabs.io) and [60db](https://60db.ai).
With a **unified API** and **builder style** - similar to the Stripe experience - you can easily create **chat**, text **completion**, speak-to-text requests without multiplying structures and crates.

## Key Features
Expand Down Expand Up @@ -36,7 +36,7 @@ Simply add **LLM** to your `Cargo.toml`:

```toml
[dependencies]
llm = { version = "1.3.8", features = ["openai", "anthropic", "ollama", "deepseek", "xai", "phind", "google", "groq", "mistral", "elevenlabs"] }
llm = { version = "1.3.8", features = ["openai", "anthropic", "ollama", "deepseek", "xai", "phind", "google", "groq", "mistral", "elevenlabs", "sixtydb"] }
```

## Use any LLM on cli
Expand All @@ -57,7 +57,7 @@ LLM includes a command-line tool for easily interacting with different LLM model

```shell
[dependencies]
llm = { version = "1.3.8", features = ["openai", "anthropic", "ollama", "deepseek", "xai", "phind", "google", "groq", "api", "mistral", "elevenlabs"] }
llm = { version = "1.3.8", features = ["openai", "anthropic", "ollama", "deepseek", "xai", "phind", "google", "groq", "api", "mistral", "elevenlabs", "sixtydb"] }
```

More details in the [`api_example`](examples/api_example.rs)
Expand Down Expand Up @@ -101,6 +101,8 @@ More details in the [`api_example`](examples/api_example.rs)
| [`anthropic_thinking_example`](examples/anthropic_thinking_example.rs) | Anthropic reasoning example |
| [`elevenlabs_stt_example`](examples/elevenlabs_stt_example.rs) | Speech-to-text transcription example using ElevenLabs |
| [`elevenlabs_tts_example`](examples/elevenlabs_tts_example.rs) | Text-to-speech example using ElevenLabs |
| [`sixtydb_stt_example`](examples/sixtydb_stt_example.rs) | Speech-to-text transcription example using 60db |
| [`sixtydb_tts_example`](examples/sixtydb_tts_example.rs) | Text-to-speech example using 60db |
| [`openai_stt_example`](examples/openai_stt_example.rs) | Speech-to-text transcription example using OpenAI |
| [`openai_tts_example`](examples/openai_tts_example.rs) | Text-to-speech example using OpenAI |
| [`tts_rodio_example`](examples/tts_rodio_example.rs) | Text-to-speech with rodio example using OpenAI |
Expand Down
29 changes: 29 additions & 0 deletions examples/sixtydb_stt_example.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//! Example demonstrating speech-to-text transcription using 60db
//!
//! This example shows how to:
//! 1. Initialize the 60db speech-to-text provider
//! 2. Load an audio file
//! 3. Transcribe the audio content

use llm::builder::{LLMBackend, LLMBuilder};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Get API key from environment variable or use test key
let api_key = std::env::var("SIXTYDB_API_KEY").unwrap_or("test_key".into());

// Initialize 60db speech-to-text provider
let stt = LLMBuilder::new()
.backend(LLMBackend::SixtyDb)
.api_key(api_key)
.build()?;

// Read audio file from disk (WAV, MP3, M4A, OGG, FLAC, WebM, MP4)
let audio_bytes = std::fs::read("test-stt.m4a")?;

// Transcribe audio content
let resp = stt.transcribe(audio_bytes).await?;

println!("Transcription: {resp}");
Ok(())
}
34 changes: 34 additions & 0 deletions examples/sixtydb_tts_example.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//! Example demonstrating text-to-speech synthesis using 60db
//!
//! This example shows how to:
//! 1. Initialize the 60db text-to-speech provider
//! 2. Generate speech from text
//! 3. Save the audio output to a file

use llm::builder::{LLMBackend, LLMBuilder};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Get API key from environment variable or use test key
let api_key = std::env::var("SIXTYDB_API_KEY").unwrap_or("test_key".into());

// Initialize 60db text-to-speech provider
let tts = LLMBuilder::new()
.backend(LLMBackend::SixtyDb)
.api_key(api_key)
// Optional: set a voice id from your 60db account (GET /myvoices).
// .voice("fbb75ed2-975a-40c7-9e06-38e30524a9a1")
.build()?;

// Text to convert to speech
let text = "Hello! This is an example of text-to-speech synthesis using 60db.";

// Generate speech
let audio_data = tts.speech(text).await?;

// Save the audio to a file
std::fs::write("output-speech-60db.mp3", audio_data)?;

println!("Audio file generated successfully: output-speech-60db.mp3");
Ok(())
}
3 changes: 3 additions & 0 deletions src/backends/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ pub mod azure_openai;
#[cfg(feature = "elevenlabs")]
pub mod elevenlabs;

#[cfg(feature = "sixtydb")]
pub mod sixtydb;

#[cfg(feature = "cohere")]
pub mod cohere;

Expand Down
Loading