TTS Adapter Base Module (tts/base.rs)

openproxy · src/core/media/tts/base.rs · rust · MIT
voice, integration, lang:rust

Common base types, user-agent configuration, and error definitions for text-to-speech API adapters.

// Source: https://github.com/quangdang46/openproxy | License: MIT | Copyright 2024-2026 decolua and contributors
// Provided via justclaw.it.com; keep this notice with the code.
//! Common pieces for TTS adapters.

use async_trait::async_trait;
use base64::Engine as _;
use reqwest::Client;
use thiserror::Error;

use crate::types::ProviderConnection;

/// Browser-style User-Agent sent by Edge-TTS / Google-TTS upstream
/// scrapes — these endpoints reject anything that smells like curl.
pub(crate) const UA: &str = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) \
    AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36";

/// Errors a TTS adapter can produce.
#[derive(Debug, Error)]
pub enum TtsError {
    #[error("missing credentials: {0}")]
    MissingCredentials(String)

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key