Expand description
Stateless, typed Rust client for Silicon Waveform: text to speech and speech to text for Carbons and Silicons.
Waveform signs accounts in with Silicon Accounts.
This package never asks for a password and never stores anything; you decide where tokens
live (the waveform CLI keeps them in a private file under $SILICON_HOME/.waveform/dir).
signin::SignIngets Waveform’s tokens for an account as Waveform’s public client (no app secret): the device flow for Carbons (signin::SignIn::start_device), a short-lived token for Silicons (signin::SignIn::exchange_slt), refresh and sign-out.Clientcalls the Waveform API with the account’s access token (Client::with_bearer), or, for an app acting for an account, with a Silicon Accounts User verification proof (Client::with_proof, scopeswaveform.tts/waveform.stt).- A Carbon reads and manages the Waveform history, settings, provider keys and Briefcase
access of the Silicons it is custodian of with
Client::for_account. Nobody runs speech as another account.
use silicon_waveform_client::{Auth, Client, ExposeSecret as _, TtsRequest, signin::SignIn};
// A Silicon mints a short-lived token with `silicon-accounts login --app waveform -q`.
let sign_in = SignIn::new(silicon_waveform_client::DEFAULT_ACCOUNTS_URL)?;
let tokens = sign_in.exchange_slt("slt_…").await?;
println!("signed in as {}", tokens.account.label());
let waveform = Client::new(silicon_waveform_client::DEFAULT_API_URL, Auth::Anonymous)?
.with_bearer(tokens.access_token.expose_secret());
let request = TtsRequest { text: "Hello, Carbons and Silicons.".into(), ..Default::default() };
let speech = waveform.tts(&request, "greeting-0001").await?;
println!("{}", speech.file_url.or(speech.audio_url).unwrap_or_default());Errors are typed (Error): API failures keep Waveform’s
{"error":{"code","message","hint","reason"}} body (ApiError), sign-in failures say
exactly why Silicon Accounts refused (signin::SignInError).
Modules§
- signin
- Sign in to Waveform with Silicon Accounts, as Waveform’s public client (
client_idwaveform, no app secret: a CLI on someone’s machine has nowhere to keep one). - telemetry
Deprecated - Retired no-ops: Waveform records no telemetry. Retired: Waveform records no telemetry. These no-ops keep code written against 0.6 compiling.
Structs§
- Account
- A Silicon Accounts account as Waveform shows it. Key on
uuid(permanent, short and case-sensitive, e.g.zQo); showid(c:ada,si:scout), which can change. - Account
Ref - A reference to an account: its uuid and, when known, its current public id.
- Accounts
Info GET /api/v1/accounts: where to sign in to this Waveform. Public.- ApiError
- Waveform’s error body, bounded and stripped of control characters.
- Briefcase
Access - Waveform’s Briefcase access for an account.
- Briefcase
Access Status - Status of the User verification proof Waveform holds for Briefcase.
- Byok
Capabilities - Saved and request-only provider key support.
- Capabilities
- Waveform-level speech capabilities.
- Client
- A Waveform API client.
- Eleven
Labs TtsOptions - ElevenLabs controls applied only to this synthesis request.
- Eleven
Labs Voice ElevenLabsmapping for the multilingual-v2 fallback model.- Eleven
Labs Voice Settings - Delivery controls supported by multilingual v2.
- Gemini
TtsOptions - Gemini instructions become labeled prompt sections before the transcript.
- Held
Audio - An MP3 Waveform holds for the account (
GET /api/v1/audio/{request_id}). - Job
- A content-free speech job record.
- JobPage
- One page of speech history, newest first.
- Login
Status - Whether a credential is accepted by Waveform right now, without any token in it.
- Me
GET /api/v1/me: the account an access token belongs to.- Open
AiTts Options - OpenAI controls for a selected speech model.
- Preference
Defaults - Waveform’s default settings for accounts that changed nothing.
- Preferences
- An account’s speech settings (
GET/PATCH /api/v1/preferences). - Preferences
Update - A change to an account’s settings;
Nonefields stay as they are. - Provider
KeyInfo - A saved provider key, without its value.
- Provider
KeyList - The account’s saved provider keys (never their values).
- Provider
Keys - In-memory, request-only provider credentials.
Debugoutput redacts every key. - Report
Receipt - Receipt of a bug report.
- Source
Folder - The account’s Waveform folder in Briefcase, where STT sources are uploaded.
- Storage
Info - Where generated speech is: in the account’s Briefcase files, or held by Waveform.
- SttCapabilities
- Speech-to-text capabilities.
- SttRequest
- Request for transcription (
POST /api/v1/stt). - SttResponse
- Result of a transcription.
- TtsCapabilities
- Text-to-speech capabilities.
- TtsProvider
Options - Controls for one selected TTS provider; omitted values retain voice defaults.
- TtsRequest
- Request for synthesis (
POST /api/v1/tts). - TtsResponse
- Result of a synthesis.
- Voice
Profile - A voice profile and its mapping to every TTS provider.
- Voice
Profile Ref - Durable voice-profile identity recorded with results and history.
Enums§
Constants§
- APP_ID
- Waveform’s app id at Silicon Accounts. It is also the
client_idof Waveform’s public client (this package and the CLI) and thereceiving_appof proofs sent to Waveform. - CARBON_
SIGN_ IN - How a Carbon signs the CLI in (device flow in the browser).
- DEFAULT_
ACCOUNTS_ URL - The production Silicon Accounts origin.
- DEFAULT_
API_ URL - The production Waveform API origin.
- DOCS_
URL - Waveform’s documentation.
- PROOF_
SCOPES - Proof scopes Waveform honours from apps acting for an account.
- REPOSITORY_
URL - Waveform’s source repository (open for issues and pull requests).
- SILICON_
SIGN_ IN - How a Silicon signs the CLI in.
- SLT_
MINT_ COMMAND - How a Silicon mints a short-lived token for Waveform.
- VERSION
- This package’s version.
Traits§
- Expose
Secret - Expose a reference to an inner secret
Functions§
- is_
loopback - True for a host that is this machine (
localhost,*.localhost,127.0.0.0/8,::1): the only hosts plainhttp://is accepted for, because tokens would otherwise travel unencrypted.
Type Aliases§
- Result
- Result alias.
- Secret
String - Secret string type.