Skip to main content

Crate silicon_waveform_client

Crate silicon_waveform_client 

Source
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::SignIn gets 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.
  • Client calls 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, scopes waveform.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_id waveform, no app secret: a CLI on someone’s machine has nowhere to keep one).
telemetryDeprecated
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); show id (c:ada, si:scout), which can change.
AccountRef
A reference to an account: its uuid and, when known, its current public id.
AccountsInfo
GET /api/v1/accounts: where to sign in to this Waveform. Public.
ApiError
Waveform’s error body, bounded and stripped of control characters.
BriefcaseAccess
Waveform’s Briefcase access for an account.
BriefcaseAccessStatus
Status of the User verification proof Waveform holds for Briefcase.
ByokCapabilities
Saved and request-only provider key support.
Capabilities
Waveform-level speech capabilities.
Client
A Waveform API client.
ElevenLabsTtsOptions
ElevenLabs controls applied only to this synthesis request.
ElevenLabsVoice
ElevenLabs mapping for the multilingual-v2 fallback model.
ElevenLabsVoiceSettings
Delivery controls supported by multilingual v2.
GeminiTtsOptions
Gemini instructions become labeled prompt sections before the transcript.
HeldAudio
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.
LoginStatus
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.
OpenAiTtsOptions
OpenAI controls for a selected speech model.
PreferenceDefaults
Waveform’s default settings for accounts that changed nothing.
Preferences
An account’s speech settings (GET/PATCH /api/v1/preferences).
PreferencesUpdate
A change to an account’s settings; None fields stay as they are.
ProviderKeyInfo
A saved provider key, without its value.
ProviderKeyList
The account’s saved provider keys (never their values).
ProviderKeys
In-memory, request-only provider credentials. Debug output redacts every key.
ReportReceipt
Receipt of a bug report.
SourceFolder
The account’s Waveform folder in Briefcase, where STT sources are uploaded.
StorageInfo
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.
TtsProviderOptions
Controls for one selected TTS provider; omitted values retain voice defaults.
TtsRequest
Request for synthesis (POST /api/v1/tts).
TtsResponse
Result of a synthesis.
VoiceProfile
A voice profile and its mapping to every TTS provider.
VoiceProfileRef
Durable voice-profile identity recorded with results and history.

Enums§

Auth
How requests authenticate.
Error
Everything that can go wrong calling Waveform.

Constants§

APP_ID
Waveform’s app id at Silicon Accounts. It is also the client_id of Waveform’s public client (this package and the CLI) and the receiving_app of 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§

ExposeSecret
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 plain http:// is accepted for, because tokens would otherwise travel unencrypted.

Type Aliases§

Result
Result alias.
SecretString
Secret string type.